Spatial plugin from PouchDB extracted and supporting N dimensional coordinates.
Originally by @vmx with contribution by @daleharvey and @calvinmetcalf.
Test with npm test
coverage report with npm test --coverage
, build with npm run build
.
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
[xmin, ymin, xmax, ymax]
[[mins], [maxs]]
If the callback is omited then a promise is returned.
Options are optional and valid options are include_docs and stale