【问题标题】:google maps → fitBounds manually谷歌地图 → fitBounds 手动
【发布时间】:2012-01-15 07:28:27
【问题描述】:

我目前坚持使用谷歌地图 v3。 我尝试以这种方式手动添加边界,但它不起作用!?

map.fitBounds((53.399999, 9.73215099999993), (53.717145, 10.123491999999942));

【问题讨论】:

    标签: javascript google-maps google-maps-api-3


    【解决方案1】:

    fitBounds 需要一个 LatLngBounds 类型的对象,而该对象又被两个 LatLng 对象初始化。

    这应该可行:

    sw = new LatLng(53.399999, 9.73215099999993);
    ne = new LatLng(53.717145, 10.123491999999942);
    bounds = new LatLngBounds(sw, ne)
    
    map.fitBounds(bounds);
    

    参考:

    【讨论】:

      猜你喜欢
      • 2016-06-16
      • 2017-10-09
      • 2012-05-03
      • 2011-12-31
      • 2012-07-23
      • 1970-01-01
      • 2012-06-19
      • 2014-12-14
      • 2016-08-09
      相关资源
      最近更新 更多