Shawn
Posts: 0
Joined: Sat Jun 21, 2014 11:13 pm

NearSphere Query giving error for certain geo points

Hi

I do the following call and correctly get all items near London

{ "addressgeo" : { "$nearSphere" : [51.5072, 0.1275 ], "$maxDistanceInMiles" : 20 } }

Note : London Lat & Long is [ 51.5072, 0.1275 ]

When I do the same call for items around Adelaide

{ "addressgeo" : { "$nearSphere" : [-34.928,138.5999594], "$maxDistanceInMiles" : 20 } }

I get the following error

{
"status":"400 Bad Request",
"url":"https://api.appery.io/rest/1/db/colle...",
"response":{
"code":"DBSQ264",
"description":"Mongo error: error code is '17444'"
}
}

Note : Adelaide Lat & Long is [ -34.928, 138.5999594]

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

NearSphere Query giving error for certain geo points

Hello Shawn,

Could you please swap lat and long
pre{ "addressgeo" : { "$nearSphere" : [138.5999594, -34.928], "$maxDistanceInMiles" : 20 } }/pre

Shawn
Posts: 0
Joined: Sat Jun 21, 2014 11:13 pm

NearSphere Query giving error for certain geo points

Oops that's very embarrassing I've been storing [ lat,long] into the DB hence the queries were failing. Thanks Evgene.

Return to “Issues”