Geographic Information Systems Asked on February 17, 2021
I have GeoServer with raster (GeoTIFF) of the temperature parameter.
Using SLD styles and bicubic interpolation I get nice map and now I’m trying to create a style that show the isolines.
The isoline are displayed but the result is not what I expect. In fact while zooming in the lines become "straight"
My current SLD is:
<?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">
<!-- a Named Layer is the basic building block of an SLD document -->
<NamedLayer>
<Name>Temperature Isoline</Name>
<UserStyle>
<!-- Styles can have names, titles and abstracts -->
<Title>Default Line</Title>
<!-- FeatureTypeStyles describe how to render different features -->
<!-- A FeatureTypeStyle for rendering lines -->
<FeatureTypeStyle>
<Transformation>
<ogc:Function name="gs:Contour">
<ogc:Function name="parameter">
<ogc:Literal>data</ogc:Literal>
</ogc:Function>
<ogc:Function name="parameter">
<ogc:Literal>levels</ogc:Literal>
<ogc:Literal>-50</ogc:Literal>
<ogc:Literal>-45</ogc:Literal>
<ogc:Literal>-30</ogc:Literal>
<ogc:Literal>-25</ogc:Literal>
<ogc:Literal>-20</ogc:Literal>
<ogc:Literal>-15</ogc:Literal>
<ogc:Literal>-10</ogc:Literal>
<ogc:Literal>-5</ogc:Literal>
<ogc:Literal>0</ogc:Literal>
<ogc:Literal>5</ogc:Literal>
<ogc:Literal>10</ogc:Literal>
<ogc:Literal>15</ogc:Literal>
<ogc:Literal>20</ogc:Literal>
<ogc:Literal>25</ogc:Literal>
<ogc:Literal>30</ogc:Literal>
<ogc:Literal>35</ogc:Literal>
<ogc:Literal>40</ogc:Literal>
<ogc:Literal>45</ogc:Literal>
<ogc:Literal>50</ogc:Literal>
<ogc:Literal>60</ogc:Literal>
<ogc:Literal>70</ogc:Literal>
<ogc:Literal>80</ogc:Literal>
<ogc:Literal>90</ogc:Literal>
<ogc:Literal>100</ogc:Literal>
</ogc:Function>
</ogc:Function>
</Transformation>
<Rule>
<Name>rule1</Name>
<Title>Blue Line</Title>
<Abstract>A solid blue line with a 1 pixel width</Abstract>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke">#0000FF</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</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>
</LinePlacement>
</LabelPlacement>
<Halo>
<Radius>
<ogc:Literal>2</ogc:Literal>
</Radius>
<Fill>
<CssParameter name="fill">#FFFFFF</CssParameter>
<CssParameter name="fill-opacity">0.85</CssParameter>
</Fill>
</Halo>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
<VendorOption name="followLine">true</VendorOption>
<VendorOption name="repeat">200</VendorOption>
<VendorOption name="maxDisplacement">50</VendorOption>
<VendorOption name="maxAngleDelta">30</VendorOption>
<VendorOption name="group">no</VendorOption>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
What can I do?
I Finally found a solution. It was easier than I thought I had to add the <ogc:Function name="Interpolate"> in the .
My SDL:
<?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">
<!-- a Named Layer is the basic building block of an SLD document -->
<NamedLayer>
<Name>default_line</Name>
<UserStyle>
<!-- Styles can have names, titles and abstracts -->
<Title>Default Line</Title>
<Abstract>A sample style that draws a line</Abstract>
<!-- FeatureTypeStyles describe how to render different features -->
<!-- A FeatureTypeStyle for rendering lines -->
<FeatureTypeStyle>
<Transformation>
<ogc:Function name="gs:Contour">
<ogc:Function name="parameter">
<ogc:Literal>data</ogc:Literal>
</ogc:Function>
<ogc:Function name="parameter">
<ogc:Literal>smooth</ogc:Literal>
<ogc:Literal>true</ogc:Literal>
</ogc:Function>
<ogc:Function name="parameter">
<ogc:Literal>levels</ogc:Literal>
<ogc:Literal>-50</ogc:Literal>
<ogc:Literal>-45</ogc:Literal>
<ogc:Literal>-30</ogc:Literal>
<ogc:Literal>-25</ogc:Literal>
<ogc:Literal>-20</ogc:Literal>
<ogc:Literal>-15</ogc:Literal>
<ogc:Literal>-10</ogc:Literal>
<ogc:Literal>-5</ogc:Literal>
<ogc:Literal>0</ogc:Literal>
<ogc:Literal>5</ogc:Literal>
<ogc:Literal>10</ogc:Literal>
<ogc:Literal>15</ogc:Literal>
<ogc:Literal>20</ogc:Literal>
<ogc:Literal>25</ogc:Literal>
<ogc:Literal>30</ogc:Literal>
<ogc:Literal>35</ogc:Literal>
<ogc:Literal>40</ogc:Literal>
<ogc:Literal>45</ogc:Literal>
<ogc:Literal>50</ogc:Literal>
<ogc:Literal>60</ogc:Literal>
<ogc:Literal>70</ogc:Literal>
<ogc:Literal>80</ogc:Literal>
<ogc:Literal>90</ogc:Literal>
<ogc:Literal>100</ogc:Literal>
</ogc:Function>
</ogc:Function>
</Transformation>
<Rule>
<Name>rule1</Name>
<Title>Blue Line</Title>
<Abstract>A solid blue line with a 1 pixel width</Abstract>
<LineSymbolizer>
<Stroke>
<ogc:Function name="Interpolate">
<CssParameter name="stroke">#0000FF</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
<ogc:Literal>cosine</ogc:Literal>
<!-- Interpolation mode - defaults to linear -->
</ogc:Function>
</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></LinePlacement>
</LabelPlacement>
<Halo>
<Radius>
<ogc:Literal>2</ogc:Literal>
</Radius>
<Fill>
<CssParameter name="fill">#FFFFFF</CssParameter>
<CssParameter name="fill-opacity">0.85</CssParameter>
</Fill>
</Halo>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
<VendorOption name="followLine">true</VendorOption>
<VendorOption name="repeat">200</VendorOption>
<VendorOption name="maxDisplacement">50</VendorOption>
<VendorOption name="maxAngleDelta">30</VendorOption>
<VendorOption name="group">no</VendorOption>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
Correct answer by Davide Raro on February 17, 2021
The isolines extraction just follows the shape of the pixels... the raster map is low resolution, you're displaying it as a smooth map by enabling bicubic interpolation (so you're making up an appearance, but the data is not really there).
But the contour extraction process does not interpolate, uses the data as is. Try enabling smoothing, it might help with the visual appearance:
<ogc:Function name="parameter">
<ogc:Literal>smooth</ogc:Literal>
<ogc:Literal>true</ogc:Literal>
</ogc:Function>
That said, if pixels are that big, a smoothed out output is nice looking, but also just a lie, you're trying to display data you don't really have. If the output has any scientific value, I would suggest disabling countour lines display before you reach the zoom level where "blocky" output begins to show.
Answered by Andrea Aime on February 17, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP