Reading raster data inputs with wpsr

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Reading raster data inputs with wpsr

julianrosser
Hi all,

I have a problem with the WPSR extension using raster data as inputs. I've been successfully using annotated R scripts with vector inputs, vector outputs and raster outputs. However, passing in an elevation model as a Tiff generates a WPS error. The error seems to be restricted to when reading rasters into R - I can successfully use the same raster data as input into some of the GRASS processes. I have included a simple example annotated R script and the corresponding execute request below which generates this WPS error.

Does anyone know what the problem might be please?

I'm using
Windows 7 64 Bit
Tomcat 7
52n-wps-webapp-3.3.0 With GeoTools
R version 3.1.2, with Rserve running

The WPS error is:
<ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows/1.1" version="1.0.0">
<ows:Exception exceptionCode="NoApplicableCode">
<ows:ExceptionText>
Error while executing the embedded process for: org.n52.wps.server.r.test.return.raster
</ows:ExceptionText>
</ows:Exception>
<ows:Exception exceptionCode="JAVA_StackTrace">
<ows:ExceptionText>
org.n52.wps.server.ExceptionReport: Error while executing the embedded process for: org.n52.wps.server.r.test.return.raster at org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:716) at org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:92) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.RuntimeException: An unsuported IData Class occured for input: class org.n52.wps.io.data.binding.complex.GenericFileDataBinding at org.n52.wps.server.r.workspace.RIOHandler.parseInput(RIOHandler.java:282) at org.n52.wps.server.r.workspace.RWorkspaceManager.loadInputValues(RWorkspaceManager.java:190) at org.n52.wps.server.r.GenericRProcess.run(GenericRProcess.java:184) at org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:685) ... 5 more
</ows:ExceptionText>
</ows:Exception>
<ows:Exception exceptionCode="JAVA_RootCause">
<ows:ExceptionText>
An unsuported IData Class occured for input: class org.n52.wps.io.data.binding.complex.GenericFileDataBinding
</ows:ExceptionText>
<ows:ExceptionText>
java.lang.RuntimeException: An unsuported IData Class occured for input: class org.n52.wps.io.data.binding.complex.GenericFileDataBinding at org.n52.wps.server.r.workspace.RIOHandler.parseInput(RIOHandler.java:282) at org.n52.wps.server.r.workspace.RWorkspaceManager.loadInputValues(RWorkspaceManager.java:190) at org.n52.wps.server.r.GenericRProcess.run(GenericRProcess.java:184) at org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:685) at org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:92) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>






Execute request

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0
  http://schemas.opengis.net/wps/1.0.0/wpsExecute_request.xsd">
  <ows:Identifier>org.n52.wps.server.r.test.return.raster</ows:Identifier>
  <wps:DataInputs>
        <wps:Input>
                        <ows:Identifier xmlns:ns1="http://www.opengis.net/ows/1.1">dem</ows:Identifier>
                                <wps:Reference xlink:href="http://geoprocessing.demo.52north.org:8080/xyz/elev_srtm_30m.tif" mimeType="image/tiff" />
                </wps:Input>
  </wps:DataInputs>
  <wps:ResponseForm>
    <wps:RawDataOutput mimeType="image/tiff">
      <ows:Identifier>out</ows:Identifier>
    </wps:RawDataOutput>
  </wps:ResponseForm>
</wps:Execute>



Annotated R Script:

library(sp); library(maptools); library(rgdal);
# wps.des: id = test.return.raster, title = Returns a raster.
# abstract = Takes a raster dataset and returns it;

# wps.in: dem, type = tiff;

dem25m = readGDAL(dem)

outFile = "outputfromGdalR.tif"
out = writeGDAL(dem25m, outFile, drivername="GTiff")


# wps.out: id = out, type = tiff, title = passing a raster back;





Both GenericFileDataWithGTGenerator and GenericFileGenerator in wps_config_geotools.xml are active:

      <Generator name="GenericFileGenerator" className="org.n52.wps.io.datahandler.generator.GenericFileGenerator" active="true">
        <Format mimetype="application/geotiff" encoding="base64"/>
        <Format mimetype="application/dbase" encoding="base64"/>
        <Format mimetype="application/remap" encoding="base64"/>
        <Format mimetype="application/x-erdas-hfa" encoding="base64"/>
        <Format mimetype="application/x-netcdf" encoding="base64"/>
        <Format mimetype="application/netcdf" encoding="base64"/>
        <Format mimetype="application/dgn" encoding="base64"/>
        <Format mimetype="image/jpeg" encoding="base64"/>
        <Format mimetype="image/png" encoding="base64"/>
        <Format mimetype="application/x-geotiff" encoding="base64"/>
        <Format mimetype="text/plain" encoding="base64"/>
        <Format mimetype="application/x-zipped-shp" encoding="base64"/>
        <Format mimetype="application/rData" encoding="base64"/>
        <Format mimetype="application/rData+Spatial" encoding="base64"/>
        <Format mimetype="application/rData+SpatialPoints" encoding="base64"/>
        <Format mimetype="application/rData+SpatialPolygons" encoding="base64"/>
        <Format mimetype="application/rData"/>
        <Format mimetype="application/rData+Spatial"/>
        <Format mimetype="application/rData+SpatialPoints"/>
        <Format mimetype="application/rData+SpatialPolygons"/>
        <Format mimetype="application/x-zipped-shp"/>
        <Format mimetype="application/shp"/>
        <Format mimetype="application/img"/>
        <Format mimetype="image/tiff"/>
        <Format mimetype="image/geotiff"/>
        <Format mimetype="application/geotiff"/>
        <Format mimetype="application/dbase"/>
        <Format mimetype="application/remap"/>
        <Format mimetype="application/x-erdas-hfa"/>
        <Format mimetype="application/x-netcdf"/>
        <Format mimetype="application/netcdf"/>
        <Format mimetype="application/dgn"/>
        <Format mimetype="image/jpeg"/>
        <Format mimetype="image/png"/>
        <Format mimetype="application/x-geotiff"/>
        <Format mimetype="text/plain"/>
        <Format mimetype="application/pdf"/>
        <Format mimetype="application/zip"/>
        <Format mimetype="text/html"/>
        <Format mimetype="application/json"/>
        <Format mimetype="text/csv"/>
        <Format mimetype="application/x-zipped-shp" encoding="base64"/>
        <Format mimetype="application/shp" encoding="base64"/>
        <Format mimetype="application/img" encoding="base64"/>
        <Format mimetype="image/tiff" encoding="base64"/>
        <Format mimetype="image/geotiff" encoding="base64"/>
      </Generator>
      <Generator name="GenericFileDataWithGTGenerator" className="org.n52.wps.io.datahandler.generator.GenericFileDataWithGTGenerator" active="true">
        <Format mimetype="application/x-erdas-hfa" encoding="base64"/>
        <Format mimetype="application/x-netcdf" encoding="base64"/>
        <Format mimetype="application/dgn" encoding="base64"/>
        <Format mimetype="image/jpeg" encoding="base64"/>
        <Format mimetype="image/png" encoding="base64"/>
        <Format mimetype="application/x-geotiff" encoding="base64"/>
        <Format mimetype="text/plain" encoding="base64"/>
        <Format mimetype="application/x-zipped-shp" encoding="base64"/>
        <Format mimetype="application/rData" encoding="base64"/>
        <Format mimetype="application/rData+Spatial" encoding="base64"/>
        <Format mimetype="application/rData+SpatialPoints" encoding="base64"/>
        <Format mimetype="application/rData+SpatialPolygons" encoding="base64"/>
        <Format mimetype="application/rData"/>
        <Format mimetype="application/rData+Spatial"/>
        <Format mimetype="application/rData+SpatialPoints"/>
        <Format mimetype="application/rData+SpatialPolygons"/>
        <Format mimetype="application/x-zipped-shp"/>
        <Format mimetype="application/shp"/>
        <Format mimetype="application/img"/>
        <Format mimetype="image/tiff"/>
        <Format mimetype="image/geotiff"/>
        <Format mimetype="application/geotiff"/>
        <Format mimetype="application/dbase"/>
        <Format mimetype="application/remap"/>
        <Format mimetype="application/x-erdas-hfa"/>
        <Format mimetype="application/x-netcdf"/>
        <Format mimetype="application/dgn"/>
        <Format mimetype="image/jpeg"/>
        <Format mimetype="image/png"/>
        <Format mimetype="application/x-geotiff"/>
        <Format mimetype="text/plain"/>
        <Format mimetype="application/pdf"/>
        <Format mimetype="application/zip"/>
        <Format mimetype="text/html"/>
        <Format mimetype="application/json"/>
        <Format mimetype="text/csv"/>
        <Format mimetype="application/x-zipped-shp" encoding="base64"/>
        <Format mimetype="application/shp" encoding="base64"/>
        <Format mimetype="application/img" encoding="base64"/>
        <Format mimetype="image/tiff" encoding="base64"/>
        <Format mimetype="image/geotiff" encoding="base64"/>
        <Format mimetype="application/geotiff" encoding="base64"/>
        <Format mimetype="application/dbase" encoding="base64"/>
        <Format mimetype="application/remap" encoding="base64"/>
      </Generator>
Reply | Threaded
Open this post in threaded view
|

Re: Reading raster data inputs with wpsr

BenjaminPross
Hi Julian,

This seems to be a bug in WPS4R. We shall fix this for the next release. In the meantime, you could replace the 52n-wps-r-XXX.jar of your WPS with the attached one [1].

Hope this helps.

Cheers,

Benjamin

[1] 52n-wps-r-3.3.2-SNAPSHOT.jar
Reply | Threaded
Open this post in threaded view
|

Re: Reading raster data inputs with wpsr

julianrosser
Hi Ben,

Thanks a lot for sharing the updated jar. It fixed my issue.

Cheers,
Julian