pouchdb / geopouch

Spatial plugin from PouchDB extracted and supporting N dimentional coordinates.
http://pouchdb.com
Apache License 2.0
85 stars 14 forks source link

Provide a bit more documentation #1

Open ndarilek opened 10 years ago

ndarilek commented 10 years ago

Looks like an interesting project, but can I use it in the browser as well as on the server? If so, is there a process for minifying index.js plus all dependencies with the possible exception of Pouch which I'm fetching separately? I'd like a plugin like this but just don't know where it is intended to be used. An additional paragraph or two in the README would help, along with maybe a table listing supported geospatial operations.

calvinmetcalf commented 10 years ago

so in theory this should work on the server, but that requires geocouch which I've been unable to get working on my current computer so haven't been able to test it on the server. Though in the mean time I can spruce up the repo.

ndarilek commented 10 years ago

Ah, OK, so it's server-only and requires Geocouch? Thanks, knowing that helps.

calvinmetcalf commented 10 years ago

no, server AND local, server requires geocouch, local doesn't

ndarilek commented 10 years ago

Sweet. Is there a minified version I can drop into my app? How about a Grunt or other build process for building same?

This looks really awesome, I've been looking for in-browser syncable geospatial support for quite some time!

calvinmetcalf commented 10 years ago

the pull i just started as a build process, but not minified, you can checkout the other branch and run npm install and then npm run build which should build it, after you load the script add the code PouchDB.plugin('Spatial',geopouch);

scubbx commented 9 years ago

I tried to build a browser standalone version with the rtree branch - there seems to be a problem with the "inherits"module (TypeError: superCtor is undefined). There is a special version available for browsers at https://github.com/isaacs/inherits (inherits_browser.js) but I was unable to include it.

calvinmetcalf commented 9 years ago

It should work with browserify

On Mon, Dec 15, 2014, 5:20 PM scubbx notifications@github.com wrote:

I tried to build a browser standalone version with the rtree branch - there seems to be a problem with the "inherits"module (TypeError: superCtor is undefined). There is a special version available for browsers at https://github.com/isaacs/inherits (inherits_browser.js) but I was unable to include it.

— Reply to this email directly or view it on GitHub https://github.com/pouchdb/geopouch/issues/1#issuecomment-67077386.

scubbx commented 9 years ago

Here are some more details from a second try with a freshly cloned repository:

$ git checkout rtree $ npm install

no problems

$ npm test --coverage

everything ok (7 passing (8s))

$ npm run build

no suspicious outputs, dist folder is created and the file geopouch.js has 714kB

$ npm run build-test

no suspicious outputs, test folder is created with 4 files. When opening the index.html file in a browser, the error TypeError: superCtor is undefined in line 6933 appears. The same happens when manually loading pouchdb and than geopouch in an HTML file.

My npm version is 1.4.28, the node version 0.10.32, the installed browserify version is 7.0.1

Did I miss an important step?

calvinmetcalf commented 9 years ago

That is an error related to inheriting something that doesn't exist possibly related to crypto browserify but I thought I fixed that bug.

On Mon, Dec 15, 2014, 5:51 PM scubbx notifications@github.com wrote:

Here are some more details from a second try with a freshly cloned repository:

$ git checkout rtree $ npm install

no problems

$ npm test --coverage

everything ok (7 passing (8s))

$ npm run build

no suspicious outputs, dist folder is created and the file geopouch.js has 714kB

$ npm run build-test

no suspicious outputs, test folder is created with 4 files. When opening the index.html file in a browser, the error TypeError: superCtor is undefined in line 6933 appears. The same happens when manually loading pouchdb and than geopouch in an HTML file.

My npm version is 1.4.28, the node version 0.10.32, the installed browserify version is 7.0.1

Did I miss an important step?

— Reply to this email directly or view it on GitHub https://github.com/pouchdb/geopouch/issues/1#issuecomment-67081806.

calvinmetcalf commented 9 years ago

I'll look into this tomorrow

calvinmetcalf commented 9 years ago

Getting the same error, I fixed this in browserify crypto 3.6.1 but 3.6.0 is loading

On Mon, Dec 15, 2014, 5:55 PM Calvin Metcalf calvin.metcalf@gmail.com wrote:

That is an error related to inheriting something that doesn't exist possibly related to crypto browserify but I thought I fixed that bug.

On Mon, Dec 15, 2014, 5:51 PM scubbx notifications@github.com wrote:

Here are some more details from a second try with a freshly cloned repository:

$ git checkout rtree $ npm install

no problems

$ npm test --coverage

everything ok (7 passing (8s))

$ npm run build

no suspicious outputs, dist folder is created and the file geopouch.js has 714kB

$ npm run build-test

no suspicious outputs, test folder is created with 4 files. When opening the index.html file in a browser, the error TypeError: superCtor is undefined in line 6933 appears. The same happens when manually loading pouchdb and than geopouch in an HTML file.

My npm version is 1.4.28, the node version 0.10.32, the installed browserify version is 7.0.1

Did I miss an important step?

— Reply to this email directly or view it on GitHub https://github.com/pouchdb/geopouch/issues/1#issuecomment-67081806.

calvinmetcalf commented 9 years ago

because it was never published dominictarr/crypto-browserify#85

scubbx commented 9 years ago

Thank you very much for looking into this, now it compiles all right. :-)

But I am a bit confused about the API: When simply loading with PouchDB.plugin('Spatial',geopouch);, the geopouch plugin can be accessed by the keyword geopouch. But this stands in contrast to the way the API is explained in the readme.md ( db.spatial([xmin, ymin, xmax, ymax], [options, callback)]; ). Also, how would geopouch know which database to access?

When changing the way the module is loaded in index.js by the method explained on the PouchDB homepage (PouchDB.plugin({ spatial: function spatial(fun, bbox, ...) it can be called as an extension of each initialized PouchDB database. But in any way, I don't receive results. Also, shouldn't the correct way to call geopouch be like db.spatial( designdoc/spatialview, [bbox], ... ) ? (in contrast to the explanation in the readme.md)

calvinmetcalf commented 9 years ago

the readme is out of data look at the tests for now

calvinmetcalf commented 9 years ago

this is how to load it and this is how to query it