ApplyExpression no longer working for me in 5.2

Hi,

I’ve upgraded from to 5.2 (from 5.0) and now find that “ApplyExpression” no longer works for me when using category expressions to show images for points in a shapefile.

I’m creating categories like below, where “key” is an identifier of the type of “node” the point is:

myCategory.Expression = “[Type] = “” + key + “””;

then calling:

myCategory.DrawingOptions.PointType = MapWinGIS.tkPointSymbolType.ptSymbolPicture;
myCategory.DrawingOptions.Picture = MyResource.IconImages[key];

and finally:

shp.Categories.ApplyExpression(categoryIndex);

This used to work fine and has done for a long time. However now I get no symbols, just the default point style, except for the 63rd point/node which DOES show a symbol (but the wrong one, the first one in my IconImages list as it happens, probably not coincidence). I’ve tried a couple of fields and it was the 63rd point in each case!

Also, shp.Categories.ApplyExpressions DOES work. However, I switched to the single ApplyExpression a while ago as it is much quicker for this scenario for some reason, so I’m keen to carry on using it.

Regards,

Rob H

Hi Rob,
You’re right, it looks as if ApplyExpression() does not work, but ApplyExpressions() does. My code used to use:

 For i = 0 To 4
     sf.Categories.ApplyExpression(i)
 Next

Now applying all styles (categories) must be done at once:
sf.Categories.ApplyExpressions()

I found no documentation of this being deprecated, and assume a bug. I reworked my code to adapt, but should have directed my concerns to the development team.

Good Luck,
David

Thank you @robhoney, and for the additional feedback @dgreenewalt

I looked at the history of that file, and a bug was indeed introduced in December of 2019 that prevents individual Categories being processed. I’ll try to submit a change that will be in the next build.

Regards,
Jerry.

Thank you both @dgreenewalt and @jerryfaust . It will be great to have a fix for this.

Regards,

Rob

Jira Issue MWGIS-236 has been created and a fix submitted accordingly.

1 Like

This issue has been fixed in MapWinGIS v5.3

I’m closing this topic.