Specific zoom in Google Maps
I have a Gmap that has to zoom in bit by bit. To achieve this I need the Google map zoom level to be formatted like this '4.001'. I tried doing this by simply add this value as zoom level but it doesn't work.
So my question is how to achieve a Google map zoom level using multiple numbers behind the decimal. Is it even possible? If not, how do I achieve the slowly precise zooming?
Thank开发者_C百科s
According to the documentation, the zoom level corresponds to the number of tiles in which the Earth is divided:
zoom = 1 => tiles = 2^1 * 2^1 = 2 * 2 = 4
zoom = 2 => tiles = 2^2 * 2^2 = 4 * 4 = 16
zoom = 3 => tiles = 2^3 * 2^3 = 8 * 8 = 64
etc
Increasing the zoom level by 1 doubles the level of detail. The zoom level is an integer value. It corresponds to the discrete value of the slider control on Google maps.
When you want a zoom level between 4 and 5 for example 4.2 or 4.3 the only way is to use a cluster algorithm because the map is subdivide by 4. Cluster means that when the tiles are so close together that's not anymore practical to show them. There is a for example marker manager that can calculate clusters but it's not applicable to the map because it doesn't make sense to subdivide by 6 or 7 tiles.
You can gradually CSS-zoom the map canvas from 1 to 2, perhaps also masking the surroundings with elements. Then in one call change the css-zoom back to 1 and decrease the maps-zoom by one. You will see that streets, names and lines zoom along during the zoom, which is an unwanted artefact, but it sure looks smoother than the maps' zoom.
A zoom of 4.5 could be achieved by setting the maps zoom to 4 and the CSS-zoom to 1.5.
If you don't like the lo-res result you could do the opposite: set the CSS-zoom to 0.5 and the maps-zoom to 5. Both wil have their pros and cons in terms of data-usage, pixel density, object sizes.
In the Chrome browser, a workaround is to alternate zooming between the GMaps + and - and using "Ctrl -" and "Ctrl +" on your keyboard. This latter zoom is within Chrome. Between the two methods you can get a more customized zoom level. One benefit from going back and forth is that you can optimize text size at the same time.
精彩评论