Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

When creating a polygon using the Google Maps API v3, how can I prevent the polygon from snapping to other 'maps'?

So instead of: enter image description here

I would like to make the polygon close like this: enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
478 views
Welcome To Ask or Share your Answers For Others

1 Answer

The issue occurs when the difference between the longitudes of 2 consecutive points in the path is >=180

the longitudes of the first 2 points are -97 and 93, so that's the problem in this case(difference is 190)

The only thing I may suggest so far is to split this portion of the path:

new google.maps.LatLng(81, -97),
//additional point
new google.maps.LatLng(80.5, -12),
new google.maps.LatLng(80, 93),
new google.maps.LatLng(56, 78),
new google.maps.LatLng(60, -94)

Demo: http://jsfiddle.net/doktormolle/39CtV/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...