spatial.decodeGeometry

函数

返回一个图层节点的几何对象,使用 Neo4j 几何类型,可用于传递给其他过程或返回给客户端

签名

spatial.decodeGeometry(layerName :: STRING, node :: NODE) :: ANY

输入参数

名称 类型 默认 描述

图层名称

STRING

null

图层的名称,用于选择适当的几何编码器以提取 Neo4j 几何对象。

节点

NODE

null

要从中提取 Neo4j 几何对象的已索引节点

示例

从节点属性解码几何对象

创建 WKT 层
CALL spatial.addWKTLayer('geom','geom')
表 1. 结果
节点
(:SpatialLayer {
    geomencoder: "WKTGeometryEncoder",
    geomencoder_config: "geom",
    index_type: "rtree",
    layer: "geom",
    layer_type: "EditableLayer"
})
解码几何对象
CREATE (n:Node {geom:'POINT(4.0 5.0)'}) RETURN spatial.decodeGeometry('geom',n) AS geometry
表 2. 结果
几何

point({x: 4.0, y: 5.0, crs: 'cartesian'})

同时使用两个函数

CALL spatial.addPointLayer('combined_layer') YIELD node
WITH node
CREATE (n:Point {longitude: 5.5, latitude: 45.5, city: 'TestCity', population: 50000})
WITH n
CALL spatial.addNode('combined_layer', n) YIELD node as added_node
WITH n
RETURN
	spatial.decodeGeometry('combined_layer', n) as geometry,
	spatial.extractAttributes('combined_layer', n) as attributes
表 3. 结果
属性 (attributes) 几何
{
  "city" : "TestCity",
  "population" : 50000
}

point({x: 5.5, y: 45.5, crs: 'cartesian'})

© . This site is unofficial and not affiliated with Neo4j, Inc.