ThinkGeo.com    |     Documentation    |     Premium Support

Draw circle around a Polygon

Hi All,


i have a district boundary shape having different shapes. 


i have a bit difficult Requirement.


My requirement is to draw tha Circle around the Polygon which touches the boundary points of the Plolygon.


then i need to identify the center point of the circle, and need to draw the horizontal and vertical line from the MidPoint with 90 degree angle.


after that i need to draw the 2 or 3 concentric circles with different radius considering the Mid point of the main Circle as center.


the out put should like in the attached document.



Let us take Blue polygon is shape in shape file or user created shape on the map. 


whenever he clicks any button then i need to generate the main circle around the polygon, Mid point, two straight lines and concentric circles in the Main circle.


how to acieve the above criteria does mapsuite provides this type of Functionality?


Thanking you.


waiting for reply.


 


 


 


 



Mahender,


 Thanks for your post!
 
For most polygons, there is no circum circle which rounds the Polygon and touches every boundary points. There is one for every triangle but we cannot make sure there is one for every Polygon. For example, we can hardly find the circum circle for the following 2 polygons.

 



Then what is the “main circle” you want in your scenario, here is one option that we get the center point of polygon’s boundingBox, make that point the center point of the circle, measure the distance between the center and polygon’s every vertex and take the longest distance as the radius. That circle is not very large and 100% includes the original polygon.


 


Or is there some other ideas about creating that “main circle”, it’s great if you can provide a graph, like what’s in your last message.

Thanks,


Ben



Thank you ben,


what you said is correct we can't touch all the boundary points of the Polygon.


But if you provide any example or sample then it helps me alot.


Thanking you.



Mahender,


So I think what you want is the minimal enclosing circle, that is to say, given a set S of n points in the plane, find the circle C of smallest radius with the property that all points in S are contained in C or its boundary. Here has one algorithm for that, please have a look if you are interested.


cs.mcgill.ca/~cs507/proj...oblem.html


It's an interesting requirement and we will work on it when we have time, maybe not very soon though, thanks for the insights. 


Ben