can't show the labels

Nov 30, 2010 at 10:31 PM

I downloaded the latest release, 11-28-2010, and had some problem with the existing code. When trying to show some of the attributes as labels, I got an error message:

System.Collections.Generic.KeyNotFoundException was unhandled
  Message=The given key was not present in the dictionary.

and debugger points into the line:

result.AddRange(rows.Select(dr => FeatureLookup[dr])); (in public virtual List<IFeature> SelectByAttribute(string filterExpression), FeatureSet.cs)

This is the code I used:

        Dim fl As IFeatureLayer = CType(Map1.Layers(intMapLayer), IFeatureLayer)
        Dim expression As String = "[" & fl.DataSet.DataTable.Columns(0).ColumnName & "]"
        Dim ls As New LabelSymbolizer()
        ls.Orientation = ContentAlignment.MiddleCenter
        Map1.AddLabels(fl, expression, "", ls)

All the points have datatable/attributes.

Dec 16, 2010 at 7:37 AM

        Dim fl As IFeatureLayer = CType(Map1.Layers(intMapLayer), IFeatureLayer)
        Dim myMapLabelLayer As New MapLabelLayer()
        fl.LabelLayer = myMapLabelLayer
        fl.ShowLabels = True
        myMapLabelLayer.Symbology.Categories(0).Expression = "[" & fl.DataSet.DataTable.Columns(0).ColumnName & "]"
        myMapLabelLayer.Symbolizer.Orientation = ContentAlignment.TopCenter

I modified the code a bit, this seems to work.

Nov 29, 2013 at 12:10 AM
yup this works for me too