# How to compute the radius of a circle

**URL:** <https://community.thinkgeo.com/t/how-to-compute-the-radius-of-a-circle/2897>\
**Category:** WPF\
**Created:** [December 14, 2010, 7:35am UTC](https://community.thinkgeo.com/t/how-to-compute-the-radius-of-a-circle/2897 "2010-12-14T07:35:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![franklin1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/f/e9a140/32.png) [@franklin1](https://community.thinkgeo.com/u/franklin1)\
**Post date:** [December 14, 2010, 7:35am UTC](https://community.thinkgeo.com/t/how-to-compute-the-radius-of-a-circle/2897/1 "2010-12-14T07:35:33Z")

</div>

Hi&nbsp;Tsui,

I&nbsp;construct&nbsp;a&nbsp;circle&nbsp;shape&nbsp;based&nbsp;on&nbsp;Polygon&nbsp;outring&nbsp;vertices.&nbsp;Then&nbsp;I&nbsp;need&nbsp;to&nbsp;find&nbsp;the&nbsp;radius&nbsp;of&nbsp;such&nbsp;a&nbsp;circle.&nbsp;I&nbsp;am&nbsp;not&nbsp;sure&nbsp;whether&nbsp;polygon.OutRing.GetDistanceTo&nbsp;method&nbsp;or&nbsp;other&nbsp;API&nbsp;method&nbsp;can&nbsp;be&nbsp;used&nbsp;to&nbsp;achieve&nbsp;this&nbsp;purpose.  
  
&nbsp;Could&nbsp;you&nbsp;shed&nbsp;light&nbsp;on&nbsp;this?&nbsp;Thanks&nbsp;a&nbsp;lot.

Regards,

Franklin

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [December 14, 2010, 8:06am UTC](https://community.thinkgeo.com/t/how-to-compute-the-radius-of-a-circle/2897/2 "2010-12-14T08:06:33Z")

</div>

Franklin,

Thanks&nbsp;for&nbsp;your&nbsp;post;&nbsp;I&nbsp;just&nbsp;copied&nbsp;my&nbsp;feedback&nbsp;from&nbsp;the&nbsp;other&nbsp;thread&nbsp;here&nbsp;for&nbsp;this&nbsp;should&nbsp;be&nbsp;the&nbsp;place&nbsp;to&nbsp;answer.  
&nbsp;  
Could&nbsp;you&nbsp;let&nbsp;me&nbsp;know&nbsp;how&nbsp;you&nbsp;construct&nbsp;a&nbsp;circle&nbsp;shape&nbsp;from&nbsp;a&nbsp;polygon&nbsp;shape?&nbsp;As&nbsp;I&nbsp;understand,&nbsp;when&nbsp;you&nbsp;construct&nbsp;it,&nbsp;the&nbsp;radius&nbsp;should&nbsp;be&nbsp;known,&nbsp;maybe&nbsp;I&nbsp;misunderstood&nbsp;something&nbsp;here.  
&nbsp;  
Any&nbsp;all,&nbsp;following&nbsp;code&nbsp;snippet&nbsp;should&nbsp;get&nbsp;the&nbsp;radius&nbsp;for&nbsp;a&nbsp;circle,&nbsp;of&nbsp;course,&nbsp;you&nbsp;can&nbsp;use&nbsp;the&nbsp;Height&nbsp;instead&nbsp;of&nbsp;Width,&nbsp;and&nbsp;they&nbsp;should&nbsp;be&nbsp;exactly&nbsp;the&nbsp;same&nbsp;for&nbsp;circle.  
&nbsp;  
`EllipseShape circle;double radius = circle.GetBoundingBox().Width / 2;`  
&nbsp;  
Any&nbsp;more&nbsp;questions&nbsp;or&nbsp;concerns&nbsp;please&nbsp;do&nbsp;not&nbsp;hesitate&nbsp;to&nbsp;let&nbsp;me&nbsp;know.  
&nbsp;  
Thanks.  
&nbsp;  
Yale

---

<div class="post-metadata">

**Author:** ![franklin1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/f/e9a140/32.png) [@franklin1](https://community.thinkgeo.com/u/franklin1)\
**Post date:** [December 14, 2010, 7:57pm UTC](https://community.thinkgeo.com/t/how-to-compute-the-radius-of-a-circle/2897/3 "2010-12-14T19:57:47Z")

</div>

Hi&nbsp;Yale,&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;What&nbsp;will&nbsp;be&nbsp;the&nbsp;unit&nbsp;for&nbsp;the&nbsp;radius&nbsp;thus&nbsp;calculated?&nbsp;In&nbsp;my&nbsp;case,&nbsp;the&nbsp;circle&nbsp;is&nbsp;generated&nbsp;by&nbsp;a&nbsp;polygon.outring.vertices&nbsp;with&nbsp;equal&nbsp;polygon&nbsp;edge&nbsp;length.&nbsp;When&nbsp;the&nbsp;polygon&nbsp;vertices&nbsp;have&nbsp;sufficient&nbsp;quantity,&nbsp;the&nbsp;shape&nbsp;is&nbsp;a&nbsp;circle.&nbsp;So&nbsp;I&nbsp;guess&nbsp;probably&nbsp;the&nbsp;Poly.OutRing.GetBoundingBox.Width&nbsp;may&nbsp;serve&nbsp;the&nbsp;purpose.&nbsp;  
&nbsp;However,&nbsp;the&nbsp;radius&nbsp;thus&nbsp;calculated&nbsp;is&nbsp;very&nbsp;small:&nbsp;0.0166&nbsp;(km?)&nbsp;.&nbsp;Something&nbsp;is&nbsp;wrong.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Franklin&nbsp;  
&nbsp;&nbsp;

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [December 14, 2010, 8:52pm UTC](https://community.thinkgeo.com/t/how-to-compute-the-radius-of-a-circle/2897/4 "2010-12-14T20:52:02Z")

</div>

&nbsp;Hi&nbsp;Franklin,

&nbsp;

I&nbsp;guess&nbsp;you&nbsp;are&nbsp;using&nbsp;decimal&nbsp;degree&nbsp;as&nbsp;the&nbsp;unit&nbsp;of&nbsp;the&nbsp;map,&nbsp;right?&nbsp;If&nbsp;that&nbsp;is&nbsp;the&nbsp;case,&nbsp;then&nbsp;the&nbsp;number&nbsp;0.0166&nbsp;you&nbsp;got&nbsp;is&nbsp;in&nbsp;lon/lat&nbsp;unit&nbsp;too.&nbsp;Its&nbsp;actual&nbsp;length&nbsp;could&nbsp;be&nbsp;up&nbsp;to&nbsp;1.85&nbsp;kilometers&nbsp;(if&nbsp;it’s&nbsp;on&nbsp;the&nbsp;equator).

&nbsp;

Here&nbsp;is&nbsp;some&nbsp;code&nbsp;that&nbsp;may&nbsp;help&nbsp;you&nbsp;to&nbsp;calculate&nbsp;the&nbsp;transverse&nbsp;radius:

RectangleShape&nbsp;boundingBoxOfCircle&nbsp;=&nbsp;circle.GetBoundingBox();

&nbsp;

double&nbsp;y&nbsp;=&nbsp;(boundingBoxOfCircle.UpperLeftPoint.Y&nbsp;+&nbsp;boundingBoxOfCircle.LowerLeftPoint.Y)&nbsp;/&nbsp;2;

double&nbsp;minX&nbsp;=&nbsp;boundingBoxOfCircle.LowerLeftPoint.X;

double&nbsp;maxX&nbsp;=&nbsp;boundingBoxOfCircle.LowerRightPoint.X;

&nbsp;

PointShape&nbsp;point1&nbsp;=&nbsp;new&nbsp;PointShape(minX,&nbsp;y);

PointShape&nbsp;point2&nbsp;=&nbsp;new&nbsp;PointShape(maxX,&nbsp;y);

&nbsp;

double&nbsp;length&nbsp;=&nbsp;DecimalDegreesHelper.GetDistanceFromDecimalDegrees(point1,&nbsp;point2,&nbsp;DistanceUnit.Kilometer);

double&nbsp;radius&nbsp;=&nbsp;length&nbsp;/&nbsp;2;

&nbsp;

Regards,

Tsui

---

<div class="post-metadata">

**Author:** ![franklin1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/f/e9a140/32.png) [@franklin1](https://community.thinkgeo.com/u/franklin1)\
**Post date:** [December 14, 2010, 9:54pm UTC](https://community.thinkgeo.com/t/how-to-compute-the-radius-of-a-circle/2897/5 "2010-12-14T21:54:25Z")

</div>

Hi&nbsp;Tsui,&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;method&nbsp;works&nbsp;fine.&nbsp;Thanks&nbsp;very&nbsp;much.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Franklin

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [December 14, 2010, 10:55pm UTC](https://community.thinkgeo.com/t/how-to-compute-the-radius-of-a-circle/2897/6 "2010-12-14T22:55:34Z")

</div>

You&nbsp;are&nbsp;welcome.&nbsp;  
&nbsp;Just&nbsp;let&nbsp;us&nbsp;know&nbsp;if&nbsp;you&nbsp;have&nbsp;any&nbsp;other&nbsp;issues.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;Tsui
