Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including geodetic-to-ecef with all npm packages installed. Try it out:

var geodeticToEcef = require("geodetic-to-ecef")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

geodetic-to-ecef v1.2.0

convert geodetic (lat,lon) coordinates to ecef (x,y,z)

geodetic-to-ecef

convert geodetic coordinates ([lat,lon]) to ecef (cartesian [x,y,z])

build status

example

var ecef = require('geodetic-to-ecef');
var xyz = ecef(37.8043722, -122.2708026);
console.log(xyz);

output:

$ node ecef.js
[ -2694044.4111565403, -4266368.805493665, 3888310.602276871 ]

methods

var ecef = require('geodetic-to-ecef')

var xyz = ecef(lat, lon, elevation=0)

Return an array xyz of [x,y,z] coordinates in meters from lat and lon.

Optionally supply an elevation in meters.

usage

This package ships with a command-line tool.

geodetic-to-ecef LAT LON
geodetic-to-ecef LAT LON ELEV

  Print the ECEF (X Y Z) coordinates for LAT LON
  and optionally an elevation ELEV in meters (default: 0).

example output:

$ geodetic-to-ecef -36.867 174.767
-5087568.564323121 465959.663344287 -3805595.1124150762

install

To get the library:

npm install geodetic-to-ecef

To get the command-line tool:

npm install -g geodetic-to-ecef

license

MIT

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free