Add @distance for geo

Moved from GitHub dgraph/1559

Posted by davedbase:

It would be really great if there was a function to call and return distance between points or polygons. ie. @distance(PointA, PointB). If it were to return the result in meters that could be really, really handy!


paul-ylz commented :

Agreed, this would be awesome to facilitate sorting geo queries by distance to a particular point.

wildan2711 commented :

Just came across the need for this feature, in tandem with the near query, that would be cool.

wildroco commented :

any updates here?

I want to sort nodes by distance from fixed location. Is it possible without distance function?

I’m also in the need for such a feature:

  • sorting by distance from a fix point
  • getting the distance of each matching node
  • using the distance with math functions to mix that value with other factors.

My use case is for matchmaking in a game: Players will be paired based on how close are the location, rank…

Thanks, folks for your feedback. This would be a new feature which would have to be implemented in DQL. We can look into as part of the roadmap for the next quarter. No ETA on when this would be available yet.


I really hope to see this feature soon, I had this feature with Neo4j, it’s very useful.
Do we have an ETA at this time ?

Thanks :slight_smile:

1 Like

@hardik can we put this in the list of feature requests