2

Is it possible to make SLD style for Geoserver maps to represent street that has 3 tracks (or more) with something like this

enter image description here

I know that it is possible to make single dashed line ------ so the street will apear to have 2 tracks, but I was unable to make double dashed or triple dashed line. I just need to represent each track on street.

I think it might be possible with using custom shape along with textsymbolizer and then making it appear as double dashed line, but I cannot use that because of all vendor options for displacement cause I will have street name, street direction etc. also with textsymbolizer.... I was wondering is it possbile with some line displacement or something similar?

Thx :)

1

This is not an answer but a suggestion for anytime you're making an SLD. I find that creating the SLD in qGIS and then importing it into GeoServer to be a lot easier/quicker than creating it through the XML or style builder. Check out (http://www.camptocamp.com/actualite/qgis-and-geoserver-creating-styles/) for more information.

It would be good for more people to know about qGIS's ability to create SLD files.

1

Thanks to @Branco suggestion, I investigated qGIS and I used it's style editor to create my road style. What is interesting is that when I exported style to SLD it generated this PerpendicularOffset tag for LineSymbolizer ... I never knew that tag exists... and this is the solution

<se:LineSymbolizer>
        <se:Stroke>
          <se:SvgParameter name="stroke">#ffffff</se:SvgParameter>
          <se:SvgParameter name="stroke-width">0.53</se:SvgParameter>
          <se:SvgParameter name="stroke-linejoin">round</se:SvgParameter>
          <se:SvgParameter name="stroke-linecap">round</se:SvgParameter>
          <se:SvgParameter name="stroke-dasharray">1 2</se:SvgParameter>
        </se:Stroke>
        <se:PerpendicularOffset>0.8</se:PerpendicularOffset>
      </se:LineSymbolizer>
      <se:LineSymbolizer>
        <se:Stroke>
          <se:SvgParameter name="stroke">#ffffff</se:SvgParameter>
          <se:SvgParameter name="stroke-width">0.53</se:SvgParameter>
          <se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>
          <se:SvgParameter name="stroke-linecap">square</se:SvgParameter>
          <se:SvgParameter name="stroke-dasharray">1 2</se:SvgParameter>
        </se:Stroke>
        <se:PerpendicularOffset>-0.8</se:PerpendicularOffset>
      </se:LineSymbolizer>
0

This is an extension of the usual way of drawing cased roads, first draw a wide black line (say 5px) then draw a grey line (4px wide) and then a dashed white line (3px wide) and then a grey line (2px) wide.

This will be quiet slow but GeoServer will try to cache as many of the features as it can so it shouldn't be too bad but don't turn this on a full map scale.

  • Thanks for this.... It is great answer for drawing street with 3 tracks, but if I wanted street with 4 tracks or more, the number of line drawing (on top of each other) would expand exponentially. But I will test it. Thanks again. – tibortru Jun 24 '14 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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