问题
I'm trying to make a map that doesn't wrap horizontally, using the Google Maps API V3. So instead repeating the map side-by-side again and again, I want to show it only once. I got that to work by providing a custom getTileUrl function for google.maps.ImageMapType
But when I add overlays (like markers or polygons), those still are repeated horizontally. How can I stop the overlays from being repeated horizontally?
Edit Here's an image demonstrating the problem:
I was thinking of somehow modifying the google.maps.Projection.fromLatLngToPoint() method, but for some reason that doesn't seem to be available most of the time.
回答1:
By now I have figured out a way to do it. The solution did not lie with a modified projection, but instead was inspired by this question about limiting panning in Google Maps.
It's not really as clean as I'd like, but it works:
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
minZoomoption on the map to the desired level.
Limit panning/dragging the map, so you can't move out of the desired area. See my answer on the limit panning question.
This way, the repeating overlays are still there, but you will never be able to see them, since you can't reach them
来源:https://stackoverflow.com/questions/7718664/prevent-horizontal-world-wrapping-of-overlays-in-gmap-v3

