1

I'm building a small webapp to adjust georeference on Geotiff files using geoserver wps and SLD.

The idea comes from this post. Geoserver: Georectification via SLD fails

I have test the process using the WPS request builder and the process ends with success. Here is the xml file:

<?xml version="1.0" encoding="UTF-8"?><wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
  <ows:Identifier>gs:GeorectifyCoverage</ows:Identifier>
  <wps:DataInputs>
    <wps:Input>
      <ows:Identifier>data</ows:Identifier>
      <wps:Reference mimeType="image/tiff" xlink:href="http://geoserver/wcs" method="POST">
        <wps:Body>
          <wcs:GetCoverage service="WCS" version="1.1.1">
            <ows:Identifier>massimo:66</ows:Identifier>
            <wcs:DomainSubset>
              <ows:BoundingBox crs="http://www.opengis.net/gml/srs/epsg.xml#4326">
                <ows:LowerCorner>1.50163651697 41.3801721851</ows:LowerCorner>
                <ows:UpperCorner>1.50245631346 41.380726914</ows:UpperCorner>
              </ows:BoundingBox>
            </wcs:DomainSubset>
            <wcs:Output format="image/tiff"/>
          </wcs:GetCoverage>
        </wps:Body>
      </wps:Reference>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>gcp</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>[14, 133] [1.5015810519509158, 41.38069860394026] [125, 83] [1.5017486900143464,  41.38074388634669] [243, 70] [1.501939126854404,  41.38078011224911]</wps:LiteralData>
      </wps:Data>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>targetCRS</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>EPSG:4326</wps:LiteralData>
      </wps:Data>
    </wps:Input>
  </wps:DataInputs>
  <wps:ResponseForm>
    <wps:ResponseDocument>
      <wps:Output mimeType="image/tiff">
        <ows:Identifier>result</ows:Identifier>
      </wps:Output>
    </wps:ResponseDocument>
  </wps:ResponseForm>
</wps:Execute>

and the picture I apply the transformation to :

enter image description here

I have made the following style :

 <?xml version="1.0" encoding="UTF-8"?>
    <StyledLayerDescriptor 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" xsi:schemaLocation="http://www.opengis.net/sld
    http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd" version="1.0.0">
      <NamedLayer>
            <Name>GeorectifyCoverage</Name>
            <UserStyle>
                <Title>Georectify Coverage</Title>
                <Abstract>Warps image to specified GCP</Abstract>
                <FeatureTypeStyle>
                    <Transformation>
                        <ogc:Function name="gs:GeorectifyCoverage">
                            <ogc:Function name="parameter">
                                <ogc:Literal>data</ogc:Literal>
                            </ogc:Function>
                            <ogc:Function name="parameter">
                                <ogc:Literal>gcp</ogc:Literal>
                                        <ogc:Literal>[14, 133] [1.5015810519509158, 41.38069860394026] [125, 83] [1.5017486900143464, 
41.38074388634669] [243, 70] [1.501939126854404, 
41.38078011224911]</ogc:Literal>
                            </ogc:Function>
                            <ogc:Function name="parameter">
                                <ogc:Literal>targetCRS</ogc:Literal>

                                        <ogc:Literal>EPSG:4326</ogc:Literal>

                            </ogc:Function>   
                        </ogc:Function>
                    </Transformation>
                    <Rule>
                        <RasterSymbolizer>
                            <Opacity>1.0</Opacity>
                        </RasterSymbolizer>
                    </Rule>
                </FeatureTypeStyle>
            </UserStyle>
        </NamedLayer>
    </StyledLayerDescriptor>

I've tried both: - pass the params using "Variable substitution in SLD" in javascript
- use gs:GeorectifyCoverage from a style with hard coded params(like in the code snippet).

The getMap request always return the exception: "Error rendering coverage on the fast path java.lang.NullPointerException".

What can be wrong? Does anyone have working example ?

I tested this on geoServer 2.10.1 on docker container and geoServer 2.9.2 on Ubuntu 16.10.

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.