Skip to content

Instantly share code, notes, and snippets.

@fvanderbiest
Last active November 20, 2019 14:41
Show Gist options
  • Save fvanderbiest/9a32361e581eecc8567fa771cde355c8 to your computer and use it in GitHub Desktop.
Save fvanderbiest/9a32361e581eecc8567fa771cde355c8 to your computer and use it in GitHub Desktop.
GeoServer rendering transformation
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NamedLayer>
<Name></Name>
<UserStyle>
<Title>Contour DEM</Title>
<Abstract>Extracts contours from DEM</Abstract>
<FeatureTypeStyle>
<Rule>
<Name>color</Name>
<Title>color</Title>
<RasterSymbolizer>
<ColorMap>
<ColorMapEntry color="#5b9dd3" quantity="-40" />
<ColorMapEntry color="#5792c2" quantity="-30" />
<ColorMapEntry color="#5595bb" quantity="-20" />
<ColorMapEntry color="#5097b3" quantity="-20" />
<ColorMapEntry color="#57a8ab" quantity="-10" />
<ColorMapEntry color="#6b7e82" quantity="0" />
<ColorMapEntry color="#afa906" quantity="10" />
<ColorMapEntry color="#08c601" quantity="20" />
<ColorMapEntry color="#08c601" quantity="30" />
<ColorMapEntry color="#08c601" quantity="40" />
<ColorMapEntry color="#08c601" quantity="50" />
<ColorMapEntry color="#08c601" quantity="60" />
</ColorMap>
</RasterSymbolizer>
</Rule>
</FeatureTypeStyle>
<FeatureTypeStyle>
<Transformation>
<ogc:Function name="ras:Contour">
<ogc:Function name="parameter">
<ogc:Literal>data</ogc:Literal>
</ogc:Function>
<ogc:Function name="parameter">
<ogc:Literal>levels</ogc:Literal>
<ogc:Literal>-40</ogc:Literal>
<ogc:Literal>-30</ogc:Literal>
<ogc:Literal>-20</ogc:Literal>
<ogc:Literal>-10</ogc:Literal>
<ogc:Literal>0</ogc:Literal>
<ogc:Literal>10</ogc:Literal>
<ogc:Literal>20</ogc:Literal>
<ogc:Literal>30</ogc:Literal>
<ogc:Literal>40</ogc:Literal>
<ogc:Literal>50</ogc:Literal>
<ogc:Literal>60</ogc:Literal>
</ogc:Function>
</ogc:Function>
</Transformation>
<Rule>
<Name>contour</Name>
<Title>Contour Line</Title>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke">#000000</CssParameter>
<CssParameter name="stroke-width">1</CssParameter>
</Stroke>
</LineSymbolizer>
<TextSymbolizer>
<Label>
<ogc:PropertyName>value</ogc:PropertyName>
</Label>
<Font>
<CssParameter name="font-family">Arial</CssParameter>
<CssParameter name="font-style">Normal</CssParameter>
<CssParameter name="font-size">10</CssParameter>
</Font>
<LabelPlacement>
<LinePlacement/>
</LabelPlacement>
<Halo>
<Radius>
<ogc:Literal>2</ogc:Literal>
</Radius>
<Fill>
<CssParameter name="fill">#FFFFFF</CssParameter>
<CssParameter name="fill-opacity">0.6</CssParameter>
</Fill>
</Halo>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
<Priority>2000</Priority>
<VendorOption name="followLine">true</VendorOption>
<VendorOption name="repeat">100</VendorOption>
<VendorOption name="maxDisplacement">50</VendorOption>
<VendorOption name="maxAngleDelta">30</VendorOption>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment