0.0.2 • Published 9 years ago

coordist v0.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

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)

nametypenotice
coord1ObjectFirst coordinate
coord2ObjectSecond coordinate
isCartesianBooleanIf 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 dev@instup.com