Reputation: 394
I'm using the Javascript SDK from Parse.com, particularly the withinGeoBox
method and passing it the boundaries of a google maps viewport as coordinates.
But I get this response:
{
"code":102,
"error":"Geo box queries that cross the international date lines are not currently supported"
}
How can I get around this? Are there any other methods I can use to accomplish the same task?
Bounds I've tried:
neLatitude: 53.530072632824385,
neLongitude: -1.3375209042968663
swLatitude: 53.511957430628534,
swLongitude: -1.4611170957031163.
I've also tried bounds based in, New York, Califronia, Michigan etc. I get the same error.
Upvotes: 0
Views: 353
Reputation: 359966
From the Parse docs:
It's also possible to query for the set of objects that are contained within a particular area. To find the objects in a rectangular bounding box, add the
withinGeoBox
restriction to yourParse.Query
.var southwestOfSF = new Parse.GeoPoint(37.708813, -122.526398); var northeastOfSF = new Parse.GeoPoint(37.822802, -122.373962); var query = new Parse.Query(PizzaPlaceObject); query.withinGeoBox("location", southwestOfSF, northeastOfSF); query.find({ success: function(pizzaPlacesInSF) { ... } });
It sounds like you're passing the coordinates to Parse swapped. The API expects the points in (SW, NE) order, but I'm guessing that you're passing (NE, SW) instead.
One of the rectangles defined by those corners definitely does not cross the international date line:
but the other rectangle does:
Upvotes: 2