Hello,
There are some inconsistency when displaying the points label, either without label or just disappear when you pan the map. please see the attachment where shapshot1 is initial view and you’ll see some of the points does not have labels on it while snapshot2, some labels appears after i pan. as for the streets, most of the time there is no name and sometime the name was there after you pan the name disappear. is this a bug?
running on:
-os: windows 7
-ide: visual studio 2010
-mapsuite: mvc 7.0
Thanks,
rhandy
001_snapshot1.png (81.9 KB)
001_snapshot2.png (79.5 KB)
Inconsistent POI and streets Labeling, bug?
Hi Rhandy,
It looks that’s not a bug.
We will redraw the label each time you pan the map or zoom. And the label shows or not related with many rules which you set for the DefaultTextStyle, you can try changing the settings follow your requirement.
Regards,
Don
Dear Don,
Thanks for the reply, i am sorry, i don’t understand what you mean. below is my sample code and please tell me where is my mistake.
ShapeFileFeatureLayer POILabelLayer =
new
ShapeFileFeatureLayer(Server.MapPath(
"~/App_Data/poi.shp"
));
TextStyle _ts = TextStyles.CreateSimpleTextStyle(“NAME”,
“Verdana”
, 12, DrawingFontStyles.Regular, GeoColor.StandardColors.OrangeRed);
_ts.PointPlacement = PointPlacement.LowerCenter;
_ts.YOffsetInPixel = -10;
POILabelLayer.ZoomLevelSet.ZoomLevel17.DefaultTextStyle = _ts;
POILabelLayer.ZoomLevelSet.ZoomLevel17.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
POILabelLayer.ZoomLevelSet.ZoomLevel17.DefaultTextStyle.BestPlacement =
true
;
POILabelLayer.DrawingMarginPercentage = 100;
Thanks,
rhandy
Hi Rhandy,
Thanks for your furhter information, we have tried our own data with your code, but the problem didn’t show up, would you please upload your data or send it to forumsupport@thinkgeo.com if it is confidential.
if you have any more question , please feel free to let us know.
Waiting for your further information
Summer
Hi Summer,
Thanks for the reply, what i can provide you right now is a slim-down POI, i tested it and show same problem. Kindly check the attached .png, that will show you a points without label/s and i also attached .zip file which contains the POI i mentioned. Below is the code is used:
ShapeFileFeatureLayer POILabelLayer =
new
ShapeFileFeatureLayer(Server.MapPath(
"~/App_Data/poi_Sample2.shp"
));
TextStyle ts = TextStyles.CreateSimpleTextStyle(
“NAME”
,
“Verdana”
, 8, DrawingFontStyles.Regular, GeoColor.StandardColors.Black);
ts.PointPlacement = PointPlacement.UpperCenter;
POILabelLayer.ZoomLevelSet.ZoomLevel17.DefaultTextStyle = ts;
POILabelLayer.ZoomLevelSet.ZoomLevel17.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
POILabelLayer.ZoomLevelSet.ZoomLevel17.DefaultTextStyle.BestPlacement =
true
;
POILabelLayer.DrawingMarginPercentage = 100;
Hope this help,
Regards,
rhandy
003_sample.png (26.8 KB)
POI_Sample.zip (14.2 KB)
Hi Rhandy,
Thanks for your data.
There are two reasons for this phenomenon:
The first reason is because some ‘NAME’ columns values are duplicate and the default Duplicate rule in core is NoDuplicateLabels. So, we need to set a UnlimitedDuplicateLabels rule for text style:
TextStyle ts = TextStyles.CreateSimpleTextStyle("NAME", "Verdana", 8, DrawingFontStyles.Regular, GeoColor.StandardColors.Black);
ts.DuplicateRule = LabelDuplicateRule.UnlimitedDuplicateLabels;
//…
The second is because some of the labels is too long and will overlap the other labels nearby. If we want to force to show those labels, we can set the OverlappingRule for text style:
ts.OverlappingRule = LabelOverlappingRule.AllowOverlapping;
Would you please try to add the two rules for textstyle and check if the problem still there?
If any other questions, please don’t hesitate to let us know.
Thanks
Summer
Hello Summer,
Thanks for the reply, both solution you’ve provided has resolved the problems.
Thank you and regards,
rhandy
Hi Rhandy,
I am glad that works for you.
Any question please let us know.
Regards,
Don