spatial.addNativePointLayerZOrder

Procedure

Adds a new native point layer with z-order curve based index, returns the layer root node

Signature

spatial.addNativePointLayerZOrder(name :: STRING, indexConfig =  :: ANY) :: (node :: NODE)

Input parameters

Name Type Default Description

name

STRING

null

The name of the layer

indexConfig

ANY

""

The configuration of the newly created index: a map by option name (see spatial.indexTypes.config) or a legacy string

Output parameters

Name Type Description

node

NODE

Examples

Create a layer to index a node

CALL spatial.addNativePointLayerZOrder('my-native-zorder-layer')
Table 1. Result
node
(:SpatialLayer {
    geomencoder: "NativePointEncoder",
    geomencoder_config.bboxProperty: "bbox",
    geomencoder_config.crs: "wgs84",
    geomencoder_config.locationProperty: "location",
    index_type: "zorder",
    layer: "my-native-zorder-layer",
    layer_type: "SimplePointLayer",
    layercrs: "GEOGCS[\"WGS84(DD)\", \n  DATUM[\"WGS84\", \n    SPHEROID[\"WGS84\", 6378137.0, 298.257223563]], \n  PRIMEM[\"Greenwich\", 0.0], \n  UNIT[\"degree\", 0.017453292519943295], \n  AXIS[\"Geodetic longitude\", EAST], \n  AXIS[\"Geodetic latitude\", NORTH], \n  AUTHORITY[\"EPSG\",\"4326\"]]"
})

Create a node to index

CREATE (n:Node {id: 42, latitude:60.1,longitude:15.2}) SET n.location=point(n) RETURN n

Index node

MATCH (n:Node) WITH n CALL spatial.addNode('my-native-zorder-layer',n) YIELD node RETURN node
Table 2. Result
node
(:Node:SpatialIndex_zorder_my-native-zorder-layer {
    _spatialindex_zorder_my-native-zorder-layer: 4771024,
    bbox: [ 15.2, 60.1, 15.2, 60.1 ],
    gtype: 1,
    id: 42,
    latitude: 60.1,
    location: point({x: 15.2, y: 60.1, crs: 'wgs-84'}),
    longitude: 15.2
})

Find node within distance

CALL spatial.withinDistance('my-native-zorder-layer',{lon:15.0,lat:60.0},100)
Table 3. Result
distance node
15.713441434310283
(:Node:SpatialIndex_zorder_my-native-zorder-layer {
    _spatialindex_zorder_my-native-zorder-layer: 4771024,
    bbox: [ 15.2, 60.1, 15.2, 60.1 ],
    gtype: 1,
    id: 42,
    latitude: 60.1,
    location: point({x: 15.2, y: 60.1, crs: 'wgs-84'}),
    longitude: 15.2
})