spatial.removeNode

Procedure

Removes the given node from the layer, returns the geometry-node

Signature

spatial.removeNode(layerName :: STRING, node :: NODE) :: (nodeId :: STRING)

Input parameters

Name Type Default Description

layerName

STRING

null

The name of the layer

node

NODE

null

The node to remove from the index

Output parameters

Name Type Description

nodeId

STRING

Examples

Create a point layer with X and Y properties

CALL spatial.addPointLayerXY('geom','lon','lat')

Add two nodes to the layer

CREATE (n1:Node {id: 1, lat:60.1,lon:15.2}),(n2:Node {id: 2, lat:60.1,lon:15.3}) WITH n1,n2 CALL spatial.addNodes('geom',[n1,n2]) YIELD count RETURN n1,n2,count
Table 1. Result
count n1 n2
2
(:Node {
    bbox: [15.2,60.1,15.2,60.1],
    gtype: 1,
    id: 1,
    lat: 60.1,
    lon: 15.2
})
(:Node {
    bbox: [15.3,60.1,15.3,60.1],
    gtype: 1,
    id: 2,
    lat: 60.1,
    lon: 15.3
})

Find nodes within distance

CALL spatial.withinDistance('geom',{lon:15.0,lat:60.0},100)
Table 2. Result
distance node
15.713441434310283
(:Node {
    bbox: [15.2,60.1,15.2,60.1],
    gtype: 1,
    id: 1,
    lat: 60.1,
    lon: 15.2
})
20.024944023694385
(:Node {
    bbox: [15.3,60.1,15.3,60.1],
    gtype: 1,
    id: 2,
    lat: 60.1,
    lon: 15.3
})

Remove node 1

MATCH (node) WHERE node.id = 1
CALL spatial.removeNode('geom', node) YIELD nodeId
RETURN nodeId
CALL spatial.withinDistance('geom',{lon:15.0,lat:60.0},100)
Table 3. Result
distance node
20.024944023694385
(:Node {
    bbox: [15.3,60.1,15.3,60.1],
    gtype: 1,
    id: 2,
    lat: 60.1,
    lon: 15.3
})

Remove node 2

MATCH (node) WHERE node.id = 2
CALL spatial.removeNode.byId('geom', elementId(node)) YIELD nodeId
RETURN nodeId
CALL spatial.withinDistance('geom',{lon:15.0,lat:60.0},100)
Result

No results