1

I deployed a GeoServer instance and I published some raster files (netCDF). I then applied the following style that contains both raster colorMap and lineSymbolyzer to show the isocurves:

<?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>
             <Rule>
                <RasterSymbolizer>
                  <ColorMap>
                    <ColorMapEntry color="#313695" quantity="-40" label="-40&#176;C"/>
                    <ColorMapEntry color="#90c3dd" quantity="-20" label="-20&#176;C" />
                    <ColorMapEntry color="#ffffbf" quantity="0" label="0&#176;C" />
                    <ColorMapEntry color="#f88d52" quantity="20" label="20&#176;C" />
                    <ColorMapEntry color="#a50026" quantity="40" label="40&#176;C" />
                  </ColorMap>
                </RasterSymbolizer>
              </Rule>
          </FeatureTypeStyle>
            <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>-30</ogc:Literal>
                            <ogc:Literal>-10</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>40</ogc:Literal>
                            <ogc:Literal>50</ogc:Literal>
                            <ogc:Literal>60</ogc:Literal>
                        </ogc:Function>
                    </ogc:Function>


                </Transformation>

                <Rule>
                    <Name>rule1</Name>
                    <Title>Black Line</Title>
                    <Abstract>A solid blue line with a 1 pixel width</Abstract>

                    <LineSymbolizer>
                        <Stroke>
                            <ogc:Function name="Interpolate">

                                <CssParameter name="stroke">#000000</CssParameter>
                                <CssParameter name="stroke-linejoin">round</CssParameter>
                                <CssParameter name="stroke-linecap">round</CssParameter>
                                <ogc:Literal>cubic</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>

The preview of layer in Geoserver dashboard is pretty satysfing:

enter image description here

But then I tried to link my geoserver to mapbox that uses only EPSG:3857 projection and it doesn't show the isocurve:

enter image description here

Even editing the style and removing the colorMap section, the isocurves are displayed but not interpolated.

I don't have any clue on how to solve this. Has anyone else experienced this? How can I solve?

NOTE: The images that I have attached are returned by the very same WMS request, the only differences are the srs and bbox parameters

6
  • can you explain what you are trying to do with the interpolate function? I don't think it does what your think it does
    – Ian Turton
    Commented Sep 9, 2022 at 11:17
  • The objective is to display the isocurves in a smoother way, not following the "square" of the raster image. I took the example from an other question gis.stackexchange.com/questions/383505/… Commented Sep 12, 2022 at 9:37
  • That answer is wrong, the interpolate function doesn't do that - see docs.geoserver.org/latest/en/user/filter/… - the only way to avoid your issue is to use smaller pixels or stop contouring at a higher zoom level
    – Ian Turton
    Commented Sep 12, 2022 at 12:50
  • I also can't replicate your lines disappearing in 3857 - can you share the input data?
    – Ian Turton
    Commented Sep 12, 2022 at 13:07
  • You can find the original netcdf here The layer associated to the mentioned style is t2m Commented Sep 22, 2022 at 9:16

0

Browse other questions tagged or ask your own question.