I am trying to use the styling of WMS using the so called SLD. I never used it before and I was wondering if I can do styling of a layer which has lines based on property. I found here that something like this is possible. They call it (attribute-based line). What I don't understand is where to define these attributes. My line data are stored in a postgis and loaded in a store in geoserver. My postgis table has 3 columns (id, geometry, typeOfRoad). My question is: Can I use the typeOfRoad attribute to color different the lines different? Is there an example?


1 Answer 1


The easy way I use to set up styling is to load your dataset in QGIS and style it with that. Use only simple style features like colour and width and do it on a single attribute.

The save that QGIS style as SLD, and copy paste that XML into GeoServer's style dialog. Trouble shoot that a bit to make sure it all came through, and you're good to go!

You do need to understand your data structure first if you're going to use pure SLD. And if you want to do all your styling in GeoServer, take a look at the CSS plugin, which makes it really easy, or use the OpenGeo Suite webapp GeoExplorer, which is a basic styling functionality.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.