# FileGeoDatabase Layer - Label Rotation

**URL:** <https://community.thinkgeo.com/t/filegeodatabase-layer-label-rotation/8588>\
**Category:** MVC\
**Created:** [June 12, 2017, 8:13pm UTC](https://community.thinkgeo.com/t/filegeodatabase-layer-label-rotation/8588 "2017-06-12T20:13:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chad5](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/8797f3/32.png) [@Chad5](https://community.thinkgeo.com/u/Chad5)\
**Post date:** [June 12, 2017, 8:13pm UTC](https://community.thinkgeo.com/t/filegeodatabase-layer-label-rotation/8588/1 "2017-06-12T20:13:50Z")

</div>

I had asked this question in the WebAPI Support but have since switched back to MVC.

Is there a way to rotate a label on an individual basis. I have an annotations layer with a column of doubles dedicated for the angle (0-359). These labels go along the outer lines of the polygon and need to be angled appropriately. Also there is a column for font size which I will need to do similar to the angles. Any help would be appreciated.

Emil had suggested some links to a Services Edition Sample, but the override doesn’t seem to work the same way in MVC.

---

<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 13, 2017, 3:08am UTC](https://community.thinkgeo.com/t/filegeodatabase-layer-label-rotation/8588/2 "2017-06-13T03:08:38Z")

</div>

Hi Chad,

Could you please let us know the detail problem you met?

It looks Emil provide the sample: [http://wiki.thinkgeo.com/wiki/source\_code\_serviceseditionsample\_labelingbasedoncolumns\_cs\_090807.zip](http://wiki.thinkgeo.com/wiki/source_code_serviceseditionsample_labelingbasedoncolumns_cs_090807.zip)

Which contains the customTextStyle inherit from our textStyle, that’s contained in our core code, which is the same both in MVC edition and WebAPI edition.

So I want to double check the detail information and we can suggest you how to solve it.

Regards,

Don

---

<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 13, 2017, 8:37am UTC](https://community.thinkgeo.com/t/filegeodatabase-layer-label-rotation/8588/3 "2017-06-13T08:37:06Z")

</div>

Hi Chad,

As below is a sample I created for you, it works well. Please try it and let me know whether that works.

[8588.zip](https://community.thinkgeo.com/uploads/default/original/3X/c/b/cb9d19d263977b5a229c6c252cd38dc135fa39df.zip) (1.9 MB)

 ![](https://community.thinkgeo.com/uploads/default/original/3X/b/c/bca32c33e73d47211491826dff65b64c47e79d28.png)

Regards,

Don

---

<div class="post-metadata">

**Author:** ![Chad5](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/8797f3/32.png) [@Chad5](https://community.thinkgeo.com/u/Chad5)\
**Post date:** [June 13, 2017, 1:43pm UTC](https://community.thinkgeo.com/t/filegeodatabase-layer-label-rotation/8588/4 "2017-06-13T13:43:08Z")

</div>

Your sample is exactly what we need I believe, but with my map the layer breaks when trying to run the below code line. It fails on the first feature.

DrawCore -\>  
ScreenPointF textScreenPoint = ExtentHelper.ToScreenCoordinate(canvas.CurrentWorldExtent, feature, canvas.Width, canvas.Height);

a typical value is as follows:  
canvas.CurrentWorldExtent = -10780572.503912,4724900.1173184,-10780070.885932,4724630.7962368  
feature = (polygon feature)  
canvas.Width = 1680.0  
canvas.Height = 902.0

The polygon feature looks like it is coming across correctly with correct column values (5 column values - Text, Size, Angle, Color, Font). Just for whatever reason the ScreenPointF will fail. The values are coming from a filegeodatabase not a shapefile.

---

<div class="post-metadata">

**Author:** ![Chad5](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/8797f3/32.png) [@Chad5](https://community.thinkgeo.com/u/Chad5)\
**Post date:** [June 13, 2017, 9:31pm UTC](https://community.thinkgeo.com/t/filegeodatabase-layer-label-rotation/8588/5 "2017-06-13T21:31:00Z")

</div>

Ok, so I’ve gotten all of the values to rotate correctly but they will only appear if I put in values for the ScreenPointF. Such as changing the below line of code:

ScreenPointF textScreenPoint = ExtentHelper.ToScreenCoordinate(canvas.CurrentWorldExtent, feature, canvas.Width, canvas.Height);

to this:

ScreenPointF textScreenPoint = new ScreenPointF(500, 500);

Changing the line is the only way I am able to view the layer, otherwise it will crash the layer. Obviously this isn’t helpful to our map because all of the values overlap each other and are not readable. So something is going on with either the extent or the extenthelper.

By the way I’m running MapSuite 9.0.0.180. And the MapUnit is GeographyUnit.Meter.

---

<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 14, 2017, 3:38am UTC](https://community.thinkgeo.com/t/filegeodatabase-layer-label-rotation/8588/6 "2017-06-14T03:38:21Z")

</div>

Hi Chad,

I think we need a sample with data which can reproduce your problem, could you please upload one here so our developer can work based on that?

And your dll is so early, please try our latest v9 or v10 before that.

Regards,

Don

---

<div class="post-metadata">

**Author:** ![Chad5](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/8797f3/32.png) [@Chad5](https://community.thinkgeo.com/u/Chad5)\
**Post date:** [June 14, 2017, 7:12pm UTC](https://community.thinkgeo.com/t/filegeodatabase-layer-label-rotation/8588/7 "2017-06-14T19:12:07Z")

</div>

I was able to get it without changing versions by changing the code to:

ScreenPointF textScreenPoint = ExtentHelper.ToScreenCoordinate(canvas.CurrentWorldExtent, feature.GetBoundingBox().GetCenterPoint().X, feature.GetBoundingBox().GetCenterPoint().Y, canvas.Width, canvas.Height);

Thanks

---

<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 15, 2017, 2:09am UTC](https://community.thinkgeo.com/t/filegeodatabase-layer-label-rotation/8588/8 "2017-06-15T02:09:12Z")

</div>

Hi Chad,

I am glad to hear you solve that and thanks for your share.

Regards,

Don
