【问题标题】:Getting the bounds of the map in mapkit.js在 mapkit.js 中获取地图的边界
【发布时间】:2021-04-02 03:26:29
【问题描述】:

我不知道如何获取我的 mapkit.js 地图的边界,例如 google.maps 上的 map.getBounds() 使用 map.center,我得到了中心的 lat,lng。 还有一个 visibleMapRect 返回以下内容:

origin: g
x: 0.5644154498027297
y: 0.38366011721614135
size: _
height: 0.0038494348475155986
width: 0.0027777777777778763

但我不确定它是否相关 我必须自己计算吗? 有没有办法获取我地图的 4 个角?

【问题讨论】:

    标签: mapkit apple-maps


    【解决方案1】:

    终于明白了

    const bounds = map.region.toBoundingRegion();
    

    返回类似:

    {northLatitude: 38.49474438696218, eastLongitude: 24.190793833126634, southLatitude: 37.41403138384996, westLongitude: 23.190793833126634}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-08-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多