6

Is it possible to have an sld blend the symbology in the lines together just as QGIS and ArcGIS allow using symbol levels?

In QGIS I can use symbol levels on the line layer and have this appearance:

enter image description here

currently in sld it has this appearance: enter image description here

I was hoping to have the appearance of the individual lines blending together as one. The intent is to apply the sld to a geoserver layer. Currently I am only using rules like the one listed below.

    <Rule>
      <MinScaleDenominator>2500</MinScaleDenominator>
      <MaxScaleDenominator>12500</MaxScaleDenominator>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#ffe14c</CssParameter>
          <CssParameter name="stroke-width">3</CssParameter>
          <CssParameter name="stroke-linejoin">round</CssParameter>
          <CssParameter name="stroke-linecap">round</CssParameter>
        </Stroke>
      </LineSymbolizer>
    </Rule>
5

When stacked symbols are only separated by the <Rule> tags, the order in which they appear on the map is random. You need to separate them using <FeatureTypeStyle> tags. Symbols at the top of the SLD will be drawn first, so for your road example you should put the road casing first followed by the road fill. E.g.

<FeatureTypeStyle>
 <Rule>
 <Name>Road casing</Name>
  <MinScaleDenominator>2500</MinScaleDenominator>
  <MaxScaleDenominator>12500</MaxScaleDenominator>
  <LineSymbolizer>
    <Stroke>
      <CssParameter name="stroke">#000000</CssParameter>
      <CssParameter name="stroke-width">5</CssParameter>
      <CssParameter name="stroke-linejoin">round</CssParameter>
      <CssParameter name="stroke-linecap">round</CssParameter>
    </Stroke>
  </LineSymbolizer>
 </Rule>
</FeatureTypeStyle>

<FeatureTypeStyle>
 <Rule>
 <Name>Road fill</Name>
  <MinScaleDenominator>2500</MinScaleDenominator>
  <MaxScaleDenominator>12500</MaxScaleDenominator>
  <LineSymbolizer>
    <Stroke>
      <CssParameter name="stroke">#ffe14c</CssParameter>
      <CssParameter name="stroke-width">3</CssParameter>
      <CssParameter name="stroke-linejoin">round</CssParameter>
      <CssParameter name="stroke-linecap">round</CssParameter>
    </Stroke>
  </LineSymbolizer>
 </Rule>
</FeatureTypeStyle>

Check out our Ordnance Survey SLD's for some examples

They can get quite long and complex with multiple rules!

2

Well that was easy...My issue was I had my line and casing grouped in the FeatureTypeStyle.

The fix was to group the rules for the road in one FeatureTypeStyle and the casing in another. See below:

  <FeatureTypeStyle>
    <Rule>
      <MinScaleDenominator>50000</MinScaleDenominator>
      <MaxScaleDenominator>140000</MaxScaleDenominator>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#000000</CssParameter>
          <CssParameter name="stroke-width">6</CssParameter>
          <CssParameter name="stroke-linejoin">round</CssParameter>
          <CssParameter name="stroke-linecap">round</CssParameter>
        </Stroke>
      </LineSymbolizer>
    </Rule>
    <Rule>
      <MinScaleDenominator>12500</MinScaleDenominator>
      <MaxScaleDenominator>50000</MaxScaleDenominator>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#000000</CssParameter>
          <CssParameter name="stroke-width">8</CssParameter>
          <CssParameter name="stroke-linejoin">round</CssParameter>
          <CssParameter name="stroke-linecap">round</CssParameter>
        </Stroke>
      </LineSymbolizer>
    </Rule>
    <Rule>
      <MinScaleDenominator>5000</MinScaleDenominator>
      <MaxScaleDenominator>12500</MaxScaleDenominator>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#000000</CssParameter>
          <CssParameter name="stroke-width">11</CssParameter>
          <CssParameter name="stroke-linejoin">round</CssParameter>
          <CssParameter name="stroke-linecap">round</CssParameter>
        </Stroke>
      </LineSymbolizer>
    </Rule>
    <Rule>
      <MaxScaleDenominator>5000</MaxScaleDenominator>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#000000</CssParameter>
          <CssParameter name="stroke-width">14</CssParameter>
          <CssParameter name="stroke-linejoin">round</CssParameter>
          <CssParameter name="stroke-linecap">round</CssParameter>
        </Stroke>
      </LineSymbolizer>
    </Rule>
  </FeatureTypeStyle>
  <!-- end of motorway casing -->
  <!-- start of motorway -->
  <FeatureTypeStyle>
    <Rule>
      <MinScaleDenominator>6500000</MinScaleDenominator>
      <MaxScaleDenominator>25000000</MaxScaleDenominator>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#73452e</CssParameter>
          <CssParameter name="stroke-width">1</CssParameter>
          <CssParameter name="stroke-linejoin">round</CssParameter>
          <CssParameter name="stroke-linecap">round</CssParameter>
        </Stroke>
      </LineSymbolizer>
    </Rule>
    <Rule>
      <MinScaleDenominator>3000000</MinScaleDenominator>
      <MaxScaleDenominator>6500000</MaxScaleDenominator>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#d96d6d</CssParameter>
          <CssParameter name="stroke-width">1</CssParameter>
          <CssParameter name="stroke-linejoin">round</CssParameter>
          <CssParameter name="stroke-linecap">round</CssParameter>
        </Stroke>
      </LineSymbolizer>
    </Rule>
    <Rule>
      <MinScaleDenominator>1500000</MinScaleDenominator>
      <MaxScaleDenominator>3000000</MaxScaleDenominator>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#d94c4c</CssParameter>
          <CssParameter name="stroke-width">4</CssParameter>
          <CssParameter name="stroke-linejoin">round</CssParameter>
          <CssParameter name="stroke-linecap">round</CssParameter>
        </Stroke>
      </LineSymbolizer>
    </Rule>
    <Rule>
      <MinScaleDenominator>750000</MinScaleDenominator>
      <MaxScaleDenominator>1500000</MaxScaleDenominator>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#d94c4c</CssParameter>
          <CssParameter name="stroke-width">5</CssParameter>
          <CssParameter name="stroke-linejoin">round</CssParameter>
          <CssParameter name="stroke-linecap">round</CssParameter>
        </Stroke>
      </LineSymbolizer>
    </Rule>
    <Rule>
      <MinScaleDenominator>50000</MinScaleDenominator>
      <MaxScaleDenominator>750000</MaxScaleDenominator>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#e55050</CssParameter>
          <CssParameter name="stroke-width">4</CssParameter>
          <CssParameter name="stroke-linejoin">round</CssParameter>
          <CssParameter name="stroke-linecap">round</CssParameter>
        </Stroke>
      </LineSymbolizer>
    </Rule>
    <Rule>
      <MinScaleDenominator>12500</MinScaleDenominator>
      <MaxScaleDenominator>50000</MaxScaleDenominator>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#e55050</CssParameter>
          <CssParameter name="stroke-width">5</CssParameter>
          <CssParameter name="stroke-linejoin">round</CssParameter>
          <CssParameter name="stroke-linecap">round</CssParameter>
        </Stroke>
      </LineSymbolizer>
    </Rule>
    <Rule>
      <MinScaleDenominator>2500</MinScaleDenominator>
      <MaxScaleDenominator>12500</MaxScaleDenominator>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#e55050</CssParameter>
          <CssParameter name="stroke-width">7</CssParameter>
          <CssParameter name="stroke-linejoin">round</CssParameter>
          <CssParameter name="stroke-linecap">round</CssParameter>
        </Stroke>
      </LineSymbolizer>
    </Rule>
    <Rule>
      <MaxScaleDenominator>2500</MaxScaleDenominator>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#e55050</CssParameter>
          <CssParameter name="stroke-width">10</CssParameter>
          <CssParameter name="stroke-linejoin">round</CssParameter>
          <CssParameter name="stroke-linecap">round</CssParameter>
        </Stroke>
      </LineSymbolizer>
    </Rule>
  </FeatureTypeStyle>
    <!-- end of motorway -->
    <!-- start of motorway centerline -->
  <FeatureTypeStyle>
    <Rule>
      <MinScaleDenominator>1500000</MinScaleDenominator>
      <MaxScaleDenominator>3000000</MaxScaleDenominator>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#fae57d</CssParameter>
          <CssParameter name="stroke-width">1</CssParameter>
          <CssParameter name="stroke-linejoin">round</CssParameter>
          <CssParameter name="stroke-linecap">round</CssParameter>
        </Stroke>
      </LineSymbolizer>
    </Rule>
    <Rule>
      <MinScaleDenominator>750000</MinScaleDenominator>
      <MaxScaleDenominator>1500000</MaxScaleDenominator>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#fae57d</CssParameter>
          <CssParameter name="stroke-width">1.5</CssParameter>
          <CssParameter name="stroke-linejoin">round</CssParameter>
          <CssParameter name="stroke-linecap">round</CssParameter>
        </Stroke>
      </LineSymbolizer>
    </Rule>
    <Rule>
      <MinScaleDenominator>50000</MinScaleDenominator>
      <MaxScaleDenominator>750000</MaxScaleDenominator>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#ffe14c</CssParameter>
          <CssParameter name="stroke-width">1</CssParameter>
          <CssParameter name="stroke-linejoin">round</CssParameter>
          <CssParameter name="stroke-linecap">round</CssParameter>
        </Stroke>
      </LineSymbolizer>
    </Rule>
    <Rule>
      <MinScaleDenominator>12500</MinScaleDenominator>
      <MaxScaleDenominator>50000</MaxScaleDenominator>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#ffe14c</CssParameter>
          <CssParameter name="stroke-width">2</CssParameter>
          <CssParameter name="stroke-linejoin">round</CssParameter>
          <CssParameter name="stroke-linecap">round</CssParameter>
        </Stroke>
      </LineSymbolizer>
    </Rule>
    <Rule>
      <MinScaleDenominator>2500</MinScaleDenominator>
      <MaxScaleDenominator>12500</MaxScaleDenominator>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#ffe14c</CssParameter>
          <CssParameter name="stroke-width">3</CssParameter>
          <CssParameter name="stroke-linejoin">round</CssParameter>
          <CssParameter name="stroke-linecap">round</CssParameter>
        </Stroke>
      </LineSymbolizer>
    </Rule>
    <Rule>
      <MaxScaleDenominator>2500</MaxScaleDenominator>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#ffe14c</CssParameter>
          <CssParameter name="stroke-width">4</CssParameter>
          <CssParameter name="stroke-linejoin">round</CssParameter>
          <CssParameter name="stroke-linecap">round</CssParameter>
        </Stroke>
      </LineSymbolizer>
    </Rule>
  </FeatureTypeStyle>
  <!-- end of motorway -->
1

Just change the 'strike-linecap' of casing lines to 'butt' in order to disappear them at the start and end of line segments as follow:

<FeatureTypeStyle>
 <Rule>
 <Name>Casing</Name>
  <MinScaleDenominator>2500</MinScaleDenominator>
  <MaxScaleDenominator>12500</MaxScaleDenominator>
  <LineSymbolizer>
    <Stroke>
      <CssParameter name="stroke">#000000</CssParameter>
      <CssParameter name="stroke-width">5</CssParameter>
      <CssParameter name="stroke-linejoin">round</CssParameter>
      <CssParameter name="stroke-linecap">butt</CssParameter>
    </Stroke>
  </LineSymbolizer>
 </Rule>
</FeatureTypeStyle>

<FeatureTypeStyle>
 <Rule>
 <Name>Fill</Name>
  <MinScaleDenominator>2500</MinScaleDenominator>
  <MaxScaleDenominator>12500</MaxScaleDenominator>
  <LineSymbolizer>
    <Stroke>
      <CssParameter name="stroke">#ffe14c</CssParameter>
      <CssParameter name="stroke-width">3</CssParameter>
      <CssParameter name="stroke-linejoin">round</CssParameter>
      <CssParameter name="stroke-linecap">round</CssParameter>
    </Stroke>
  </LineSymbolizer>
 </Rule>
</FeatureTypeStyle>

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.