round-geo-position

1.0.0 • Public • Published

round-geo-position Build Status

This lib rounds given geographical coordinates up to given precision distance.

E.g., up to 10 meters or 1 kilometer, or whatever you need.

It respects the fact, that circles of latitude have different length around the Earth.

Installation

npm install --save round-geo-position

Usage

var round = require('round-geo-position');
// round geo coordinates up to 1 km
var roundedPosition = round(10.1234567, 20.1234567, 1000);
//=> {latitude: 10.123, longitude: 20.123}

Function arguments

  • latitude, number - [-90; 90]
  • longitude, number - [-180; 180]
  • precision, number > 0 - precision value in meters (by default) or yards
  • useYards, boolean - if true, precision is considered given in yards

Package Sidebar

Install

npm i round-geo-position

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • treble.snake