This project has moved and is read-only. For the latest updates, please go here.

Creating Label dynamically on geometry provider 2.0

Topics: SharpMap v2.0
Sep 24, 2008 at 10:22 AM
Edited Sep 24, 2008 at 10: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);

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?

Abid Hussain

Sep 25, 2008 at 9:50 AM
Hi Abid, use a FeatureProvider instead hth jd
Sep 26, 2008 at 11:59 AM

I could not get

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

Thanks for reply,

Abid Hussain