spatial.getFeatureCount
过程
返回图层中的要素数量
示例
统计不同图层类型中的要素数量
创建点图层
CALL spatial.addPointLayer('count_layer')
统计空图层中的要素数量
CALL spatial.getFeatureCount('count_layer') YIELD count
| count |
|---|
|
向图层添加一个节点
CREATE (n:Node {latitude: 60.1, longitude: 15.2, name: 'first'})
WITH n
CALL spatial.addNode('count_layer', n) YIELD node
RETURN node
添加一个要素后的统计
CALL spatial.getFeatureCount('count_layer') YIELD count
| count |
|---|
|
一次性添加多个节点
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
添加多个要素后的统计
CALL spatial.getFeatureCount('count_layer') YIELD count
| count |
|---|
|
创建 WKT 层
CALL spatial.addWKTLayer('wkt_layer', 'wkt')
统计空 WKT 图层中的要素数量
CALL spatial.getFeatureCount('wkt_layer') YIELD count
| count |
|---|
|
添加一个 WKT 点
CALL spatial.addWKT('wkt_layer', 'POINT(15.2 60.1)') YIELD node RETURN node
添加一个 WKT 线串
CALL spatial.addWKT('wkt_layer', 'LINESTRING (15.2 60.1, 15.3 60.1)') YIELD node RETURN node
统计 WKT 图层中的要素数量
CALL spatial.getFeatureCount('wkt_layer') YIELD count
| count |
|---|
|
获取图层中的要素数量
CALL spatial.addPointLayer('count_layer') YIELD node
| 节点 |
|---|
|
获取空图层的计数
CALL spatial.getFeatureCount('count_layer') YIELD count
| count |
|---|
|
向图层添加两个点
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
添加点后获取计数
CALL spatial.getFeatureCount('count_layer') YIELD count
| count |
|---|
|