I read in Size of points determined by attribute value in SLD in Geoserver, that it is possible to set the size of points via an attribute supplied by the data source as follows:


I want to do the same thing, but using lines, and setting the thickness/width of the lines based on an attribute from the data source. LineSymbolizer does not have the <size> tag that can be found in PointSymbolizer.

Is there a way to use a data source attribute/column to set the width of the line dynamically?

EDIT: Soon after I posted this question, I started testing, and realized that all I had to do was to add a PropertyName tag with the data source column name, inside the CssParameter with the stroke-width name attribute:

<CssParameter name="stroke-width">

I see now that @Ian Turton also suggested it.


1 Answer 1


You need to adjust the <CssParameter name="stroke-width">6</CssParameter> to change the width of your line.

It's always worth having a peruse of the SLD Cookbook to see what can be done or even read the actual documentation for a feature.

  • I understand the standard setting of stroke-width when you know beforehand what that width must be, but when the width can be anything, then I need to set that width dynamically according to a width provided in the data source. Aug 16, 2023 at 13:29
  • so put an `<ogc:PropertyName>" in there as you did in your question
    – Ian Turton
    Aug 16, 2023 at 13:35
  • Is there a way to for example multiply the value from <ogc:PropertyName> with a fixed value x @IanTurton?
    – blabbath
    Apr 5 at 7:58

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.