coordist
v0.0.2
Published
Calculate distance between two points as on geoid as on flat surface (cartesian coordinate system)
Downloads
4
Maintainers
Readme
Coordist
Count distance between two points as on Geoid (WGS84 format) as on flat surface (cartesian coordinate system)
Description
This Node.JS module was ported from php class of domino. For Geoid coordinates module has more accuracy than haversine formula.
Installation
$ npm install coordist
Using
Calculate distance between two points
distance(coord1, coord2, isCartesian)
|name|type|notice| |----|------|------| |coord1|Object|First coordinate| |coord2|Object|Second coordinate| |isCartesian|Boolean|If YES - flat surface, NO - Geoid|
Coordinate object has three fields: {lat, lng, alt}, where alt is altitude (default is 0)
Returns distance between coord1 and coord2 in meters.
Get decimal value of angle
getDecimalDegree(deg, min, sec)
Returns latitude name
checkLatitude(lat)
Returns north or south.
Returns longitude name
checkLongitude(lng)
Returns west or east.
Converts degrees to radians
Deg2Rad(value)
Example of using:
var coordist = require('coordist');
//Calculate distance using WGS84 coordinates on Geoid
coordist.distance({lat:37.2345, lng:55.245, alt:0}, {lat:38.123, lng:57.126, alt:0}, false);
//Calculate distance on flat surface
coordist.distance({x:2.5, y:3.4}, {x:7.12, y:8}, true);
Support or Contact
Having questions? Contact me using email [email protected]