geodetic

Geodesic, cartographic, and geographic
Author:
  • Jason Wohlgemuth
Source:

Namespaces

Geospatial Formats
WGS84 Datum

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]
Source:
See:
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

Convert a degree minutes seconds value

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

Convert a decimal degree value

const {toDegreesDecimalMinutes} = require('applied').geodetic;
const val = [32.8303, 0, 0];
let ddm = toDegreesDecimalMinutes(val);
console.log(ddm);// [32, 49.818]

Convert a degree minutes seconds value

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

Convert a decimal degree value

const {toDegreesMinutesSeconds} = require('applied').geodetic;
const val = [32.8303, 0, 0];
var dms = toDegreesMinutesSeconds(val);
console.log(dms);// [32, 49, 49.0800]

Convert a decimal degree minutes value

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

Calulate distance from Omaha, NE to San Diego, CA

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

Radius at equator

const {getRadius} = require('applied').geodetic;
let r = getRadius(0);
console.log(r);// 6378137

Radius at the Northern Tropic (Tropic of Cancer)

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

Radius with no latitude input (returns authalic radius)

const {getRadius} = require('applied').geodetic;
let r = getRadius();
console.log(r);// 6371001