# Expand and redraw polygon

**URL:** <https://community.thinkgeo.com/t/expand-and-redraw-polygon/2516>\
**Category:** WinForms\
**Created:** [February 27, 2015, 11:52pm UTC](https://community.thinkgeo.com/t/expand-and-redraw-polygon/2516 "2015-02-27T23:52:42Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Goral](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/4491bb/32.png) [@Goral](https://community.thinkgeo.com/u/Goral)\
**Post date:** [February 27, 2015, 11:52pm UTC](https://community.thinkgeo.com/t/expand-and-redraw-polygon/2516/1 "2015-02-27T23:52:42Z")

</div>

Hi,  
  
  
  
  
  
&nbsp;&nbsp;&nbsp;&nbsp;One&nbsp;of&nbsp;my&nbsp;requirement&nbsp;is&nbsp;like&nbsp;I&nbsp;plot&nbsp;one&nbsp;polygon.&nbsp;With&nbsp;that&nbsp;polygon&nbsp;one&nbsp;more&nbsp;polygon&nbsp;I&nbsp;want&nbsp;to&nbsp;plot&nbsp;polygon&nbsp;with&nbsp;2&nbsp;degree&nbsp;expansion.&nbsp;I&nbsp;thought&nbsp;buffer&nbsp;will&nbsp;work&nbsp;for&nbsp;it.&nbsp;But&nbsp;because&nbsp;of&nbsp;more&nbsp;difference&nbsp;in&nbsp;distance&nbsp;it&nbsp;is&nbsp;giving&nbsp;more&nbsp;round&nbsp;edges&nbsp;shape.&nbsp;Where&nbsp;I&nbsp;want&nbsp;proper&nbsp;straight&nbsp;line&nbsp;polygon&nbsp;shape.&nbsp;Please&nbsp;suggest&nbsp;any&nbsp;other&nbsp;functionality&nbsp;can&nbsp;help&nbsp;to&nbsp;achieve&nbsp;this.  
  
  
  
For&nbsp;reference&nbsp;I&nbsp;have&nbsp;attached&nbsp;image&nbsp;file&nbsp;of&nbsp;drawing&nbsp;of&nbsp;polygons.  
  
  
  
 ![](https://community.thinkgeo.com/uploads/default/original/1X/d2d367a43a036086769bb6d7132b3590e09f6171.png)  
  
  
  
Thanks&nbsp;&&nbsp;Regards,  
  
Goral

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [March 2, 2015, 1:22am UTC](https://community.thinkgeo.com/t/expand-and-redraw-polygon/2516/2 "2015-03-02T01:22:13Z")

</div>

Hi&nbsp;Goral,&nbsp;  
&nbsp;&nbsp;  
&nbsp;The&nbsp;“ScaleUp”&nbsp;is&nbsp;proper&nbsp;to&nbsp;this&nbsp;scenario&nbsp;as&nbsp;following&nbsp;statements:&nbsp;  
&nbsp;&nbsp;  
&nbsp;`MultipolygonShape multipolygon1 = new MultipolygonShape(@"MULTIPOLYGON(((-62.6910512132511 5.96891783124271,-41.5592361957667 36.9622465235532,-15.8488612578273 20.9372868019608,12.3268920988186 45.4149725305469,42.0875315817758 22.3460744697931,-16.0249597163063 -6.5340727207689,-16.0249597163063 -6.5340727207689,-62.6910512132511 5.96891783124271)))");multipolygon1.ScaleUp(2.0); `&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Casper

---

<div class="post-metadata">

**Author:** ![Goral](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/4491bb/32.png) [@Goral](https://community.thinkgeo.com/u/Goral)\
**Post date:** [March 2, 2015, 4:39am UTC](https://community.thinkgeo.com/t/expand-and-redraw-polygon/2516/3 "2015-03-02T04:39:54Z")

</div>

Hi,  
  
  
  
&nbsp;&nbsp;&nbsp;Thanks&nbsp;for&nbsp;reply.&nbsp;Its&nbsp;working&nbsp;fine.&nbsp;One&nbsp;more&nbsp;doubt.&nbsp;Can&nbsp;you&nbsp;please&nbsp;give&nbsp;some&nbsp;relationship&nbsp;of&nbsp;percentage&nbsp;with&nbsp;degree&nbsp;or&nbsp;distance&nbsp;?&nbsp;Because&nbsp;how&nbsp;to&nbsp;judge&nbsp;how&nbsp;much&nbsp;percentage&nbsp;should&nbsp;I&nbsp;give&nbsp;if&nbsp;I&nbsp;want&nbsp;to&nbsp;scaleup&nbsp;feature&nbsp;by&nbsp;2&nbsp;degree.  
  
  
  
Thanks,  
  
Goral

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [March 3, 2015, 12:27am UTC](https://community.thinkgeo.com/t/expand-and-redraw-polygon/2516/4 "2015-03-03T00:27:51Z")

</div>

Hi&nbsp;Goral,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;think&nbsp;that&nbsp;you&nbsp;will&nbsp;iterate&nbsp;all&nbsp;vertices&nbsp;of&nbsp;the&nbsp;polygon’s&nbsp;outer&nbsp;ring,&nbsp;and&nbsp;scale&nbsp;every&nbsp;point&nbsp;to&nbsp;specified&nbsp;length&nbsp;as&nbsp;following&nbsp;statements:&nbsp;  
&nbsp;&nbsp;  
&nbsp;` static void ScaleOneRing(RingShape targetRingShape, double specifiedLength, double centerX, double centerY)        {            for (int i = 0; i < targetRingShape.Vertices.Count; i++)            {                double newX = ((targetRingShape.Vertices[i].X - centerX) + specifiedLength) + centerX;                double newY = ((targetRingShape.Vertices[i].Y - centerY) + specifiedLength) + centerY;                targetRingShape.Vertices[i] = new Vertex(newX, newY);            }        }`&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,

---

<div class="post-metadata">

**Author:** ![Goral](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/4491bb/32.png) [@Goral](https://community.thinkgeo.com/u/Goral)\
**Post date:** [March 3, 2015, 12:56am UTC](https://community.thinkgeo.com/t/expand-and-redraw-polygon/2516/5 "2015-03-03T00:56:19Z")

</div>

Hi,  
  
  
  
&nbsp;&nbsp;&nbsp;Thanks&nbsp;for&nbsp;reply.&nbsp;I&nbsp;have&nbsp;tried&nbsp;given&nbsp;solution.&nbsp;I&nbsp;don’t&nbsp;know&nbsp;I&nbsp;am&nbsp;doing&nbsp;something&nbsp;wrong&nbsp;or&nbsp;not.&nbsp;In&nbsp;result&nbsp;I&nbsp;am&nbsp;getting&nbsp;whole&nbsp;polygon&nbsp;shifted&nbsp;two&nbsp;degree.&nbsp;Due&nbsp;to&nbsp;this&nbsp;two&nbsp;polygons&nbsp;drawn&nbsp;at&nbsp;two&nbsp;different&nbsp;places.&nbsp;Please&nbsp;suggest&nbsp;where&nbsp;is&nbsp;the&nbsp;problem.  
  
  
  
Thanks,  
  
Goral

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [March 3, 2015, 11:21pm UTC](https://community.thinkgeo.com/t/expand-and-redraw-polygon/2516/6 "2015-03-03T23:21:19Z")

</div>

Hi&nbsp;Goral,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I’m&nbsp;sorry&nbsp;for&nbsp;missing&nbsp;some&nbsp;condition&nbsp;about&nbsp;this&nbsp;scenario,&nbsp;I&nbsp;rewrite&nbsp;a&nbsp;function&nbsp;to&nbsp;implement&nbsp;this&nbsp;issue&nbsp;as&nbsp;following&nbsp;statements:&nbsp;  
&nbsp;&nbsp;  
&nbsp;`private void ScaleOneRing(RingShape targetRingShape, double specifiedLength, double centerX, double centerY)        {            for (int i = 0; i < targetRingShape.Vertices.Count; i++)            {                double distance = Math.Sqrt((targetRingShape.Vertices[i].X - centerX) * (targetRingShape.Vertices[i].X - centerX) + (targetRingShape.Vertices[i].Y - centerY) * (targetRingShape.Vertices[i].Y - centerY));                double ratio = (distance + specifiedLength) / distance;               double newX = ((targetRingShape.Vertices[i].X - centerX) * ratio) + centerX;                double newY = ((targetRingShape.Vertices[i].Y - centerY) * ratio) + centerY;                targetRingShape.Vertices[i] = new Vertex(newX, newY);           }        } `&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,

---

<div class="post-metadata">

**Author:** ![Goral](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/4491bb/32.png) [@Goral](https://community.thinkgeo.com/u/Goral)\
**Post date:** [March 4, 2015, 7:29am UTC](https://community.thinkgeo.com/t/expand-and-redraw-polygon/2516/7 "2015-03-04T07:29:16Z")

</div>

Hi,  
  
  
  
&nbsp;&nbsp;&nbsp;&nbsp;Thanks&nbsp;for&nbsp;reply.&nbsp;Its&nbsp;working&nbsp;as&nbsp;per&nbsp;requirement.&nbsp;If&nbsp;any&nbsp;further&nbsp;clarification&nbsp;required&nbsp;I&nbsp;will&nbsp;get&nbsp;back&nbsp;to&nbsp;you.  
  
  
  
  
  
Thanks,  
  
Goral  
  
  
  
&nbsp;&nbsp;&nbsp;

---

<div class="post-metadata">

**Author:** ![Kevin5](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/k/bbce88/32.png) [@Kevin5](https://community.thinkgeo.com/u/Kevin5)\
**Post date:** [March 5, 2015, 3:31am UTC](https://community.thinkgeo.com/t/expand-and-redraw-polygon/2516/8 "2015-03-05T03:31:38Z")

</div>

Hi&nbsp;Goral,  
  
  
  
Very&nbsp;glad&nbsp;to&nbsp;hear&nbsp;it&nbsp;works.  
  
  
  
Any&nbsp;question&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;us&nbsp;know.  
  
  
  
Regards,  
  
Kevin.

---

<div class="post-metadata">

**Author:** ![Goral](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/4491bb/32.png) [@Goral](https://community.thinkgeo.com/u/Goral)\
**Post date:** [June 16, 2015, 6:54am UTC](https://community.thinkgeo.com/t/expand-and-redraw-polygon/2516/9 "2015-06-16T06:54:28Z")

</div>

Hi,  
  
  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;One&nbsp;question&nbsp;is&nbsp;if&nbsp;I&nbsp;want&nbsp;to&nbsp;enter&nbsp;specified&nbsp;length&nbsp;in&nbsp;Nautical&nbsp;mile&nbsp;instead&nbsp;of&nbsp;Degrees&nbsp;what&nbsp;to&nbsp;change&nbsp;in&nbsp;code?&nbsp;Please&nbsp;guide.  
  
  
  
Thanks,  
  
Goral

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [June 17, 2015, 12:59am UTC](https://community.thinkgeo.com/t/expand-and-redraw-polygon/2516/10 "2015-06-17T00:59:13Z")

</div>

Hi&nbsp;Goral,&nbsp;  
&nbsp;&nbsp;  
&nbsp;You&nbsp;should&nbsp;want&nbsp;to&nbsp;convert&nbsp;Natuical&nbsp;mile&nbsp;to&nbsp;Decimal&nbsp;Degree&nbsp;before&nbsp;calculate&nbsp;it.&nbsp;  
&nbsp;&nbsp;  
&nbsp;The&nbsp;wikipedia&nbsp;said:&nbsp;The&nbsp;nautical&nbsp;mile&nbsp;is&nbsp;nearly&nbsp;equal&nbsp;to&nbsp;a&nbsp;minute&nbsp;of&nbsp;latitude&nbsp;on&nbsp;a&nbsp;chart.&nbsp;So&nbsp;I&nbsp;think&nbsp;if&nbsp;you&nbsp;don’t&nbsp;need&nbsp;very&nbsp;precise&nbsp;result,&nbsp;you&nbsp;can&nbsp;easily&nbsp;convert&nbsp;between&nbsp;them.&nbsp;If&nbsp;you&nbsp;need&nbsp;better&nbsp;result&nbsp;please&nbsp;find&nbsp;a&nbsp;algorithm&nbsp;for&nbsp;conversion.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Don
