spatial.extractAttributes

Function

Returns attributes of the node

Signature

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

Input parameters

Name Type Default Description

layerName

STRING

null

The name of the layer is used to select the appropriate geometry encoder for extracting attributes.

node

NODE

null

An indexed node to extract the Attributes from

Examples

Extracts attributes from a WKT layer node

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
Table 1. Result
attributes
{
  "name" : "test_wkt_point",
  "category" : "marker",
  "id" : 42
}

Extracts attributes from a layer node

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
Table 2. Result
attributes
{
  "name" : "test_point",
  "elevation" : 100,
  "type" : "landmark"
}

Using both functions together

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
Table 3. Result
attributes geometry
{
  "city" : "TestCity",
  "population" : 50000
}

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