spatial.removeLayer
Procedure
Removes the given layer. Deletes the nodes the layer created (e.g. by spatial.addWKT); nodes added with spatial.addNode are only removed from the index
Deleted and kept nodes
| Node | On spatial.removeLayer |
|---|---|
Created by the layer ( |
deleted, with its relationships |
Added with |
removed from the index; node, relationships and properties are kept |
A node labelled _SpatialManagedGeometry belongs to the layer that created it.
Don’t add it to other layers: removing its layer deletes it from all of them.
Nodes created by release 2026.10.0 or earlier
These nodes have no _SpatialManagedGeometry label, so spatial.removeLayer keeps them.
To delete them with the layer, label them first.
This example labels the nodes of an RTree layer that have no other labels and no relationships besides the index reference.
For a layer with a custom referenceRelationshipType, replace RTREE_REFERENCE with that type.
The query can’t tell layer-created nodes from your own nodes of the same shape: a node added with spatial.addNode that has no labels and no other relationships matches too, and spatial.removeLayer then deletes it.
Run it with RETURN g instead of SET first, and narrow the WHERE clause until it matches only the nodes the layer created.
|
MATCH (:SpatialLayer {layer: $name})-[:RTREE_ROOT]->()-[:RTREE_CHILD*0..]->()-[:RTREE_REFERENCE]->(g)
WHERE size(labels(g)) = 0 AND COUNT { (g)--() } = 1
SET g:_SpatialManagedGeometry
Examples
Add and Remove a layer
CALL spatial.addWKTLayer('geom','wkt')
| node |
|---|
|
CALL spatial.layers()
| name | signature |
|---|---|
geom |
EditableLayer(name='geom', encoder=WKTGeometryEncoder(geom='wkt', bbox='bbox')) |
CALL spatial.removeLayer('geom')
No results
CALL spatial.layers()
No results