How do I create a spacial index in neo4j using only cypher?

老子叫甜甜 提交于 2019-12-04 05:26:21

问题


I want to play with neo4j and spacial indexes. I can't find any documentation that demonstrates how to do this through cypher, only through the REST API.

Is it possibly to create spacial indexes through Cypher, say in the neo4j web console?


回答1:


There is currently no way to create a spatial index using Cypher. You can either use java API or a REST call, see docs at http://neo4j-contrib.github.io/spatial/#rest-api-create-a-spatial-index for details. Since Neo4j browser allows to send HTTP POST you can type there:

:POST /db/data/index/node {"name":"geom", "config": 
  {"provider":"spatial", "geometry_type":"point", "lat":"lat", "lon":"lon"}
}

Alternatively you can use the index command within neo4j-shell.

Update for Neo4j 3.0

Neo4j Spatial for 3.0 provides stored procedures to manage the spatial index - and therefore everything can be done through cypher. See https://github.com/neo4j-contrib/spatial/blob/master/src/main/java/org/neo4j/gis/spatial/procedures/SpatialProcedures.java. Note: this version is not yet released, so you have to build from source yourself.



来源:https://stackoverflow.com/questions/26560023/how-do-i-create-a-spacial-index-in-neo4j-using-only-cypher

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!