Google静态地图API如何指定最大缩放级别
我们有一份报告显示 2 个标记在地图上的位置,效果很好,除非标记彼此相邻时它会放大到最高级别的缩放。
我们希望打开最小缩放,但将最大缩放设置为某个级别。我浏览了 Google 静态地图文档,但看不到该做什么它。
有谁知道使用静态地图 API 是否可以实现这一点?
干杯。
We have a report that shows where 2 markers are on a map, works great except when the markers are next to each other it zooms in to the highest level of zoom.
We want the min zoom to be open, but set the max zoom to a certain level. I have looked through the Google Static Map documentation, and cant see where to do it.
Does anyone know if this is possible using the static map api?
Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
谷歌没有这个功能。这是一个功能请求:
Issue 3909
http://code.google.com/p/gmaps -api-issues/issues/detail?id=3909
请投票!
Google does not have that feature in place. Here is a feature request:
Issue 3909
http://code.google.com/p/gmaps-api-issues/issues/detail?id=3909
Please vote!
嗯,用静态地图来获取它有点不简单。您可以省略指定缩放并希望谷歌会选择它认为最好的。
无论如何,这就是我摆脱它的方法。我有自己的放大/缩小按钮显示在地图图像旁边。单击后,我会增加或减少当前缩放值并重新加载地图图像。
我知道这并不漂亮,但它可以完成工作。
Well it is sort of not straight forward to get it with static maps. You can omit specifying the zoom and hope google will choose what it thinks best.
Anyway this is how I got rid of it. I had my own zoom up / zoom down buttons to show up next to the map image. Upon click, I increase or decrease the current zoom value and reload the map image.
I know it's not pretty, but it gets the job done.
http://maps.google.com/staticmap?markers=-21.7164,35.4384&size=640x640&key=your-api-key&format=png8&maptype=roadY&zoom=8
注意缩放查询字符串参数
http://maps.google.com/staticmap?markers=-21.7164,35.4384&size=640x640&key=your-api-key&format=png8&maptype=roadY&zoom=8
Note the zoom querystring parameter
我还没有尝试过静态地图,但它在法线地图中对我有用:
这里我限制最大和最小缩放。
希望对
K有帮助
I have not tried that for static maps but it works for me in normal map:
Here I am limiting both max and min zoom.
Hope it helps
K
我从这个网址找到了以下代码:
http://code.google.com/apis/maps/documentation/javascript /events.html
google.maps.event.addListener(marker, 'click', function() {
地图.setZoom(8);
});
您可以执行 document.onload(function() { 而不是添加侦听器
地图.setZoom(8));
I found the following code from this URL:
http://code.google.com/apis/maps/documentation/javascript/events.html
google.maps.event.addListener(marker, 'click', function() {
map.setZoom(8);
});
Instead of adding listener, you could do document.onload(function() {
map.setZoom(8));