0

我刚刚在我的服务器上设置了 Neo4j Spatial 插件,我正在使用 SDN 3.1.2 创建我的 wkt 索引:

@Indexed(indexName = "CarsLocation", indexType = IndexType.POINT) var wkt: String

整体效果很好,我可以像这样使用 HTTP 控制台进行查询withinDistance,返回匹配的节点:

POST /db/data/ext/SpatialPlugin/graphdb/findGeometriesWithinDistance {"layer":"CarsLocation","pointX":48.892501,"pointY":2.373140,"distanceInKm":100.0}

但是,我想像这样使用 Cypher 进行查询:

start n = node:CarsLocation("withinDistance:[48.892501,2.373140,100.0]") return n

无论值如何,它都只返回 0 行。

我遇到了这篇文章,建议手动将 Car 节点添加到空间索引:CarsLocation。

所以我执行了这个命令:

POST /db/data/index/node/CarsLocation {"value":"dummy","key":"dummy", "uri":"http://localhost:7474/db/data/node/30"}  //30 being the Car node I want to index

但它也不能使密码查询起作用。

我还尝试通过 http 调用执行 Cypher:

POST /db/data/cypher {"query" : "start n = node:CarsLocation({indexQuery}) return n", "params": {"indexQuery": "withinDistance:[48.892067, 2.373140, 10.0]"}}

也不行。

但是,当我指定大量公里(IMO 超过限制)时,这个通过:

start n = node:CarsLocation("withinDistance:[48.892501,2.373140,10000.0]") return n

(返回我的 Car 节点 30)。

我错过了什么重要的事情吗?

我不知道哪里可能是错误,阻止 Cypher 查询工作。

我指出我正在使用 Neo4j 2.1.2。

4

1 回答 1

1

米克378,

这里的问题很简单。'withinDistance' Cypher 空间索引查询有一个怪癖(就我而言,这是一个错误)。您必须先指定纬度,然后再指定经度。我对SDN不熟悉,所以我不知道您是否还需要执行显式空间索引创建命令。

恩典与平安,

吉姆

于 2014-08-21T16:48:22.687 回答