Labels not loading for road type shapefile(polyline) using sharpmap

Mar 12, 2013 at 1:48 PM
We are developing software using sharpmap. We are able to load all shapefiles and associated labels on map using LabelLayer. But sometimes we unable to find labels on the map.
 After debugging the code we found that for shapefiles like "Calhoun_roads.shp" we unable to go inside 
labelLayer.LabelPositionDelegate = delegate(SharpMap.Data.FeatureDataRow fdr)

Same thing happening for every road type shapefiles (polylines). We tested for both web and desktop applications. Pl give any ideal for resolving this issue. Thanks in advance

Mar 12, 2013 at 2:16 PM
You are using LabelLayer with an assigned LabelPositionDelegate?
If you don't see your labels, we need to have a look at the delegate function to see how you are modifying the geometry.
Mar 13, 2013 at 5:36 AM
We tested the application after commenting the code for LabelPositionDelegate. Still we are unable to see the labels on the map.

This is not happening for all shapefiles except for some specific files like
1) Calhoun_roads.shp
2) Callahan_roads.shp
3) Cameron_roads.shp
4) Camp_roads.shp etc.

We observed that labels not displaying for shapefiles which for "roads" ( lines).
Labels loading for remaining all other shapefiles with the same code.

And also when we do debugging control not going inside LabelPositionDelegate for these shapefiles ( for remaining all shapefiles control going inside).

Please give any idea to resolve this issue.

Mar 13, 2013 at 8:42 AM
I suspect it is due to your input geometries that you are not seeing any labels.
For labeling linestrings, play with the settings of the following properties for the LabelStyle
  • CollisionDetection = [true|false]
  • CollisionBuffer = new Size(x, y)
  • IsTextOnPath = [true|false]
  • IgnoreLength = [true|false]
Have a look at the WinFormSamples project, there are a lot of examples for labeling, even lineal geometries.
Mar 13, 2013 at 2:24 PM
Hi FObermaier,
             We tested our application with above all LabelStyle properties (in different combinations). But we didn't get any solution. We are using  version "0.9.4338.20113".
We are wondering that labels are loading for all shapefiles except roads type shapefiles. May be this would be bug in sharpmap or any version problem.

Please give solution. We are waiting for your replay.

Mar 13, 2013 at 2:33 PM
I don't have access to the shapefiles you mention. I doubt that it is a bug in LabelLayer.
Raise an issue and provide a access to your labellayer configuration code as well as the shapefile in question
Mar 14, 2013 at 11:27 AM
Hi FObermaier,
            Thank you very much for your quick replay. If possible you can download the above said shapefile from following url: 
               "" (download "Calhoun" eighth row and second column for roads).

Please check if it is possible for you and correct me if anything wrong from side. Sorry for troubling you. 
Thanks and Regards,
Mar 14, 2013 at 1:18 PM
The LabelLayer works just fine with the ShapeFile you mentioned.
Need to have a look at your labellayer configuration code.

Mine looks like this:
var ll = new LabelLayer("Label " + provider.ConnectionID);
ll.DataSource = provider;
var f = provider.GetFeature(1);

ll.LabelColumn = f.Table.Columns[1].ColumnName;
ll.Style.CollisionDetection = false;
ll.Style.IgnoreLength = true;