首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >google maps→fitBounds手动

google maps→fitBounds手动
EN

Stack Overflow用户
提问于 2011-12-08 03:22:15
回答 1查看 921关注 0票数 1

我现在被谷歌地图v3卡住了。我尝试用这种方式手动添加边界,但它不起作用!?

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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-12-08 03:27:23

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

这应该是可行的:

代码语言:javascript
复制
sw = new LatLng(53.399999, 9.73215099999993);
ne = new LatLng(53.717145, 10.123491999999942);
bounds = new LatLngBounds(sw, ne)

map.fitBounds(bounds);

参考资料:

  • V3 API Reference on LatLng
  • V3 API Reference on LatLngBounds
  • V3 API Reference on fitBounds()
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8421196

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档