我正在尝试使用 Google Maps API V3 制作一张不水平换行的地图。因此,我只想显示一次,而不是一次又一次地并排重复地图。我通过为 google.maps.ImageMapType 提供自定义 getTileUrl 函数来实现这一点
但是当我添加叠加层(如标记或多边形)时,它们仍然会水平重复。如何阻止叠加层水平重复?
Edit Here's an image demonstrating the problem:
我正在考虑以某种方式修改 google.maps.Projection.fromLatLngToPoint() 方法,但由于某种原因,大多数时候似乎不可用。
到目前为止,我已经找到了一种方法来做到这一点。解决方案并不在于修改投影,而是受到以下启发:关于限制 Google 地图中平移的问题 https://stackoverflow.com/q/3125065/242679.
它并不像我想要的那么干净,但它有效:
Instead of starting out (showing the complete map as one map tile) at zoom level 0, start out at a higher zoom level. In my case, I started out at level 3. This way, the "imaginary" whole world is bigger, moving the repeating overlays farther apart:
Limit the zoom level, so even own the lowest zoom level, the viewport doesn't contain two of the repeating overlays. This is done by setting the minZoom
option on the map to the desired level.
限制平移/拖动地图,这样您就无法移出所需区域。看我对限制平移问题的回答 https://stackoverflow.com/questions/3125065/how-do-i-limit-panning-in-google-maps-api-v3/7731442#7731442.
这样,重复的覆盖仍然存在,但您将永远无法看到它们,因为您无法到达它们
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)