Both junctions and streets have spatial attributes. Junctions have latitude and longitude properties and streets (relationships of the LINKED_TO type in our graph) have a geometry property containing the WKT representation of a LINESTRING object. We can create a spatial layer for each of these entities; however, remember that the GDS path finding algorithms work between nodes, not relationships. This means that, from the (latitude, longitude) user input, we will have to find the closest Junction node. So we need to create a spatial point layer to index our 4426 junctions. For now, there is no need to create a layer to hold the streets; we will create it later on if necessary.
Let's then create the point layer that will index the nodes with the Junction label:
CALL spatial.addPointLayer("junctions")
Now, add points to it:
MATCH (n:Junction)
CALL spatial.addNode("junctions", n) YIELD node
RETURN count(node)
After a...