Once the spatial layer is created, we can add data to it, which will also update the spatial index. The following query adds all nodes with the POI label to the newly created spatial layer with the name 'pointLayer':
MATCH (n:POI)
CALL spatial.addNode('pointLayer', n) YIELD node
RETURN count(node)
This operation adds two more properties to the node:
- A point attribute, similar to the built-in Neo4j type
- A bbox attribute used for querying the data with a spatial index, as discussed earlier in this chapter
We will see how to use this data in the following sections. Before that, we are going to deal with other types of geometries, so as to take full advantage of neo4j-spatial compared to built-in Neo4j types.