node-geopoint

JavaScript coordinate conversion library between Decimal Degree and Deg-Min-Sec.

Usage no npm install needed!

<script type="module">
  import nodeGeopoint from 'https://cdn.skypack.dev/node-geopoint';
</script>

README

node-geopoint

JavaScript coordinate conversion library between Decimal Degree and Deg-Min-Sec.

Release npm version
Build Status devDependency Status

This library expects latitude and longitude in EPSG:4326 (WGS84). To convert between different projections check out Proj4js.

Installation

npm install node-geopoint

Convert Decimal -> Degrees

const geo = require('node-geopoint')

const lat = 58.74554729994484
const lng = 24.72504500749274
const res = geo(lat, lng)

console.log(res.lat.deg) // 58° 44' 43.97"
console.log(res.lng.deg) // 24° 43' 30.16"

Convert Degrees -> Decimal

const geo = require('node-geopoint')

const lat = '58° 44\' 43.97"'
const lng = '24° 43\' 30.16"'
const res = geo(lat, lng)

console.log(res.lat.dec) // 58.74554722222222
console.log(res.lng.dec) // 24.725044444444443

Original authors