Reputation: 39
Is there a way to take a polygon drawn on Google Map and create a circle that would perfectly encompass the polygon? We have users drawing a polygon on a map for a particular purpose, but we also need to describe the area they selected as a circle (Lat/Lon centre point and radius). It's for a really low resolution representation of their selection but it must be a circle. Please see the illustration I've drawn:
Circle computed to fit around polygon
I've Googled and read for hours without luck. Someone must have done this before and written a library or code snippet. Thanks in advance if anyone can share or help please?
Upvotes: 3
Views: 1881
Reputation: 80187
You probably need a Smallest Enclosing Circle for polygon vertices. Miniball
link at wiki page provides C++ and Java code for this problem.
Upvotes: 2