Geo near query getting more results than expected


(Charmaine) #1

Hello, I have a query for retrieving stations within 3 km of [1.33315262, 103.7423112]. The stations that appear are indeed those that are kinda nearby but when i checked some of them shouldn’t be in the result. e.g. Station A [1.314954492,103.7653168] appears even though it’s 3.26 km away. anyone knows why?

Station A in database:

{
		"postContent": "STATION A",
		"postLatitude": 1.314954492,
		"postLongitude": 103.7653168,
		"postGeolocation": "{'type':'Point','coordinates':[1.314954492,103.7653168]}",
}

Query:

{
  findNear(func: near(postGeolocation, [1.33315262,103.7423112], 3000), offset:0 ) {
    postContent
  }
}

I also noticed that the syntax (according to the docs) should be near(predicate, [long, lat], distance) instead of near(predicate, [lat, long], distance). I’m using [lat, long] in the query above because when I use [long, lat] the query returns me with no result regardless of what distance I put.