Hello,
I’m having some problems with labeling on street layers. I’m working with MapSuite Desktop edition, VB.NET VS2010, using a custom street shape file with the field Name.
1. When zoomed to about ZoomLevel14 and farther, I’m seeing very few labels. I originally set the DefaultTextStyle on the same layer as the shape, then I saw a sample and a discussion suggesting I needed to add the shape file once for shape and once for labels. It did not make a difference. I’ve also tried using CustomStyles. Here is the code that I use to set the text style for the label layer.
Dim t As TextStyle
t = TextStyles.CreateSimpleTextStyle(“Name”, “Arial”, 8, DrawingFontStyles.Regular, GeoColor.StandardColors.Black)
t.DuplicateRule = LabelDuplicateRule.NoDuplicateLabels
t.OverlappingRule = LabelOverlappingRule.NoOverlapping
t.DrawingLevel = 4
t.TextLineSegmentRatio = 10
t.SuppressPartialLabels = False
str1LabelLayer.IsVisible = True
str1LabelLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(TextStyles.LocalRoad1(“Name”))
'str1LabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = t
str1LabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
2. I have a labeling tool, which allows the user to click on a street segment, then creates a label to show the name of the street. How can I get the label to match the angle of the street? Are there any samples for this? I’ve searched the forums and looked at the samples, haven’t found anything. I’m attaching a screen shot of the map showing three streets labeled. N 6th St is labeled correctly. I would like for Wells Ave and Park Ave to display vertically along with the street segments.
Thank you!
Serena Lucy
Street labels
Hi Serena,
For the reason why we suggest it is better to separate the street shape file into the shape layer and the label layer, it’s because we can put all the label layers into one overlay at the top of the map to avoid the label was overlapped by other overlays. However, if there is only one overlay, it does not make a difference to using two kinds of layer for one shape file.
As for #1 question “When zoomed to about ZoomLevel14 and farther, I’m seeing very few labels”, would you please try to comment out the DuplicateRule and then enable the LabelAllLineParts for the textstyle.
As for #2 question, as I know all the street labels should be along with the street segment by default if we are using the TextStyle and we can see it based on the HowDoI samples. Would you mind attaching the screen shot to show the issue again? Or it is highly appreciate to provide a concrete sample to show this issue?
Waiting for your further information.
Thanks,
Johnny
Hi Johnny,
for question #1 - I added another overlay for the labels. It did not make a diffence until I set t.TextLineSegmentRatio = 50. The higher the number, the more labels I get. I would say that this issue is resolved.
for question #2 - When the user clicks the label tool on the map, I get the name and coordinates of the street, then add a point feature to an InMemoryFeatureLayer with only the text style set, so that’s how I get the label on the map. I’m sure that’s why the label doesn’t follow the street angle. Is there an example that would show how to label just one feature on the street layer? Could I use ValueStyles?
Thanks!
Serena
I worked out a solution for the street labeling
tool (Question #2). When the user clicks on a street, I
use .QueryTools.GetFeaturesWithinDistanceOf to get the feature info. I then create a ValueStyle/ValueItem
using the unique id field (ATISId in
this case) and the desired TextStyle. I
add this to the street layer’s CustomStyles. It works quite nicely.
There is a lot of unrelated code involved, but if anyone really needs this, let me know and I will extract out only the necessary pieces.
Serena
Hi Serena,
Great to hear it is sorted out, if you have any more question, please feel free to let us know.
Best Regards
Summer