# Add @distance for geo

**URL:** <https://discuss.dgraph.io/t/add-distance-for-geo/8406>\
**Category:** Dgraph\
**Tags:** dgraph, status:accepted, kind:feature, popular, area:querylang\
**Created:** [October 1, 2017, 11:00pm UTC](https://discuss.dgraph.io/t/add-distance-for-geo/8406 "2017-10-01T23:00:36Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![diggy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/diggy/32/3666_2.png) [@diggy](https://discuss.dgraph.io/u/diggy)\
**Post date:** [October 1, 2017, 11:00pm UTC](https://discuss.dgraph.io/t/add-distance-for-geo/8406/1 "2017-10-01T23:00:36Z")

</div>

**Moved from GitHub [dgraph/1559](https://github.com/dgraph-io/dgraph/issues/1559)**

_Posted by_ [davedbase](https://github.com/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!

---

<div class="post-metadata">

**Author:** ![diggy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/diggy/32/3666_2.png) [@diggy](https://discuss.dgraph.io/u/diggy)\
**Post date:** [October 20, 2017, 4:18am UTC](https://discuss.dgraph.io/t/add-distance-for-geo/8406/2 "2017-10-20T04:18:51Z")

</div>

[paul-ylz](https://github.com/paul-ylz) _commented_ :

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

---

<div class="post-metadata">

**Author:** ![diggy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/diggy/32/3666_2.png) [@diggy](https://discuss.dgraph.io/u/diggy)\
**Post date:** [March 17, 2019, 5:33am UTC](https://discuss.dgraph.io/t/add-distance-for-geo/8406/3 "2019-03-17T05:33:33Z")

</div>

[wildan2711](https://github.com/wildan2711) _commented_ :

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

---

<div class="post-metadata">

**Author:** ![diggy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/diggy/32/3666_2.png) [@diggy](https://discuss.dgraph.io/u/diggy)\
**Post date:** [July 4, 2020, 1:23pm UTC](https://discuss.dgraph.io/t/add-distance-for-geo/8406/4 "2020-07-04T13:23:13Z")

</div>

[wildroco](https://github.com/wildroco) _commented_ :

any updates here?

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

---

<div class="post-metadata">

**Author:** ![myo](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/myo/32/872_2.png) [@myo](https://discuss.dgraph.io/u/myo)\
**Post date:** [October 5, 2020, 5:25am UTC](https://discuss.dgraph.io/t/add-distance-for-geo/8406/5 "2020-10-05T05:25:38Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![pawan](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/pawan/32/1946_2.png) [@pawan](https://discuss.dgraph.io/u/pawan)\
**Post date:** [October 7, 2020, 5:49am UTC](https://discuss.dgraph.io/t/add-distance-for-geo/8406/6 "2020-10-07T05:49:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mika](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/mika/32/7462_2.png) [@mika](https://discuss.dgraph.io/u/mika)\
**Post date:** [March 31, 2021, 5:52pm UTC](https://discuss.dgraph.io/t/add-distance-for-geo/8406/7 "2021-03-31T17:52:14Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![chewxy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/chewxy/32/4339_2.png) [@chewxy](https://discuss.dgraph.io/u/chewxy)\
**Post date:** [April 1, 2021, 3:20am UTC](https://discuss.dgraph.io/t/add-distance-for-geo/8406/8 "2021-04-01T03:20:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sandeep\_Tyagi](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/sandeep_tyagi/32/8672_2.png) [@Sandeep\_Tyagi](https://discuss.dgraph.io/u/Sandeep_Tyagi)\
**Post date:** [September 20, 2022, 12:43pm UTC](https://discuss.dgraph.io/t/add-distance-for-geo/8406/9 "2022-09-20T12:43:17Z")

</div>

@chewxy Is this feature has been published

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [September 21, 2022, 2:15am UTC](https://discuss.dgraph.io/t/add-distance-for-geo/8406/10 "2022-09-21T02:15:04Z")

</div>

Chew is not around anymore. I have reopened it to track there in Github.
