# Shapefile-Categories Error 5.2.2

**URL:** <https://mapwindow.discourse.group/t/shapefile-categories-error-5-2-2/656>\
**Category:** MapWinGIS\
**Created:** [July 22, 2020, 8:01am UTC](https://mapwindow.discourse.group/t/shapefile-categories-error-5-2-2/656 "2020-07-22T08:01:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![frank2x460](https://avatars.discourse-cdn.com/v4/letter/f/b5a626/32.png) [@frank2x460](https://mapwindow.discourse.group/u/frank2x460)\
**Post date:** [July 22, 2020, 8:01am UTC](https://mapwindow.discourse.group/t/shapefile-categories-error-5-2-2/656/1 "2020-07-22T08:01:38Z")

</div>

When changing from 5.1.1 to 5.2.2 Shapefile-Categories are not working properly:  
Before and After:

 ![4120_](https://global.discourse-cdn.com/free1/uploads/mapwindow1/original/1X/ac8a409191e22441a43a3b292d8e76156f527f56.jpeg)

No changes to the Software, just installing latest version of Mapwingis  
Any suggestions for solution?

---

<div class="post-metadata">

**Author:** ![frank2x460](https://avatars.discourse-cdn.com/v4/letter/f/b5a626/32.png) [@frank2x460](https://mapwindow.discourse.group/u/frank2x460)\
**Post date:** [July 22, 2020, 1:50pm UTC](https://mapwindow.discourse.group/t/shapefile-categories-error-5-2-2/656/2 "2020-07-22T13:50:41Z")

</div>

Issue found:

Interface of Labels.AddLabel function has changed from 5.1 to 5.2:  
Sub AddLabel(Text As String, x As Double, y As Double, Optional Rotation As Double = 0, Optional Category As Integer = -1)  
to  
Sub AddLabel(Text As String, x As Double, y As Double, Optional OffsetX As Double = 0, Optional OffsetY As Double = 0, Optional Rotation As Double = 0, Optional Category As Integer = -1)

and therefore the position of Parameters “Rotation” an “Category” has changed.  
No error or warnings because new Offset - Parameters are optional!

Be careful!

Solution of MWGIS-201 is probably the reason.

Regards,  
Frank

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [July 22, 2020, 4:37pm UTC](https://mapwindow.discourse.group/t/shapefile-categories-error-5-2-2/656/3 "2020-07-22T16:37:57Z")

</div>

I agree that the new optional parameters should have been added at the end so as not to break existing code.

Jerry.

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [July 24, 2020, 7:21am UTC](https://mapwindow.discourse.group/t/shapefile-categories-error-5-2-2/656/4 "2020-07-24T07:21:58Z")

</div>

@jerryfaust I just published a new release candidate, so we don’t have a stable version yet.  
We could still fix the order of AddLabel to be more backwards compatible.

@Mathijs.Dumon: It is your change. What do you think?

---

<div class="post-metadata">

**Author:** ![Mathijs.Dumon](https://avatars.discourse-cdn.com/v4/letter/m/9de053/32.png) [@Mathijs.Dumon](https://mapwindow.discourse.group/u/Mathijs.Dumon)\
**Post date:** [July 24, 2020, 6:01pm UTC](https://mapwindow.discourse.group/t/shapefile-categories-error-5-2-2/656/5 "2020-07-24T18:01:57Z")

</div>

Changing the order is an option indeed. I wont be able to make that change soon though, currently on holiday.

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [July 24, 2020, 6:21pm UTC](https://mapwindow.discourse.group/t/shapefile-categories-error-5-2-2/656/6 "2020-07-24T18:21:26Z")

</div>

I can make the change this weekend. It should not take long.

Regards.

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [July 25, 2020, 7:27pm UTC](https://mapwindow.discourse.group/t/shapefile-categories-error-5-2-2/656/7 "2020-07-25T19:27:54Z")

</div>

Ok. I have updated the code, placing the new optional parameters at the end of the parameter list. I have also updated [MWGIS-201](https://mapwindow.atlassian.net/projects/MWGIS/issues/MWGIS-201) accordingly.

The functions affected were:  
`AddLabel, InsertLabel, AddPart, InsertPart, CreateNewLabel, and AddLabelToShape.`

Thank you, @frank2x460, for pointing this out.

Regards,  
Jerry.

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [January 5, 2022, 3:09pm UTC](https://mapwindow.discourse.group/t/shapefile-categories-error-5-2-2/656/8 "2022-01-05T15:09:05Z")

</div>

Closed on January 5, 2022, 3:09pm UTC


