Geodesic, cartographic, and geographic
- Source:
Namespaces
Methods
(static) cartesianToGeodetic() → {Array.<number>}
Convert cartesian (x, y, z) to geodetic (latitude, longitude, height)
Properties:
Name | Type | Description |
---|---|---|
point |
Array.<number>
|
[x, y, z] |
Returns:
- Type:
-
Array.<number>
[latitude, longitude, height] (in degrees)
(static) geodeticToCartesian() → {Array.<number>}
Convert geodetic (latitude, longitude, height) to cartesian (x, y, z)
Properties:
Name | Type | Description |
---|---|---|
point |
Array.<number>
|
[latitude, longitude, height] (in degrees) |
- Source:
Returns:
- Type:
-
Array.<number>
[x, y, z]
(static) toDecimalDegrees(value) → {number}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
Array.<number>
|
Latitude or longitude expressed as [DDD, MMM, SSS] |
Returns:
- Type:
-
number
Example
const {toDecimalDegrees} = require('applied').geodetic;
const val = ['32', '49', '49.0800'];
let dd = toDecimalDegrees(val);
console.log(dd);// 32.8303
(static) toDegreesDecimalMinutes(value) → {Array.<number>}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
Array.<number>
|
Latitude or longitude expressed as [DDD, MMM, SSS] |
Returns:
- Type:
-
Array.<number>
[degrees, minutes, seconds]
Examples
const {toDegreesDecimalMinutes} = require('applied').geodetic;
const val = [32.8303, 0, 0];
let ddm = toDegreesDecimalMinutes(val);
console.log(ddm);// [32, 49.818]
const {toDegreesDecimalMinutes} = require('applied').geodetic;
const val = [32, 49, 49.0800];
let ddm = toDegreesDecimalMinutes(val);
console.log(ddm);// [32, 49.818]
(static) toDegreesMinutesSeconds(value) → {Array.<number>}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
Array.<number>
|
Latitude or longitude expressed as [DDD, MMM, SSS] |
Returns:
- Type:
-
Array.<number>
[degrees, minutes, seconds]
Examples
const {toDegreesMinutesSeconds} = require('applied').geodetic;
const val = [32.8303, 0, 0];
var dms = toDegreesMinutesSeconds(val);
console.log(dms);// [32, 49, 49.0800]
const {toDegreesMinutesSeconds} = require('applied').geodetic;
const val = [32, 49.818, 0];
let dms = toDegreesMinutesSeconds(val);
console.log(dms);// [32, 49, 49.0800]
(inner) getGeocentricLatitude(theta) → {number}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
theta |
number
|
Geographic latitude |
Returns:
- Type:
-
number
Geocentric latitude
(inner) getHaversineDistance(pointA, pointB) → {number}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
pointA |
Array.<number>
|
[latitude, longitude] (in degrees) |
pointB |
Array.<number>
|
[latitude, longitude] (in degrees) |
Returns:
- Type:
-
number
Distance between points (in meters)
Example
const {getHaversineDistance} = require('applied').geodetic;
const a = [41.2500, 96.0000];// Omaha, NE
const b = [32.7157, 117.1611];// San Diego, CA
let distance = getHaversineDistance(a, b);
console.log(distance);// about 2098 km
(inner) getRadius(thetaopt) → {number}
Get radius at a given latitude using WGS84 datum
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
theta |
number
|
<optional> |
Geographic latitude (decimal format) |
Returns:
- Type:
-
number
Radius in meters
Examples
const {getRadius} = require('applied').geodetic;
let r = getRadius(0);
console.log(r);// 6378137
const {getRadius, toDecimalDegrees} = require('applied').geodetic;
const NORTHERN_TROPIC_LATITUDE = [23, 26, 13.4];
let latitude = toDecimalDegrees(NORTHERN_TROPIC_LATITUDE);
let r = getRadius(latitude);
console.log(r);// 6374410.938026696
const {getRadius} = require('applied').geodetic;
let r = getRadius();
console.log(r);// 6371001