本文介绍了在DistanceDistance内的Neo4j空间密码查询不返回现有节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Neo4j 2.0的空间服务器插件,并已按照 http://neo4j.github上的指南进行操作.io/spatial/添加名称为Stockholm的节点.

I am using the spatial server plugin for Neo4j 2.0 and have followed the guide at http://neo4j.github.io/spatial/ to add a node with name Stockholm.

:POST http://localhost:7475/db/data/ext/SpatialPlugin/graphdb/addSimplePointLayer
{
  "layer" : "geom",
  "lat" : "lat",
  "lon" : "lon"
}
:POST http://localhost:7475/db/data/index/node/
{
  "name" : "geom",
  "config" : {
    "provider" : "spatial",
    "geometry_type" : "point",
    "lat" : "lat",
    "lon" : "lon"
  }
}
:POST http://localhost:7475/db/data/node
{
  "lat" : 60.1,
  "lon" : 15.2,
  "name" : "Stockholm"
}
:POST http://localhost:7475/db/data/ext/SpatialPlugin/graphdb/addNodeToLayer
{
  "layer" : "geom",
  "node" : "http://localhost:7475/db/data/node/4"
}

我能够通过REST通过以下方式检索节点:

I am able to retrieve the node via REST with:

:POST http://localhost:7475/db/data/ext/SpatialPlugin/graphdb/findGeometriesWithinDistance
{
  "layer" : "geom",
  "pointX" : 15.0,
  "pointY" : 60.0,
  "distanceInKm" : 100
}

,但不包含下面的密码查询.这是为什么?我在这里犯任何明显的错误吗?

but not with the cypher query below. Why is that? Am I doing any obvious mistake here?

START n=node:geom('withinDistance:[60.0,15.0, 100.0]') RETURN n;

推荐答案

要使用Cypher进行查询,您需要将每个节点添加到索引中:

In order to query using Cypher you'll need to add each node to an index:

    :POST http://localhost:7474/db/data/index/node/geom
    {
      'value': 'dummy', 
      'key': 'dummy', 
      'uri': 'http://localhost:7474/db/data/node/NODE_ID_HERE'
    }

我最近写了一篇有关Neo4j Spatial入门的博客文章,内容涉及: http://lyonwj.com/mapping-the-worlds-airports-with-neo4j-spatial-and-openflights-part-1/

I wrote a blog post about getting starting with Neo4j Spatial recently that covers this: http://lyonwj.com/mapping-the-worlds-airports-with-neo4j-spatial-and-openflights-part-1/

这篇关于在DistanceDistance内的Neo4j空间密码查询不返回现有节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 11:59