Can I use spatial from NodeJS #128

Open
cayasso opened this Issue Jan 8, 2014 · 6 comments

Comments

Projects
None yet
5 participants

cayasso commented Jan 8, 2014

Can I use spatial from node, perhaps from the node-neo4j driver or any other?

Contributor

craigtaverner commented Jan 9, 2014

This depends on how you want to use spatial. Most of the spatial capabilities are only available through the Java API (and therefor only through embedded support, like Ruby neo4j.rb). The REST API has some standard LBS support (distance searches of points). node-neo4j works through REST, so it will only access these features. If that is all you need perhaps it is good enough.

There is also a node.js driver for the Java API called neo4j-embedded. See http://joewhite86.wordpress.com/2013/07/08/introducing-neo4j-embedded-a-neo4j-driver-for-node-js/. Perhaps this will allow for direct access to the full spatial capabilities.

I've never tried spatial from JS or node.js, so I cannot really comment on how easy or difficult these options are. It would be interesting to try though!

I am using it via node / rest api. Take a look at this gist: https://gist.github.com/thomasfr/8103037
After adding the layer and the spatial index, you actually just need cypher,.. almost. When adding new nodes you have to add this nodes also via a rest call to the spatial index manually.

Regarding your questions: you should be able to use the node-neo4j "driver" as it is just a wrapper module around neo4js rest api. All cypher queries are just sent over to the cypher endpoint and the response gets parsed and returned. The only additional http request you will have to make is step 4 from this gist https://gist.github.com/thomasfr/8103037 after each node creation.

I have created two issues for a more convenient way of using neo4j/spatial over http and cypher only:
neo4j#125
neo4j/neo4j#2048

cheers

cayasso commented Feb 25, 2014

@thomasfr That's awesome, I will give it a try in a project I am working on, thank you!

skevy commented Mar 4, 2015

@thomasfr how do you go about updating / deleting a node in the geo index using the rest API? Have you figured that out?

Did you successful query spatial node with NodeJS ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment