https://github.com/pouchdb/geopouch
Spatial plugin from PouchDB extracted and supporting N dimentional coordinates.
https://github.com/pouchdb/geopouch
Last synced: about 2 months ago
JSON representation
Spatial plugin from PouchDB extracted and supporting N dimentional coordinates.
- Host: GitHub
- URL: https://github.com/pouchdb/geopouch
- Owner: pouchdb
- License: apache-2.0
- Created: 2013-11-21T20:57:12.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2020-05-23T11:49:40.000Z (almost 5 years ago)
- Last Synced: 2024-12-07T20:57:16.829Z (3 months ago)
- Language: JavaScript
- Homepage: http://pouchdb.com
- Size: 1.51 MB
- Stars: 85
- Watchers: 15
- Forks: 14
- Open Issues: 17
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - pouchdb/geopouch - Spatial plugin from PouchDB extracted and supporting N dimentional coordinates. (others)
README
Spatial Pouch [](https://travis-ci.org/pouchdb/geopouch)
====[](https://greenkeeper.io/)
Spatial plugin from PouchDB extracted and supporting N dimensional coordinates.
Originally by [@vmx](https://github.com/vmx) with contribution by [@daleharvey](https://github.com/daleharvey) and [@calvinmetcalf](https://github.com/calvinmetcalf).
Test with `npm test` coverage report with `npm test --coverage`, build with `npm run build`.
API
====`PouchDB.plugin(require('geopouch'));`
`db.spatial(function (doc) {emit(doc.geometry);}, [xmin, ymin, xmax, ymax], options, callback);`
`db.spatial('ddoc/functionName', [xmin, ymin, xmax, ymax], options, callback);`
`db.spatial('ddoc/functionName', [[xmin, ymin], [xmax, ymax]], options, callback);`
`db.spatial('ddoc/functionName', [[xmin, ymin, zmin], [xmax, ymax, zmax]], options, callback);`
`db.spatial('ddoc/functionName', [xmin, ymin, zmin], [xmax, ymax, zmax], options, callback);`
`db.spatial('ddoc/functionName', [xmin, ymin, xmax, ymax], options).then(function (result) {}, function (err) {});`
you may either give a function or a path to a ddoc, bounding boxes may be given in one of 3 formats
- single array with 4 numbers, these are interpreted as `[xmin, ymin, xmax, ymax]`
- single array with 2 arrays in it these are interpreted as `[[mins], [maxs]]`
- 2 arrays with numbers in them, first one is interpreted as mins, second one as maxesIf the callback is omited then a promise is returned.
Options are optional and valid options are include_docs and stale