Configuring spatial plugin for neo4j

158 views Asked by At

To learn some new things I recently started a web project based on Scala, Play and Neo4j. My Play application connects to Neo4j using AnormCypher.

Everything works fine, but at the moment I am struggling to implement a proximity search feature...

I know that the Spatial Plugin is the way to go and already installed the plugin on the Neo4j server, but I don't know which configuration steps are necessary to use it (in ordinary cypher) queries.

The relevant nodes look like this:

(city: Location {name: "Zürich", lat: 47.3667, lon: 8.5500})

Is it possible to setup everything, such that I can write something like

MATCH (location: Location)-[...SOME_PATTERN
WHERE location 'withinDistance:[47.3,8.5, 100.0]'
RETURN location.name

How can I achieve this?

1

There are 1 answers

9
Eve Freeman On BEST ANSWER

The spatial plugin still uses the legacy indexing syntax in Cypher, so you must use this sort of syntax:

START location=node:spatial_index_here('withinDistance:[47.3,8.5, 100.0]')
MATCH (location)-[...SOME_PATTERN
RETURN location.name