Google Maps API v3 - circle sector

2019-09-23 00:39发布

问题:

I would like to draw sector of circle on map defined by point, radius, startAngle and stopAngle. I found lots of exmaples but with polygons etc whitch was too complicated for my case.

Thanks for any help!

回答1:

a Circle is an object with no defined sides. Only a radius and a center point. You are required to use a polygon to build a semi circle as it is a two sied object

There is not always an easy way out in coding, and typicaly they are the bad ways to do things (unless your talking about somthing like JQ/Bootstrap)

Here is a fairly stright forware implementation

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

This was refered in this question Google Maps Polygon Incorrectly Rendered

they even provide a working example for you to rip apart http://maps.forum.nu/temp/gm_bearing.html