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!

2 Likes

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.

1 Like