simplegeoloc

0.0.1 • Public • Published

SimpleGeoLoc

Simple geolocation functions. Add items with geolocation information, then find items near a point/distance.

Usage

Installation

Via npm on Node:

npm install simplegeoloc

Usage

Reference in your program:

var sgl = require('simplegeoloc');

Create an item store:

var store = sgl.createStore();

Add items to store:

store.add(latitude, longitude, item);

Examples:

store.add(-34.47706, -58.50177, { city: 'Acassuso', geoname_id: 3436508 });
store.add(-34.74471, -58.40410, { city: 'Banfield', geoname_id: 3436152 });

Items near to a point:

var items = store.near(-34.47706, -58.50177);

The returned value is a JavaScript array. Each element has properties latitude, longitude, item (with the original associated item data).

Versions

  • 0.0.1 Published, naive near implementation, visiting all items, using haversine function for distances

To Do

  • First sample
  • Improve near implementation, partitioning items using an internal grid, then, visiting all the items in near cells instead of all the item list
  • New input format for position (latitude, longitude as strings; degree, minutes, seconds format 12° 20.736′ N, 98° 45.924′ W, etc)

License

MIT

References

Contribution

Feel free to file issues and submit pull requests — contributions are welcome<

If you submit a pull request, please be sure to add or update corresponding test cases, and ensure that npm test continues to pass.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.1
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.1
    0
  • 0.0.1-alpha
    1

Package Sidebar

Install

npm i simplegeoloc

Weekly Downloads

1

Version

0.0.1

License

none

Last publish

Collaborators

  • ajlopez