【问题标题】:Checking if a Location is on a Bing Map检查位置是否在 Bing 地图上
【发布时间】:2013-02-06 08:02:09
【问题描述】:

我们想检查一个位置是否在可见的 Bing 地图上,但我们目前的努力告诉我们所有位置都在地图上。

初始化地图后,我们使用 Map 'getBounds' 方法返回当前地图的 LocationRect:

var mapRect = MAP.getBounds();

然后我们使用地图中的值初始化一个位置矩形:

var rect = new Microsoft.Maps.LocationRect(mapRect);

然后使用LocationRect方法'contains'进行检查:

alert ("结果:" + rect.contains(new Microsoft.Maps.Location(38.0, 5.0)));

我猜这是因为我们用错误的值初始化矩形,我们将不胜感激提供一些关于我们做错了什么的线索。

【问题讨论】:

    标签: bing-maps


    【解决方案1】:

    我对文档的误解。 LocationRect 应该用

    调用

    var rect = new Microsoft.Maps.LocationRect(mapRect.location, mapRect.height, mapRect.width);

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多