距离内的 Neo4j 空间密码查询不返回现有节点

编程入门 行业动态 更新时间:2024-10-24 16:21:07
本文介绍了距离内的 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/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/mapping-the-worlds-airports-with-neo4j-spatial-and-openflights-part-1/

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

更多推荐

[db:关键词]

本文发布于:2023-03-30 10:49:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/777194.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:节点   距离   密码   空间   Neo4j

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!