This project has moved. For the latest updates, please go here.

Labellayer: Show single point with label

Jan 31, 2008 at 7:37 PM
Hi all,

(using V 0.9)

I want to show a single point on a map. This point should show additional text.

I put that point on a VectorLayer:

List<SharpMap.Geometries.Geometry> GeomColl = new List<SharpMap.Geometries.Geometry>();
GeomColl.Add(new SharpMap.Geometries.Point(lon,lat));

It is shown on the map as desired. How can I manage to show an additional label text for that specific point?

Thanks for your answers!

Feb 4, 2008 at 6:35 PM

I'm brand new to this (both .NET programming and SharpMap), but it seems to me that you need to add another
layer of type LabelLayer to the map, and set its dataprovider to a GeometryProvider using a FeatureDataRow
object. Then you set the LabelColumn to the field in the FeatureDataRow that contains the label-string, and
the Style to a LabelStyle.

I haven't tested that.

SharpMap seems awesome, but there need to be more examples (esp. complete examples!) of how to do certain
things. That would help struggling VB.NET noobs like me.

Feb 12, 2008 at 7:34 PM
Edited Feb 12, 2008 at 7:35 PM
@mikesb - reobervw's advice is on the right track, except a GeometryProvider won't give you any attribute data. You'll need something like Dan and Joel's DataTablePoint provider which allows you to add attribute data.

@robertvw - I hear you, man. I hope that when the v2.0 code is stablized, more examples can be cooked up. I know how painful it is to hit the code without much guidance along the way. I know SharpMap isn't being a good model on how to build support by providing easily accessible code, and it is very frustrating. Please hang in there, and don't hesitate to use the forums for now.