2013-03-11 2 views
0

withinDistance이 Cypher에서 올바르게 작동하지 못합니다.neo4j spatial cypher withinDistance 문제

지형을 추가하고 지형을 추가하고 공간 REST findGeometriesWithinDistance을 사용하여 색인을 호출하고 쿼리 할 수 ​​있습니다.

  1. POST /db/data/ext/SpatialPlugin/graphdb/addEditableLayer {"layer":"yada"}
  2. POST /db/data/ext/SpatialPlugin/graphdb/addGeometryWKTToLayer { "layer":"yada","geometry":"LINESTRING (-87.8269667076541 42.5931258671059,-87.8280193743192 42.5930348004394,-87.8284217076519 42.5931722004391)"}
  3. POST /db/data/ext/SpatialPlugin/graphdb/addGeometryWKTToLayer {"layer":"yada","geometry":"LINESTRING (-87.8118643076776 42.588086600447,-87.8183341743342 42.5876782004477,-87.818426974334 42.5877468671142)"}
  4. POST /db/data/index/node/ {"name":"yada", "config":{"provider":"spatial","wkb":"wkb"}}
  5. POST /db/data/ext/SpatialPlugin/graphdb/findGeometriesWithinDistance {"layer":"yada","distanceInKm":2,"pointX":-87.845556,"pointY":42.582222}

단 I은 사이퍼를 이용 withinDistance를 호출 할 때, 예를 들어

  • POST /db/data/cypher {"query":"START n=node:yada('withinDistance:[-87.845556,42.582222,10.0]') RETURN n"}

나는이 동작을 시작하지만 최근 뭔가 것 같다 때 나는 확실하지 않다 다시

400 Bad Request 
{ 
    "message" : "only within, WITHINDISTANCE and bbox are implemented.", 
    "exception" : "BadInputException", 
    "stacktrace" : [ "org.neo4j.server.rest.repr.RepresentationExceptionHandlingIterable.exceptionOnHasNext(RepresentationExceptionHandlingIterable.java:50)", "org.neo4j.helpers.collection.ExceptionHandlingIterable$1.hasNext(ExceptionHandlingIterable.java:60)", "org.neo4j.helpers.collection.IteratorWrapper.hasNext(IteratorWrapper.java:42)", "org.neo4j.server.rest.repr.ListRepresentation.serialize(ListRepresentation.java:58)", "org.neo4j.server.rest.repr.Serializer.serialize(Serializer.java:75)", "org.neo4j.server.rest.repr.MappingSerializer.putList(MappingSerializer.java:61)", "org.neo4j.server.rest.repr.CypherResultRepresentation.serialize(CypherResultRepresentation.java:57)", "org.neo4j.server.rest.repr.MappingRepresentation.serialize(MappingRepresentation.java:42)", "org.neo4j.server.rest.repr.OutputFormat.assemble(OutputFormat.java:179)", "org.neo4j.server.rest.repr.OutputFormat.formatRepresentation(OutputFormat.java:131)", "org.neo4j.server.rest.repr.OutputFormat.response(OutputFormat.java:117)", "org.neo4j.server.rest.repr.OutputFormat.ok(OutputFormat.java:55)", "org.neo4j.server.rest.web.CypherService.cypher(CypherService.java:75)", "java.lang.reflect.Method.invoke(Method.java:601)" ], 
    "cause" : { 
    "message" : "only within, WITHINDISTANCE and bbox are implemented.", 
    "exception" : "UnsupportedOperationException", 
    "stacktrace" : [ "org.neo4j.gis.spatial.indexprovider.LayerNodeIndex.query(LayerNodeIndex.java:277)", "org.neo4j.cypher.internal.spi.gdsimpl.GDSBackedQueryContext$$anon$1.indexQuery(GDSBackedQueryContext.scala:83)", "org.neo4j.cypher.internal.executionplan.builders.IndexQueryBuilder$$anonfun$getNodeGetter$2.apply(IndexQueryBuilder.scala:83)", "org.neo4j.cypher.internal.executionplan.builders.IndexQueryBuilder$$anonfun$getNodeGetter$2.apply(IndexQueryBuilder.scala:81)", "org.neo4j.cypher.internal.pipes.StartPipe$$anonfun$internalCreateResults$1.apply(StartPipe.scala:36)", "org.neo4j.cypher.internal.pipes.StartPipe$$anonfun$internalCreateResults$1.apply(StartPipe.scala:35)", "scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371)", "org.neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply$mcZ$sp(ClosingIterator.scala:36)", "org.neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:35)", "org.neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:35)", "org.neo4j.cypher.internal.ClosingIterator.failIfThrows(ClosingIterator.scala:86)", "org.neo4j.cypher.internal.ClosingIterator.hasNext(ClosingIterator.scala:35)", "org.neo4j.cypher.PipeExecutionResult.hasNext(PipeExecutionResult.scala:142)", "scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)", "scala.collection.convert.Wrappers$IteratorWrapper.hasNext(Wrappers.scala:29)", "org.neo4j.helpers.collection.ExceptionHandlingIterable$1.hasNext(ExceptionHandlingIterable.java:58)", "org.neo4j.helpers.collection.IteratorWrapper.hasNext(IteratorWrapper.java:42)", "org.neo4j.server.rest.repr.ListRepresentation.serialize(ListRepresentation.java:58)", "org.neo4j.server.rest.repr.Serializer.serialize(Serializer.java:75)", "org.neo4j.server.rest.repr.MappingSerializer.putList(MappingSerializer.java:61)", "org.neo4j.server.rest.repr.CypherResultRepresentation.serialize(CypherResultRepresentation.java:57)", "org.neo4j.server.rest.repr.MappingRepresentation.serialize(MappingRepresentation.java:42)", "org.neo4j.server.rest.repr.OutputFormat.assemble(OutputFormat.java:179)", "org.neo4j.server.rest.repr.OutputFormat.formatRepresentation(OutputFormat.java:131)", "org.neo4j.server.rest.repr.OutputFormat.response(OutputFormat.java:117)", "org.neo4j.server.rest.repr.OutputFormat.ok(OutputFormat.java:55)", "org.neo4j.server.rest.web.CypherService.cypher(CypherService.java:75)", "java.lang.reflect.Method.invoke(Method.java:601)" ] 
    } 

얻을. 내가 여기서 뭔가 잘못하고있는거야?

감사합니다, 폴

  • neo4j 1.9.M05
  • 나머지 요청이 작동하지만, 사이퍼 것 jdk1.7.0_17
+0

대소 문자를'withinDistance'에서'WITHINDISTANCE'으로 변경하면 더 좋아집니다. – ulkas

+0

아니요, 소스 코드 (https://github.com/neo4j/spatial/blob/master/src/main/java/org/neo4j/gis/spatial/indexprovider/LayerNodeIndex.java), 라인에 오타가 있다고 생각합니다. 278에 "% s, % S 및 % s 만 구현되었습니다." – pauldzy

답변

0

0.11

  • 가 비슷한 문제가 있었다 공간 neo4j 하지 않았다. 해결책은 표준 방식으로 또 다른 "정상적인"노드 색인 (즉, 공간 색인이 아닌 lucene 색인)을 작성하여 공간 색인과 같은 이름으로 지정하는 것이 었습니다.

    yada이라는 공간 인덱스를 작성한 후 Cypher가 작동하도록하려면 here으로 기술 된 것을 수행하고 표준 neo4j 노드 인덱스를 만든 다음 노드를 추가하십시오.

    그러면 Cypher를 통해 withinDistance 쿼리를 수행 할 수 있습니다. 그렇다고해도 START n=node:yada('*:*') RETURN n;과 같은 표준 Cypher 쿼리를 사용하면 공간 쿼리를 수행 할 수 없습니다.

    Windows에서 Neo4j 1.9와 함께 사용되었습니다.

  • +0

    여전히 작동하지 않습니다. 레거시 인덱스가있는 다른 "일반"노드 인덱스를 사용할 때 neo4j 2.2.1을 사용합니다. – navins