我使用 Parse.com 的 Javascript SDK,特别是 withinGeoBox
方法,并将其作为坐标传递给 google map 视口(viewport)的边界。
但我得到了这样的回应:
{
"code":102,
"error":"Geo box queries that cross the international date lines are not currently supported"
}
我该如何解决这个问题?我可以使用其他方法来完成相同的任务吗?
我尝试过的界限:
neLatitude: 53.530072632824385,
neLongitude: -1.3375209042968663
swLatitude: 53.511957430628534,
swLongitude: -1.4611170957031163.
我还尝试过纽约、加利福尼亚、密歇根等地的边界。我得到了同样的错误。
最佳答案
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) { ... } });
听起来您正在将坐标传递给解析交换。 API 期望点按 (SW, NE) 顺序排列,但我猜您正在传递 (NE, SW)。
由这些 Angular 定义的矩形之一绝对不会跨越国际日期变更线:
但另一个矩形却是:
关于javascript - Parse Javascript SDK 范围内的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28921920/