spatial.getFeatureCount
Procedure
Returns the number of features in the layer
Examples
Count features in different layer types
Create a point layer
CALL spatial.addPointLayer('count_layer')
Count features in empty layer
CALL spatial.getFeatureCount('count_layer') YIELD count
count |
---|
|
Add one node to the layer
CREATE (n:Node {latitude: 60.1, longitude: 15.2, name: 'first'})
WITH n
CALL spatial.addNode('count_layer', n) YIELD node
RETURN node
Count after adding one feature
CALL spatial.getFeatureCount('count_layer') YIELD count
count |
---|
|
Add multiple nodes at once
UNWIND range(1,3) as i
CREATE (n:Node {id: i, latitude: (60.0 + i * 0.1), longitude: (15.0 + i * 0.1)})
WITH collect(n) as nodes
CALL spatial.addNodes('count_layer', nodes) YIELD count
RETURN count
Count after adding multiple features
CALL spatial.getFeatureCount('count_layer') YIELD count
count |
---|
|
Create a WKT layer
CALL spatial.addWKTLayer('wkt_layer', 'wkt')
Count features in empty WKT layer
CALL spatial.getFeatureCount('wkt_layer') YIELD count
count |
---|
|
Add a WKT point
CALL spatial.addWKT('wkt_layer', 'POINT(15.2 60.1)') YIELD node RETURN node
Add a WKT linestring
CALL spatial.addWKT('wkt_layer', 'LINESTRING (15.2 60.1, 15.3 60.1)') YIELD node RETURN node
Count features in WKT layer
CALL spatial.getFeatureCount('wkt_layer') YIELD count
count |
---|
|
Get the number of features in a layer
CALL spatial.addPointLayer('count_layer') YIELD node
node |
---|
|
Get count of empty layer
CALL spatial.getFeatureCount('count_layer') YIELD count
count |
---|
|
Add two points to the layer
CREATE (n1:Point {latitude: 60.1, longitude: 15.2, name: 'point1'})
CREATE (n2:Point {latitude: 60.3, longitude: 15.5, name: 'point2'})
WITH n1, n2
CALL spatial.addNode('count_layer', n1) YIELD node as added1
WITH n2, added1
CALL spatial.addNode('count_layer', n2) YIELD node as added2
RETURN added1, added2
Get count after adding points
CALL spatial.getFeatureCount('count_layer') YIELD count
count |
---|
|