forked from pouchdb/geopouch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f65bda1
commit b40ab83
Showing
1 changed file
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,37 @@ | ||
Spatial Pouch [![Build Status](https://travis-ci.org/pouchdb/geopouch.svg?branch=rtree)](https://travis-ci.org/pouchdb/geopouch) | ||
==== | ||
|
||
Spatial plugin from PouchDB extracted and supporting N dimentional coordinates. | ||
Spatial plugin from PouchDB extracted and supporting N dimensional coordinates. | ||
|
||
Origionally by [@vmx](https://github.com/) with contribution by [@daleharvey](https://github.com/) and [@calvinmetcalf](https://github.com/). | ||
Originally by [@vmx](https://github.com/) with contribution by [@daleharvey](https://github.com/) and [@calvinmetcalf](https://github.com/). | ||
|
||
Test with `npm test` coverage report with `npm test --coverage`, build with `npm run build`. Server queries require geocouch installed, have yet to test with that. | ||
Test with `npm test` coverage report with `npm test --coverage`, build with `npm run build`. | ||
|
||
API | ||
==== | ||
|
||
`db.spatial([xmin, ymin, xmax, ymax], [options, callback)];` | ||
`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, zmin]], options, callback);` | ||
|
||
`db.spatial('ddoc/functionName', [xmin, ymin, zmin], [xmax, ymax, zmin], options, callback);` | ||
|
||
`db.spatial('ddoc/functionName', [[xmin, ymin, zmin], [xmax, ymax, zmin]], 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 maxes | ||
|
||
If the callback is omited then a promise is returned. | ||
|
||
Options are optional and valid options are include_docs and stale |