Skip to content

nypl-spacetime/indexed-geo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

indexed-geo

Indexed geospatial functions for Node.js, built using Turf, rbush and rbush-knn.

Installation & Usage

Installation:

npm install nypl-spacetime/indexed-geo

Usage:

const IndexedGeo = require('indexed-geo')

const polygons = JSON.parse(fs.readFileSync('polygons.geojson'))

const point = {
  type: 'Point',
  coordinates: [
    -73.954875,
    40.733697
  ]
}

const indexedGeo = IndexedGeo()
indexedGeo.index(polygons)

const results = indexedGeo.intersects(point)
// results now contains all the polygons intersecting with point

API

index(geojson)

Indexes GeoJSON object.

search(point)

Searches the index and returns all objects of which the bounding box intersects with point.

inside(point)

Finds all indexed objects which intersect point.

nearest(point, k, filterFn)

Finds k nearest neighbors. See rbush-knn's documentation for details.

About

Indexed geospatial functions for Node.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published