Creating Label dynamically on geometry provider 2.0

Topics: SharpMap v2.0
Sep 24, 2008 at 9:22 AM
Edited Sep 24, 2008 at 9:23 AM

I want to Label my vehicles on the map. I am using Ajax_MNORM

This code is not working

SharpMap.Data.FeatureDataTable fdt = new SharpMap.Data.FeatureDataTable();
fdt.Columns.Add("LblCol", typeof(System.String));

SharpMap.Data.FeatureDataRow NewRow = fdt.NewRow();
NewRow["LblCol"] = "Comp 1 ";
NewRow.Geometry = new SharpMap.Geometries.Point(73,33);
fdt.AddRow(NewRow);

SharpMap.Layers.LabelLayer VehicleLabelLayer = new SharpMap.Layers.LabelLayer("Vehicle Labels");
VehicleLabelLayer.DataSource = new SharpMap.Data.Providers.GeometryProvider(fdt);
VehicleLabelLayer.Enabled = true;
VehicleLabelLayer.LabelColumn = "LblCol";
VehicleLabelLayer.Style.BackColor = new SolidBrush(Color.Black);
VehicleLabelLayer.Style.ForeColor = Color.White;
VehicleLabelLayer.Style.Halo = new Pen(Color.Yellow, 0.1F);
VehicleLabelLayer.Style.CollisionDetection = false;
VehicleLabelLayer.Style.Font = new Font("Arial", 10, GraphicsUnit.Point);


and gives error

Attribute data is not supported by the GeometryProvider
on line
System.Drawing.Bitmap img = (System.Drawing.Bitmap) map.GetMap();

Can anybody help me?

Regards
Abid Hussain

Coordinator
Sep 25, 2008 at 8:50 AM
Hi Abid, use a FeatureProvider instead hth jd
Sep 26, 2008 at 10:59 AM

I could not get

Can you please give me some sample lines of code, I am New

Thanks for reply,

Abid Hussain