【发布时间】:2015-02-20 08:11:34
【问题描述】:
我们在 Grails 项目 2.4.3 中使用 Spring Data Neo4j 3.2.0 和 Neo4j-spatial 0.13-neo4j-2.1.6
在用户域中
@Indexed(indexType = IndexType.POINT, indexName = "junctionLocations")
Point wkt
在用户存储库中
@Transactional
Result<UserDomain> findWithinDistance( final String indexName, Circle circle)
@Query("START item=node:junctionLocations({0}) RETURN labels(item) as label ,item")
List match(String a)
所以当我们运行时
Iterable<UserDomain> teamMembers1 = userDomainRepository.findWithinDistance
("junctionLocations", new
Circle(new Point(28.6100,77.2300),new Distance(2, Metrics.KILOMETERS)));
然后它给出准确的数据 但是当我们运行时
Iterable<UserDomain> teamMembers = userDomainRepository.match("withinDistance:[28.6100,77.2300,2.0]")
那么它不会给出任何数据,但是如果我们将距离增加到 10000,那么它就会给出数据。
实际上,我们希望使用 Cypher Query 获得正确的数据。 我们错过了什么吗? 有没有办法使用 Cypher 获得正确的数据?
【问题讨论】:
-
可能是默认距离是米。或者你必须翻转纬度/经度。不确定。
-
如果距离以米为单位,那么它应该如何工作 Iterable
teamMembers1 = userDomainRepository.findWithinDistance ("junctionLocations", new Circle(new Point(28.6100,77.2300),new Distance(2, Metrics) .公里))); .我不认为米或公里有问题 -
它有效,问题是我翻转纬度/经度......我的错误
标签: neo4j cypher spring-data-neo4j neo4j-spatial