lat

latlong

Create a simple k-d tree from lat/long and return the closest points.

Showing:

Popularity

Downloads/wk

1

GitHub Stars

2

Maintenance

Last Commit

9yrs ago

Contributors

1

Package

Dependencies

1

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Name

latlong

Build Status

Synopsis

Create a simple k-d tree from lat/long and return the closest points.

Description

Create a 2-dimensional k-d tree from latitude & longitude coordinate and return the closest points to the specified location.

Example

var latlong = require('latlong')

var coords = [
{lat: '40.739683', long: '73.985151', name: 'Gramercy Theatre'},
{lat: '40.730601', long: '74.000447', name: 'Blue Note Jazz Club'},
{lat: '40.742256', long: '74.006344', name: 'Milk Studios'},
{lat: '40.691805', long: '73.908089', name: 'Greenroom Brooklyn'}
]


var close = latlong(coords, {loc: {lat: 40, long: 50}, max: 50})


console.log(close.reverse())

Install:

npm install latlong

Test:

npm test

##Motivation: I found myself writing this logic inline in my app. It's quite simple, but it was generic enough that I could justify splitting it out.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial