Google maps - draw ellipse based off 4 coordinates

后端 未结 2 441
梦毁少年i
梦毁少年i 2021-01-17 03:20

I would like to draw an ellipse on google maps based off four coordinates, like the current \"rectangle\" method available via the API:

var rectangle = new          


        
2条回答
  •  春和景丽
    2021-01-17 03:47

    Not sure if this is what you're looking for, but here's a sample I made(click two points anywhere), it uses a function that takes two latLngs and returns a series of points that describe the ellipse, then adds those to a polygon.

    Note that it assumes that the bounding box is relatively small (and away from the poles) to take the points as coplanar.

提交回复
热议问题