问题
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