I am new to Sharpmap and GIS. Going through the sample code and building simple programs for better understanding. I have a water bodies layer. I want to display only a particular river. I used CustomTheme. How to show label for only this river.
To display a river (named Ganga), I have written following code.
SharpMap.Data.Providers.ShapeFile shapeFileProvider = new SharpMap.Data.Providers.ShapeFile(@"C:\water.shp", false);
SharpMap.Layers.VectorLayer waterLayer = new SharpMap.Layers.VectorLayer("Water", shapeFileProvider);
SharpMap.Rendering.Thematics.CustomTheme waterTheme = new SharpMap.Rendering.Thematics.CustomTheme(GetWaterStyle);
waterLayer.Theme = waterTheme;
mapBox1.Map.Layers.Add(waterLayer);
The GetWaterStyle method:
private SharpMap.Styles.VectorStyle GetWaterStyle(SharpMap.Data.FeatureDataRow row)
{
SharpMap.Styles.VectorStyle style = new SharpMap.Styles.VectorStyle();
if (row["NAME"].ToString().Equals("Ganga"))
{
style.Fill = Brushes.Aqua;
return style;
}
else
return null;
}
Now I want to show a label "Ganga" (the river name) as well. How to approach?
Please help.
Thanks and regards, Abhi