Google Maps API v3 with custom map image - markers repeating horizontally [closed]

佐手、 提交于 2019-12-23 05:19:28

问题


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:


Two things:

1/ In function convertCoords(nx,ny,map) you do:

x = (((nx + (6000 / 2)) / 6000) * cor1)
y = ((((ny * -1) + (6000 / 2)) / 6000) * cor2)

Shouldn't that be something like:

x = (((nx + (6000 / 2)) / 6000) * cor1.lat());
y = ((((ny * -1) + (6000 / 2)) / 6000) * cor2.lng())

In my tests, as it is, x and y are NaN.

2/ Your map is at zoom level 1. Isn't that expected if you don't limit the bounds of the map?



来源:https://stackoverflow.com/questions/10675268/google-maps-api-v3-with-custom-map-image-markers-repeating-horizontally

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!