问题
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