With neo4j-spatial, we can get nodes within a certain distance from another node. The procedure to perform this operation is called spatial.withinDistance and its signature is the following:
spatial.withinDistance(layerName, coordinates, distanceInKm) => node, distance
This means it will search, within a given layer, all points that are less than distanceInKm away from coordinates. It returns those nodes and the computed distance between the returned node and coordinates.
The coordinates parameter can be an instance of a point or a map of latitude and longitude.
For instance, we can find the point of interest located less than 1 km away from Times Square with this query:
CALL spatial.withinDistance("ny_poi_point", {latitude: 40.757961, longitude: -73.985553}, 1)
YIELD node, distance
RETURN node.name, distance
ORDER BY distance
We could also look for the points of interest that are close to the Marquis Theater. In this...