Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
@id-sdk/geo
Advanced tools
🌐 Geographic (spherical) math functions
npm install @id-sdk/geo
This library is distributed in ESM format only. It cannot be require()
'd from CommonJS.
For more, please read Sindre Sorhus’s FAQ.
import * as geo from '@id-sdk/geo';
import { geoLatToMeters } from '@id-sdk/geo';
This project is just getting started! 🌱
We're not able to support external contributors at this time, but check back in a bit when things have matured.
# geoLatToMeters(dLat: number): number <>
Convert degrees latitude to meters.
geoLatToMeters(1); // returns ≈111319
# geoLonToMeters(dLon: number, atLat: number): number <>
Convert degrees longitude to meters at a given latitude.
geoLonToMeters(1, 0); // returns ≈110946 at equator
# geoMetersToLat(m: number): number <>
Convert meters to degrees latitude.
geoMetersToLat(111319); // returns ≈1°
# geoMetersToLon(m: number, atLat: number): number <>
Convert meters to degrees longitude at a given latitude.
geoMetersToLon(110946, 0); // returns ≈1° at equator
# geoMetersToOffset(m: Vec2, tileSize?: number): Vec2 <>
Convert offset in meters (for example, imagery offset) to offset in tile pixels. tileSize
defaults to 256px.
geoMetersToOffset([100, 100]); // returns ≈[0.00064, -0.00064] pixels
# geoOffsetToMeters(offset: Vec2, tileSize?: number): Vec2 <>
Convert imagery offset in tile pixels to offset in meters. tileSize
defaults to 256px.
geoOffsetToMeters([0.00064, -0.00064]); // returns ≈[100, 100] meters
# geoSphericalDistance(a: Vec2, b: Vec2): number <>
Equirectangular approximation of spherical distances on Earth.
geoSphericalDistance([0, 0], [1, 0]); // returns ≈110946 meters
# geoScaleToZoom(k: number, tileSize?: number): number <>
Projection scale factor to tile zoom level. tileSize
defaults to 256px.
geoScaleToZoom(5340353.7154); // returns ≈17
# geoZoomToScale(z: number, tileSize?: number): number <>
Tile zoom to projection scale factor. tileSize
defaults to 256px.
geoZoomToScale(17); // returns ≈5340353.7154
# geoSphericalClosestPoint(points: Vec2[], a: Vec2): Closest | null <>
Returns info about the point from points
closest to the given test point a
.
# Vec2
An array of two numbers.
[number, number]
# Closest
An Object containing index
, distance
, and point
properties. Used as the return value for geoSphericalClosestPoint().
{ index: number, distance: number, point: Vec2 }
FAQs
Geographic (spherical) math functions
We found that @id-sdk/geo demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.