javascript - Parse Javascript SDK 范围内的位置

标签 javascript parse-platform

我使用 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.

我还尝试过纽约、加利福尼亚、密歇根等地的边界。我得到了同样的错误。

最佳答案

来自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 your Parse.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 定义的矩形之一绝对不会跨越国际日期变更线:

enter image description here

但另一个矩形却是:

enter image description here

关于javascript - Parse Javascript SDK 范围内的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28921920/

相关文章:

javascript - 将窗口滚动到 contenteditable block 的当前行

javascript - 关闭模态不会清除文本区域数据,但会清除模型

javascript - Casperjs click() 没有正确触发点击事件

ios - 解析 iOS Swift 中的 SaveEventually 问题

ios - 解析.com : saveInBackgroundWithBlock - block not called

javascript - 如何在jsfiddle中创建面板?

javascript - 什么是 ECMAScript Editon 5.1,它有什么用?

swift - 解析推送通知注册 - 如果用户未登录则崩溃

ios - 两个类的 Swift 可选继承

push-notification - 通过 Parse.com 进行关系查询推送通知