Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Situation

I have a raster image and the coordinates of its four corner pixels. My goal is to warp the image with respect to this coordinates ("georectify") on the fly when requested via GeoServer to display in OpenLayers.

Inspired by this discussion list, my idea was to do the following in GeoServer:

  1. Create a WorldImage layer (raster + text file with geodata)
  2. Create a Styled Layer Descriptor (SLD) calling the Web Processing Service (WPS) GeorectifyCoverage which "georectifies a raster via Ground Control Points using gdal_warp".
  3. Apply the SLD to the layer.

Problem

When I request the layer for example via the OpenLayers preview, it throws an error reporting:

Could not convert the value EPSG:32632 into the expected type interface
org.opengis.referencing.crs.CoordinateReferenceSystem for parameter targetCRS

Oddly enough, when I use the "WPS request builder" (in the GeoServer Web Application) to call GeorectifyCoverage with the same parameters, it gives the right output. So the error must originate somewhere from my SLD document below.

Can anybody give me a clue what might be wrong with it?


Additional Info

SLD document calling WPS rendering transformation GeorectifyCoverage:

<?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>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>[[[0, 0], [308639.500, 5154180.500]], [[0, 450], [308639.500, 5150929.500]], [[600, 0], [315730.500, 5154180.500]], [[600, 450], [315730.500, 5150929.500]]]</ogc:Literal>
                        </ogc:Function>
                        <ogc:Function name="parameter">
                            <ogc:Literal>targetCRS</ogc:Literal>
                            <ogc:Literal>EPSG:32632</ogc:Literal>
                        </ogc:Function>   
                    </ogc:Function>
                </Transformation>
                <Rule>
                    <RasterSymbolizer>
                        <Opacity>1.0</Opacity>
                    </RasterSymbolizer>
                </Rule>
            </FeatureTypeStyle>
        </UserStyle>
    </NamedLayer>
</StyledLayerDescriptor>

where GeorectifyCoverage requires the following input:

  • data: input raster (my layer name)
  • gcp: List of Ground control points (my corner coordinates)
  • targetCRS: system to use for the output raster (my CRS corresponding to the GCP)

Notes:

  • When I call a different WPS function like Contour using the same document structure and raster image it works perfectly.
  • When I change EPSG:32632 to EPSG:4326 the same error is reported.
  • Changing the raster format (jpeg, TIFF) does not helo.
  • Processing the same data offline with the command line tools gdal_translate (assign GCPs) and gdalwarp results in the desired output.

My System:

  • Ubuntu 12.04
  • OpenGeo Suite 3.0.2
  • GeoServer 2.2

Alternative approaches using OpenGeo would also be welcome.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

I asked the same on the GeoServer User mailing list and the GeoSolutions founder Simone Giannecchini himself suggested me the following workaround:

Instead of specifying the input parameter targetCRS as a <ogc:Literal>, one could pass it to the function via a WMS request. This can be achieved using Variable substitution in SLD, i.e., defining targetCRS in the SLD (here called georectify) as a env request parameter (here wms_crs)

<ogc:Function name="parameter">
    <ogc:Literal>targetCRS</ogc:Literal>
        <ogc:Function name="env">
            <ogc:Literal>wms_crs</ogc:Literal>
        </ogc:Function>
</ogc:Function>

and then pass down the actual value (EPSG:32632) through a WMS request like in

.../wms?LAYERS=myworkspace:mylayer&STYLES:georectify&ENV=wms_crs:EPSG:32632&...

We tried that out and it worked.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.