spatial.addNode

过程

将给定节点添加到图层,返回几何节点

签名

spatial.addNode(layerName :: STRING, node :: NODE) :: (node :: NODE)

输入参数

名称 类型 默认 描述

图层名称

STRING

null

层的名称

节点

NODE

null

要添加到索引的节点

输出参数

名称 类型 描述

节点

NODE

示例

创建本地点层

CALL spatial.addNativePointLayerXY('geom','x','y')
表 1. 结果
节点
(:SpatialLayer {
    geomencoder: "SimplePointEncoder",
    geomencoder_config: "x:y",
    index_type: "rtree",
    layer: "geom",
    layer_type: "SimplePointLayer"
})

创建节点并将其添加到索引中

CREATE (n:Node {id: 42, x: 5.0, y: 4.0}) WITH n CALL spatial.addNode('geom',n) YIELD node RETURN node

在指定距离内查找节点

CALL spatial.withinDistance('geom',point({latitude:4.1,longitude:5.1}),100)
表 2. 结果
距离 节点
15.705713907526011
(:Node {
    bbox: [ 5.0, 4.0, 5.0, 4.0 ],
    gtype: 1,
    id: 42,
    x: 5.0,
    y: 4.0
})
© . This site is unofficial and not affiliated with Neo4j, Inc.