how to create geohash tree in neo4j

2019-07-25 14:29发布

问题:

Based on a problem here an expert have answered with this code:

CALL spatial.addPointLayerGeohash('my_geohash_layer_name')
CREATE (n:Node {latitude:60.1,longitude:15.2}) WITH n 
CALL spatial.addNode('my_geohash_layer_name',n) YIELD node 
RETURN node

to create a geohash tree that organise spatial nodes.

so i tried that with two spatial nodes but unlike R-tree the spatial nodes aren't linked to the layer with any connection !? is this code true ? or what is wrong ?

回答1:

If you want an in-graph tree structure as an index, you need to use the RTree index (which is the default in Neo4j Spatial). If you want a geohash index, there will be no tree in the graph because geohashes are being stored as strings in a lucene index for string prefix searches. String prefix searches are a common way of searching geohash based indexes.