Google 地图中的特定缩放
我有一个必须一点点放大的 Gmap。为了实现这一点,我需要将 Google 地图缩放级别的格式设置为“4.001”。我尝试通过简单地添加该值作为缩放级别来做到这一点,但它不起作用。
所以我的问题是如何使用小数点后面的多个数字来实现谷歌地图缩放级别。有可能吗?如果没有,如何实现缓慢精确的缩放?
谢谢
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?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以逐渐将地图画布从 1 级 CSS 缩放到 2 级,也许还可以用元素遮盖周围环境。
然后在一次调用中将 css-zoom 更改回 1,并将maps-zoom 减少 1。
您会看到街道、名称和线路在缩放过程中一起缩放,这是不需要的人工制品,但它看起来确实比地图缩放更平滑。
通过将地图缩放设置为 4 并将 CSS 缩放设置为 1.5 可以实现 4.5 的缩放。
如果您不喜欢低分辨率结果,您可以执行相反的操作:将 CSS 缩放设置为 0.5,将地图缩放设置为 5。两者在数据使用、像素密度、对象方面各有利弊。尺寸。
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.
在 Chrome 浏览器中,解决方法是在 GMaps + 和 - 之间交替缩放,并使用键盘上的“Ctrl -”和“Ctrl +”。后者的缩放是在 Chrome 中进行的。
在这两种方法之间,您可以获得更加自定义的缩放级别。来回切换的好处之一是您可以同时优化文本大小。
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.
根据文档,缩放级别对应于地球划分的图块数量:
将缩放级别增加 1 会使细节级别加倍。缩放级别是一个整数值。它对应于 Google 地图上滑块控件的离散值。
According to the documentation, the zoom level corresponds to the number of tiles in which the Earth is divided:
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.
当您想要 4 到 5 之间的缩放级别(例如 4.2 或 4.3)时,唯一的方法是使用聚类算法,因为地图被细分为 4。聚类意味着当图块非常靠近时,显示它们不再实用。例如,有一个标记管理器可以计算聚类,但它不适用于地图,因为按 6 或 7 个图块细分是没有意义的。
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.