3

I want to draw polygon borders using a pattern of dashes and other symbols like triangles or circles but most polygons share borders so I get an undesired result.

Using this SLD code:

  <se:PolygonSymbolizer>
    <se:Fill>
      <se:SvgParameter name="fill">#cf72be</se:SvgParameter>
    </se:Fill>
  </se:PolygonSymbolizer>
  <se:LineSymbolizer>
    <se:Stroke>
      <se:GraphicStroke>
        <se:Graphic>
          <se:Mark>
            <se:WellKnownName>circle</se:WellKnownName>
            <se:Fill>
              <se:SvgParameter name="fill">#333333</se:SvgParameter>
            </se:Fill>
          </se:Mark>
          <se:Size>6</se:Size>
        </se:Graphic>
      </se:GraphicStroke>
      <se:SvgParameter name="stroke-dasharray">6 18</se:SvgParameter>
    </se:Stroke>
  </se:LineSymbolizer>
  <se:LineSymbolizer>
    <se:Stroke>
      <se:SvgParameter name="stroke">#AA0000</se:SvgParameter>
      <se:SvgParameter name="stroke-dasharray">10 14</se:SvgParameter>
      <se:SvgParameter name="stroke-dashoffset">14</se:SvgParameter>
    </se:Stroke>
  </se:LineSymbolizer>

I get this result in GeoServer:

Styling_polygons

Is there any way to avoid having two overlapping border lines or to make symbols perfectly overlap?

DMS02
  • 607
  • 3
  • 14
  • Most reliable work flow is to convert polygons into linestrings, remove duplicate line segments from the shared borders and use this cleaned linestring dataset for symbolizing the outline. – user30184 Oct 26 '17 at 09:26
  • I was looking for a solution other than what you suggest, but thank you anyway. – DMS02 Oct 27 '17 at 10:30
  • You deal with an old problem and I fear that you can't find a new magic solution. The two other alternatives that I know of are listed in https://gis.stackexchange.com/questions/171182/how-to-make-dashed-lines-between-adjacent-polygons-render-correctly-in-qgis. – user30184 Oct 27 '17 at 10:38

1 Answers1

1

Agree with the other comments, it's a matter of pre-processing the data to extract the linework and remove the duplicates, then paint the linework in a FeatureTypeStyle above the fill one to avoid fill overlapping with the circles in the border.

Now, it would also be possible to do this on the fly in a Rendering Transformation, assuming there are scale dependencies avoiding to load everything into memory. This RT would have to be written of course, if you are interested see: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

Andrea Aime
  • 17,410
  • 1
  • 18
  • 28