带有自定义地图图像的Google Maps API v3-水平重复的标记 [英] Google Maps API v3 with custom map image - markers repeating horizontally
问题描述
我有与Google Maps API v3一起使用的自定义地图图像图块.当我在地图上放置标记时,标记会水平重复,就像地图也重复一样.以下是发生的情况的图像: http://puu.sh/vN7b
I have custom map image tiles in use with Google Maps API v3. When I place a marker on the map, the marker repeats horizontally as if the map repeated as well. Here is an image of what is happening: http://puu.sh/vN7b
如何解决?我不想限制地图范围来解决此问题.
How can this be fixed? I don't want to limit the map bounds to fix this.
推荐答案
两件事:
1/在功能convertCoords(nx,ny,map)中,您可以执行以下操作:
1/ In function convertCoords(nx,ny,map) you do:
x = (((nx + (6000 / 2)) / 6000) * cor1)
y = ((((ny * -1) + (6000 / 2)) / 6000) * cor2)
那不应该是这样的:
x = (((nx + (6000 / 2)) / 6000) * cor1.lat());
y = ((((ny * -1) + (6000 / 2)) / 6000) * cor2.lng())
在我的测试中,x和y分别为NaN
.
In my tests, as it is, x and y are NaN
.
2/您的地图处于缩放级别1.如果您不限制地图的边界,那不是预期的结果吗?
2/ Your map is at zoom level 1. Isn't that expected if you don't limit the bounds of the map?
这篇关于带有自定义地图图像的Google Maps API v3-水平重复的标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!