Geographic Information Systems Asked on August 6, 2021
I’ve used SLD to style two type of roads with the border in GeoServer.
How can I remove the border of a road when another road or street connects to it?
As shown in the image, when roads are in the same layer they are good in conjunction (2) but, roads in different layers are drawn as (1).
This is the simplified code I’m using for styles:
<!--First layer-->
<se:FeatureTypeStyle>
<se:Rule>
<se:Name>Motorway</se:Name>
<se:Description>
<se:Title>Motorway</se:Title>
</se:Description>
<se:LineSymbolizer>
<se:Stroke>
<se:SvgParameter name="stroke">#94622F</se:SvgParameter>
<se:SvgParameter name="stroke-width">12</se:SvgParameter>
<se:SvgParameter name="stroke-linejoin">round</se:SvgParameter>
<se:SvgParameter name="stroke-linecap">round</se:SvgParameter>
</se:Stroke>
</se:LineSymbolizer>
</se:Rule>
</se:FeatureTypeStyle>
<se:FeatureTypeStyle>
<se:Rule>
<se:Name>Motorway</se:Name>
<se:Description>
<se:Title>Motorway</se:Title>
</se:Description>
<se:LineSymbolizer>
<se:Stroke>
<se:SvgParameter name="stroke">#F8C967</se:SvgParameter>
<se:SvgParameter name="stroke-width">11</se:SvgParameter>
<se:SvgParameter name="stroke-linejoin">round</se:SvgParameter>
<se:SvgParameter name="stroke-linecap">round</se:SvgParameter>
</se:Stroke>
</se:LineSymbolizer>
</se:Rule>
</se:FeatureTypeStyle>
And the other style:
<!-- Second layer -->
<se:FeatureTypeStyle>
<se:Rule>
<se:Name>Link</se:Name>
<se:Description>
<se:Title>Link</se:Title>
</se:Description>
<se:LineSymbolizer>
<se:Stroke>
<se:SvgParameter name="stroke">#000000</se:SvgParameter>
<se:SvgParameter name="stroke-width">5</se:SvgParameter>
<se:SvgParameter name="stroke-linejoin">round</se:SvgParameter>
<se:SvgParameter name="stroke-linecap">round</se:SvgParameter>
</se:Stroke>
</se:LineSymbolizer>
</se:Rule>
</se:FeatureTypeStyle>
<se:FeatureTypeStyle>
<se:Rule>
<se:Name>Link</se:Name>
<se:Description>
<se:Title>Link</se:Title>
</se:Description>
<se:LineSymbolizer>
<se:Stroke>
<se:SvgParameter name="stroke">#FDFCF8</se:SvgParameter>
<se:SvgParameter name="stroke-width">4</se:SvgParameter>
<se:SvgParameter name="stroke-linejoin">round</se:SvgParameter>
<se:SvgParameter name="stroke-linecap">round</se:SvgParameter>
</se:Stroke>
</se:LineSymbolizer>
</se:Rule>
</se:FeatureTypeStyle>
The usual way to fix this is to draw all of the casings and then draw the road centres in reverse order of importance.
For example this OS road style:
<sld:FeatureTypeStyle>
<sld:Name>name</sld:Name>
<sld:Rule>
<sld:Name>Primary Level 1 Case</sld:Name>
<ogc:Filter>
<ogc:And>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>level</ogc:PropertyName>
<ogc:Literal>1</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>Primary</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:And>
</ogc:Filter>
<sld:MinScaleDenominator>1.0</sld:MinScaleDenominator>
<sld:MaxScaleDenominator>40000.0</sld:MaxScaleDenominator>
<sld:LineSymbolizer uom="http://www.opengeospatial.org/se/units/metre">
<sld:Stroke>
<sld:CssParameter name="stroke">#ebebe0</sld:CssParameter>
<sld:CssParameter name="stroke-linejoin">round</sld:CssParameter>
<sld:CssParameter name="stroke-width">21.5</sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
<sld:FeatureTypeStyle>
<sld:Name>name</sld:Name>
<sld:Rule>
<sld:Name>Motorway Level 1 Case</sld:Name>
<ogc:Filter>
<ogc:And>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>level</ogc:PropertyName>
<ogc:Literal>1</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>Motorway</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:And>
</ogc:Filter>
<sld:MinScaleDenominator>1.0</sld:MinScaleDenominator>
<sld:MaxScaleDenominator>40000.0</sld:MaxScaleDenominator>
<sld:LineSymbolizer uom="http://www.opengeospatial.org/se/units/metre">
<sld:Stroke>
<sld:CssParameter name="stroke">#ebebe0</sld:CssParameter>
<sld:CssParameter name="stroke-linejoin">round</sld:CssParameter>
<sld:CssParameter name="stroke-width">22.5</sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
<sld:FeatureTypeStyle>
<sld:Name>name</sld:Name>
<sld:Rule>
<sld:Name>Primary Level 1 Fills</sld:Name>
<ogc:Filter>
<ogc:And>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>level</ogc:PropertyName>
<ogc:Literal>1</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>Primary</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:And>
</ogc:Filter>
<sld:MinScaleDenominator>1.0</sld:MinScaleDenominator>
<sld:MaxScaleDenominator>40000.0</sld:MaxScaleDenominator>
<sld:LineSymbolizer uom="http://www.opengeospatial.org/se/units/metre">
<sld:Stroke>
<sld:CssParameter name="stroke">#77c776</sld:CssParameter>
<sld:CssParameter name="stroke-linecap">round</sld:CssParameter>
<sld:CssParameter name="stroke-linejoin">round</sld:CssParameter>
<sld:CssParameter name="stroke-width">15.5</sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
<sld:FeatureTypeStyle>
<sld:Name>name</sld:Name>
<sld:Rule>
<sld:Name>Motorway Level 1 Fills</sld:Name>
<ogc:Filter>
<ogc:And>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>level</ogc:PropertyName>
<ogc:Literal>1</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>Motorway</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:And>
</ogc:Filter>
<sld:MinScaleDenominator>1.0</sld:MinScaleDenominator>
<sld:MaxScaleDenominator>40000.0</sld:MaxScaleDenominator>
<sld:LineSymbolizer uom="http://www.opengeospatial.org/se/units/metre">
<sld:Stroke>
<sld:CssParameter name="stroke">#08b8e8</sld:CssParameter>
<sld:CssParameter name="stroke-linecap">round</sld:CssParameter>
<sld:CssParameter name="stroke-linejoin">round</sld:CssParameter>
<sld:CssParameter name="stroke-width">16.5</sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
Correct answer by Ian Turton on August 6, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP