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

Linestring Color

Topics: SharpMap Project
Jul 2, 2011 at 10:13 AM


is it possible to set the Color of a single Linestring? At the moment i set the color of the linestrings over the Layer, but do i need for each

color a new Layer?

Best Regards.

Jul 2, 2011 at 2:52 PM
Edited Jul 2, 2011 at 2:52 PM

You can use a GradientTheme, CustomTheme or write your own ITheme implementation.

There are theming samples in the WinFormSamples project.

Hth FObermaier

Jul 3, 2011 at 9:58 AM
Edited Jul 3, 2011 at 7:39 PM

Thank yoz FObermaier,

do you mean the GradiantThemeSample.cs . I am not sure if this is what i want.

I will draw some Lines with a DigitalPan on the Map in different colors. And i will only use one Layer to do this. Is this

possible with this method and is the GradiantThemeSample the right code for me?


Thank you  for helping :)


I use MapSui and the version of SharpMap has no VectorLayer => and no Theme attribute.

Do u have maybe a other solution?

Jul 3, 2011 at 9:38 PM

That depends on how you store your digitized linestrings. to use theming, you need to have some property (DataColumn) by which the theme can determine which color to pick.

You could even implement your own ITheme that sets the actual linestring color( and maybe pen width as well ) by values of the featuredatarow.

There is another shapefile theming sample in there, I think it is called ShapeFileOsm.

Hth FObermaier

Jul 4, 2011 at 10:05 AM

There is no ShapeFileOsm Sample :( and i dont understand with the other samples how to give my linestring an attribute to identify it.

I dont know what to do, is my first step to give my linestring an attribut?  If yes, how to do this?

Jul 4, 2011 at 10:53 AM

There is:

Hth FObermaier

Jul 5, 2011 at 10:06 AM

Thank You :)