Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
02-07-2023 01:31 AM
Hello everyone , I am doing an college project on delivery service in a city, a one of my use case is to assign a nearest delivery agent for delivery using delivery agent coordinates and order coordinates. I want to implement the above case using neo4j. please help me with that.
02-07-2023 09:36 AM
if you have the coordinates of each delivery agent and order location, then you can calculate their 'point' value and then calculate the distance between each point. You can iterate over the agents and find the one with the smallest distance.
Here is an example of converting lat/long coordinates to a point type, then calculate the distance between two points.
with point({latitude: 12.78, longitude: 56.7}) as p1,
point({latitude: -5.248, longitude: 100.0}) as p2
return point.distance(p1,p2) as distance
https://neo4j.com/docs/cypher-manual/current/syntax/spatial/
All the sessions of the conference are now available online