duplicate label issue

Nov 22, 2006 at 8:29 AM
I am having problem with a label layer of US States map. I am getting lots of duplication ( like CA 4 times, NY 5 times etc.) of state names. and mainly it is occuring to coastal areas. does anyone have any ideas?
I tried the same shape file with a map browser and it is showing perfectly there. so shape file is not corrupted.
here is the code I am using for adding label layer.
Dim myStateLayer As SharpMap.Layers.VectorLayer
myStateLayer = New SharpMap.Layers.VectorLayer("States")
myStateLayer.DataSource = New SharpMap.Data.Providers.ShapeFile("C:\demowebsite\App_Data\USA\states.shp", True)
myStateLayer.Style.Fill = New System.Drawing.SolidBrush(Color.GreenYellow)
myStateLayer.Style.Outline = New Pen(Color.Black)
myStateLayer.Style.EnableOutline = True

Dim layStateLabel As New SharpMap.Layers.LabelLayer("StateLabels")

layStateLabel.DataSource = myStateLayer.DataSource

layStateLabel.LabelColumn = "STATE_ABBR"

layStateLabel.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias
layStateLabel.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias

layStateLabel.Enabled = True

layStateLabel.Style = New SharpMap.Styles.LabelStyle
layStateLabel.Style.Font = New Font("Arial", 12)
layStateLabel.Style.ForeColor = Color.Blue
layStateLabel.Style.HorizontalAlignment = SharpMap.Styles.LabelStyle.HorizontalAlignmentEnum.Center
layStateLabel.Style.VerticalAlignment = SharpMap.Styles.LabelStyle.VerticalAlignmentEnum.Middle
layStateLabel.Style.CollisionDetection = True
layStateLabel.Style.CollisionBuffer = New System.Drawing.SizeF(10, 10)