Google Maps Polygon Incorrectly Rendered

2019-07-23 08:02发布

问题:

I am trying to draw a semi-circle in google maps using Geodesics Points between 2 latitude and longitudes.

I found a place that had exactly what I needed: http://maps.forum.nu/temp/gm_bearing.html

It was using the API V2 and I need the V3.

So I converted it.

The problem im having is that the semi-circle isnt being drawn correctly and i cant figure out why.

This is what happens when the semi-circle is drawn.

But when I zoom out or I make the semi-circle smaller it looks fine.

I have reproduced the issue in jsfiddle.

http://jsfiddle.net/Morlock0821/4dRB2/1/

Any help would be greatly appreciated.

Thanks.

回答1:

Remove these line in the drawCircle function:

var basePoints = calculateGeodesicPoints(circlePoints[circlePoints.length - 1], circlePoints[0]);
while (basePoints.length) {
  circlePoints.push(basePoints.shift());
}

http://googlemaps.googlermania.com/google_maps_api_v3/en/draw-semi-circle.html