3

I had 2 layers:

custom:Temperature: Point layer.
custom:Region: Polygon layer.

I would like to perform a gs:CropCoverage of the Raster Layer which is the result of gs:BarnesSurface of vector layer 'custom:Temperature' against the FeatureCollection collected from the vector layer 'custom:Region'.

Process Chain

The SLD file is below:

    <?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>CropCoverage</Name>
        <UserStyle>
          <Title>Crop Coverage</Title>
          <FeatureTypeStyle>
            <Transformation>
              <ogc:Function name="gs:CropCoverage"> <!-- crop coverage -->
                <ogc:Function name="parameter">
                  <ogc:Literal>coverage</ogc:Literal>

                  <ogc:Function name="gs:BarnesSurface"> <!-- barnes surface -->
                    <ogc:Function name="parameter">
                      <ogc:Literal>data</ogc:Literal>   <!-- parameter data: should be the layer custom:Temperature -->
                    </ogc:Function>
                    <ogc:Function name="parameter">
                      <ogc:Literal>valueAttr</ogc:Literal>
                      <ogc:Literal>TEMP</ogc:Literal>
                    </ogc:Function>
                    <ogc:Function name="parameter">
                      <ogc:Literal>dataLimit</ogc:Literal>
                      <ogc:Literal>2000</ogc:Literal>
                    </ogc:Function>
                    <ogc:Function name="parameter">
                      <ogc:Literal>scale</ogc:Literal>
                      <ogc:Literal>0.05</ogc:Literal>
                    </ogc:Function>
                    <ogc:Function name="parameter">
                      <ogc:Literal>convergence</ogc:Literal>
                      <ogc:Literal>0.2</ogc:Literal>
                    </ogc:Function>
                    <ogc:Function name="parameter">
                      <ogc:Literal>passes</ogc:Literal>
                      <ogc:Literal>3</ogc:Literal>
                    </ogc:Function>
                    <ogc:Function name="parameter">
                      <ogc:Literal>minObservations</ogc:Literal>
                      <ogc:Literal>0.1</ogc:Literal>
                    </ogc:Function>
                    <ogc:Function name="parameter">
                      <ogc:Literal>maxObservationDistance</ogc:Literal>
                      <ogc:Literal>1</ogc:Literal>
                    </ogc:Function>
                    <ogc:Function name="parameter">
                      <ogc:Literal>pixelsPerCell</ogc:Literal>
                      <ogc:Literal>4</ogc:Literal>
                    </ogc:Function>
                    <ogc:Function name="parameter">
                      <ogc:Literal>outputBBOX</ogc:Literal>
                      <ogc:Function name="env">
                        <ogc:Literal>wms_bbox</ogc:Literal>
                      </ogc:Function>
                    </ogc:Function>
                    <ogc:Function name="parameter">
                      <ogc:Literal>outputWidth</ogc:Literal>
                      <ogc:Function name="env">
                        <ogc:Literal>wms_width</ogc:Literal>
                      </ogc:Function>
                    </ogc:Function>
                    <ogc:Function name="parameter">
                      <ogc:Literal>outputHeight</ogc:Literal>
                      <ogc:Function name="env">
                        <ogc:Literal>wms_height</ogc:Literal>
                      </ogc:Function>
                    </ogc:Function>
                    <ogc:Function name="parameter">
                      <ogc:Literal>queryBuffer</ogc:Literal>
                      <ogc:Literal>0.5</ogc:Literal>
                    </ogc:Function>
                  </ogc:Function> <!-- end of barnes surface -->

                </ogc:Function>

                <ogc:Function name="parameter">
                  <ogc:Literal>cropShape</ogc:Literal>
                  <ogc:Function name="gs:CollectGeometries"> <!-- collect geometries -->
                    <ogc:Function name="parameter">
                      <ogc:Literal>features</ogc:Literal> <!-- parameter features: should be layer custom:Region -->
                    </ogc:Function>
                  </ogc:Function> <!-- end of collect geometries -->
                </ogc:Function>
              </ogc:Function>
            </Transformation>
            <Rule>
              <Name>rule1</Name>
              <RasterSymbolizer>
                <Geometry>
                  <ogc:PropertyName>STATION_GEOMETRY</ogc:PropertyName>
                </Geometry>
                <ColorMap type="ramp">
                  <ColorMapEntry color="#000084" quantity="-40" label="label" opacity="0"/>
                  <ColorMapEntry color="#0000f1" quantity="-32" label="values" opacity="1"/>
                  <ColorMapEntry color="#004dff" quantity="-24" label="label" opacity="1"/>
                  <ColorMapEntry color="#00b1ff" quantity="-16" label="label" opacity="1"/>
                  <ColorMapEntry color="#29ffce" quantity="-8" label="label" opacity="1"/>
                  <ColorMapEntry color="#7aff7d" quantity="0" label="label" opacity="0"/>
                  <ColorMapEntry color="#ceff29" quantity="8" label="values" opacity="1"/>
                  <ColorMapEntry color="#ffc400" quantity="16" label="label" opacity="1"/>
                  <ColorMapEntry color="#ff6800" quantity="24" label="label" opacity="1"/>
                </ColorMap>
              </RasterSymbolizer>
            </Rule>
          </FeatureTypeStyle>
        </UserStyle>
      </NamedLayer>
    </StyledLayerDescriptor>

The data of gs:BarnesSurface should be layer 'custom:Temperature' and feature of gs:CollectGeometries should be layer 'custom:Region'.

How should i set 'data' and 'feature' when i request wms with the SLD above?

.../wms?layers=custom:Temperature,custom:Region&style=CropCoverage&... ?
  • well, not a full answer yet, but there is no real parameter "data", this is an implied parameter and is going to take the data from whatever layer this style is applied to. However, I don't know how to specify the features parameter properly – chrismarx Oct 17 '14 at 14:43
  • 1
    specifying a static geometry worked for me, an example sld is here - osgeo-org.1560.x6.nabble.com/… – chrismarx Oct 17 '14 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.