Gmaps4rails: scaling (not zooming) a gmap

时光毁灭记忆、已成空白 提交于 2019-12-24 14:58:40

问题


I am using gmaps4rails and I have a set of dynamic generated markers, about 14, that I display across the globe. I use auto_adjust and it looks good, however, it seems that the size that I have chosen for the map fits perfectly between two zoom levels. It either shows too much of the map (e.g. you see asia on both sides) or if I zoom in one level, I don't see some markers. The css width and height we have chosen is what we want to fit in the window. Smaller or larger (to match the two zooming levels) wouldn't look as good. The goal being, a larger image, but staying at the same, fixed, zoom. Is there a way to scale the map, like you can with images?

I am using rails 2.3.11 and had to copy in the js/css assets and modify/override the gmaps4rails view. I am not using the gmapable module.


回答1:


I hope that somebody can prove me wrong, but it appears that you can not scale a map other than with zoom. The lowest zoom level, 0, appears to use up 256 pixels for the width of the globe (before it begins to overlap). Then if I zoom it out to 1, it doubles it to 512, then zooming to 2, it doubles again to 1024.

So my solution, to be able to see the entire globe but not have it overlap, is to either pick a size that is 512 or 1024 pixels wide and zoom to the appropriate level.



来源:https://stackoverflow.com/questions/8618124/gmaps4rails-scaling-not-zooming-a-gmap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!