spatial.extractAttributes

函数

返回节点的属性

签名

spatial.extractAttributes(layerName :: STRING, node :: NODE) :: MAP

输入参数

名称 类型 默认 描述

图层名称

STRING

null

图层名称用于选择适当的几何编码器以提取属性。

节点

NODE

null

用于提取属性的已索引节点

示例

从 WKT 图层节点提取属性

CALL spatial.addLayer('wkt_attr_layer', 'WKT', '') YIELD node
WITH node
CREATE (n:Geometry {geometry: 'POINT (30 10)', name: 'test_wkt_point', category: 'marker', id: 42})
WITH n
CALL spatial.addNode('wkt_attr_layer', n) YIELD node as added_node
WITH n
RETURN spatial.extractAttributes('wkt_attr_layer', n) as attributes
表 1. 结果
属性 (attributes)
{
  "category" : "marker",
  "id" : 42,
  "name" : "test_wkt_point"
}

从图层节点提取属性

CALL spatial.addPointLayer('attr_layer') YIELD node
WITH node
CREATE (n:Point {longitude: 10.0, latitude: 20.0, name: 'test_point', type: 'landmark', elevation: 100})
WITH n
CALL spatial.addNode('attr_layer', n) YIELD node as added_node
WITH n
RETURN spatial.extractAttributes('attr_layer', n) as attributes
表 2. 结果
属性 (attributes)
{
  "elevation" : 100,
  "name" : "test_point",
  "type" : "landmark"
}

一起使用这两个函数

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.