spatial.updateWKT

Procedure

Updates a node with the geometry defined by the given WKT, returns the node

Signature

spatial.updateWKT(layerName :: STRING, node :: NODE, geometry :: STRING) :: (node :: NODE)

Input parameters

Name Type Default Description

layerName

STRING

null

The name of the layer

node

NODE

null

The indexed node to update

geometry

STRING

null

The WKT to set on the given node

Output parameters

Name Type Description

node

NODE

Examples

Update a node’s WKT geometry

CALL spatial.addWKTLayer('update_layer', 'wkt') YIELD node
Table 1. Result
node
(:SpatialLayer {
    geomencoder: "org.neo4j.gis.spatial.WKTGeometryEncoder",
    geomencoder_config: "wkt",
    index_class: "org.neo4j.gis.spatial.index.LayerRTreeIndex",
    layer: "update_layer",
    layer_class: "org.neo4j.gis.spatial.EditableLayerImpl"
})

Create and add a node with initial WKT

CREATE (n:Node {wkt: 'POINT(15.2 60.1)', name: 'updatable_point'})
WITH n
CALL spatial.addNode('update_layer', n) YIELD node as added_node
RETURN n, added_node

Update the node’s WKT geometry

MATCH (n:Node {name: 'updatable_point'})
CALL spatial.updateWKT('update_layer', n, 'POINT(25.5 65.5)') YIELD node
RETURN node.wkt as wkt
Table 2. Result
wkt

POINT (25.5 65.5)

Verify the updated geometry is indexed correctly

CALL spatial.withinDistance('update_layer', {longitude: 25.5, latitude: 65.5}, 1) YIELD node
RETURN node.name as name
Table 3. Result
name

updatable_point