项目作者: honzahommer

项目描述 :
JavaScript coordinate conversion library between Decimal Degree and Deg-Min-Sec.
高级语言: JavaScript
项目地址: git://github.com/honzahommer/node-geopoint.git
创建时间: 2016-12-18T10:11:04Z
项目社区:https://github.com/honzahommer/node-geopoint

开源协议:MIT License

下载


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

  1. npm install node-geopoint

Convert Decimal -> Degrees

  1. const geo = require('node-geopoint')
  2. const lat = 58.74554729994484
  3. const lng = 24.72504500749274
  4. const res = geo(lat, lng)
  5. console.log(res.lat.deg) // 58° 44' 43.97"
  6. console.log(res.lng.deg) // 24° 43' 30.16"

Convert Degrees -> Decimal

  1. const geo = require('node-geopoint')
  2. const lat = '58° 44\' 43.97"'
  3. const lng = '24° 43\' 30.16"'
  4. const res = geo(lat, lng)
  5. console.log(res.lat.dec) // 58.74554722222222
  6. console.log(res.lng.dec) // 24.725044444444443

Original authors