# Apply rotation to shape file

**URL:** <https://community.thinkgeo.com/t/apply-rotation-to-shape-file/2691>\
**Category:** WinForms\
**Created:** [March 17, 2016, 10:09am UTC](https://community.thinkgeo.com/t/apply-rotation-to-shape-file/2691 "2016-03-17T10:09:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin6](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/k/aeb1de/32.png) [@Kevin6](https://community.thinkgeo.com/u/Kevin6)\
**Post date:** [March 17, 2016, 10:09am UTC](https://community.thinkgeo.com/t/apply-rotation-to-shape-file/2691/1 "2016-03-17T10:09:01Z")

</div>

Hi,&nbsp;  
  
  
  
I&nbsp;have&nbsp;a&nbsp;shape&nbsp;file&nbsp;which&nbsp;has&nbsp;already&nbsp;been&nbsp;saved&nbsp;with&nbsp;a&nbsp;spherical&nbsp;mercator&nbsp;projection.&nbsp;When&nbsp;I&nbsp;load&nbsp;that&nbsp;and&nbsp;apply&nbsp;a&nbsp;rotation&nbsp;projection&nbsp;it&nbsp;places&nbsp;the&nbsp;shape&nbsp;file&nbsp;way&nbsp;off&nbsp;from&nbsp;where&nbsp;it&nbsp;should&nbsp;be.&nbsp;It&nbsp;does&nbsp;correctly&nbsp;rotate&nbsp;it&nbsp;but&nbsp;I’m&nbsp;not&nbsp;sure&nbsp;why&nbsp;it&nbsp;puts&nbsp;it&nbsp;way&nbsp;up&nbsp;in&nbsp;Canada.&nbsp;Here&nbsp;are&nbsp;images&nbsp;which&nbsp;show&nbsp;it&nbsp;with&nbsp;and&nbsp;without&nbsp;rotation.&nbsp;  
  
  
  
Without&nbsp;any&nbsp;rotation&nbsp;applied&nbsp;to&nbsp;the&nbsp;shape&nbsp;file.&nbsp;

 ![](https://community.thinkgeo.com/uploads/default/original/1X/8b2488d2b04419d284ec83582cab1e04738ddbd2.PNG)  
  
  
  
With&nbsp;rotation&nbsp;projection:  
  
  
  
 ![](https://community.thinkgeo.com/uploads/default/original/1X/42bfae6b85d6c47c151df0a18420c688e173ef21.PNG)  
  
  
  
Any&nbsp;idea&nbsp;why&nbsp;this&nbsp;would&nbsp;be&nbsp;happening?&nbsp;  
  
  
  
Here&nbsp;is&nbsp;the&nbsp;code&nbsp;which&nbsp;is&nbsp;applying&nbsp;the&nbsp;rotation&nbsp;projection&nbsp;to&nbsp;the&nbsp;shape&nbsp;layer.&nbsp;  
  
  
  

> `Dim`&nbsp;`rotProjection ``As`&nbsp;`RotationProjection = ``New`&nbsp;`RotationProjection(currReplay.GetSelectedSensor().MagVar) ``With`&nbsp;`{.SourceUnit = GeographyUnit.Meter}`  
> `rotProjection.Open()`  
> `shapeLayer.FeatureSource.Projection = rotProjection`

  
In&nbsp;this&nbsp;particular&nbsp;case&nbsp;the&nbsp;magnetic&nbsp;declination&nbsp;angle&nbsp;is&nbsp;-9.&nbsp;  
  
  
  
Thank&nbsp;you!  
  
  
  
Best,  
  
  
  
Kevin

---

<div class="post-metadata">

**Author:** ![Peter](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/peter/32/19042_2.png) [@Peter](https://community.thinkgeo.com/u/Peter)\
**Post date:** [March 17, 2016, 8:25pm UTC](https://community.thinkgeo.com/t/apply-rotation-to-shape-file/2691/2 "2016-03-17T20:25:12Z")

</div>

Hi&nbsp;Kevin,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Also&nbsp;we&nbsp;need&nbsp;to&nbsp;set&nbsp;the&nbsp;"PivotCenter"&nbsp;property&nbsp;of&nbsp;RotationProjection,&nbsp;otherwise&nbsp;it&nbsp;rotates&nbsp;vertices&nbsp;pivot&nbsp;the&nbsp;point(0,0).&nbsp;  
&nbsp;&nbsp;  
&nbsp;Please&nbsp;try&nbsp;the&nbsp;following&nbsp;code:&nbsp;  
&nbsp;rotProjection&nbsp;.PivotCenter&nbsp;=&nbsp;test.GetBoundingBox().GetCenterPoint();&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;Peter

---

<div class="post-metadata">

**Author:** ![Kevin6](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/k/aeb1de/32.png) [@Kevin6](https://community.thinkgeo.com/u/Kevin6)\
**Post date:** [March 18, 2016, 7:05am UTC](https://community.thinkgeo.com/t/apply-rotation-to-shape-file/2691/3 "2016-03-18T07:05:36Z")

</div>

That&nbsp;worked!&nbsp;Learning&nbsp;more&nbsp;each&nbsp;day.&nbsp;Thanks&nbsp;Peter!

---

<div class="post-metadata">

**Author:** ![Peter](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/peter/32/19042_2.png) [@Peter](https://community.thinkgeo.com/u/Peter)\
**Post date:** [March 20, 2016, 8:59pm UTC](https://community.thinkgeo.com/t/apply-rotation-to-shape-file/2691/4 "2016-03-20T20:59:42Z")

</div>

Hi&nbsp;Kevin,&nbsp;  
&nbsp;&nbsp;  
&nbsp;It’s&nbsp;my&nbsp;pleasure.&nbsp;We&nbsp;are&nbsp;very&nbsp;glad&nbsp;to&nbsp;hear&nbsp;it&nbsp;works.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;Peter
