[OpenLayers-Users] Use of Geoserver raster processes within OpenLayers: WCS/WPS problem

constan.amurrio constan.amurrio at gmail.com
Tue Dec 3 02:20:32 PST 2013


Hello to everyone!
I've been working with some GeoServer processes using OpenLayers as client.
I've been successful in those which use WFS as input (like
gs:BufferFeatureCollection). My problem comes when I want to use processes
that need as input raster data (tiff). I know that OpenLayers is not a WCS
client, but you can send a POST request to the server to get back the
result, right?. Particularly I want to execute the
gs:RasterZontalStatistics, that needs a tiff and a WFS layer as input, and
returns some statistics (average, min, max, etc.) for the tiff inside the
geometries of the WFS Layer. This is the code I've used so far:

//*GEOPROCESS - Calculate the average/min/max values of the MDE raster
according to user drawing selection*/
function obtainElevationProcess(){
    var wpsFormat= new OpenLayers.Format.WPSExecute();

    var doc= wpsFormat.write({
        identifier: "gs:RasterZonalStatistics", 
        dataInputs:[{
            identifier:'data',
            reference:{
                mimeType:"image/tiff",
                href: "http://geoserver/wcs",
                method: "POST",
                body: {
                    wcs: {
                        identifier:'forestry:mde200_V4',
                        version:"1.1.1",
                        domainSubset: {
                            boundingBox: {
                                projection:
'http://www.opengis.net/gml/srs/epsg.xml#3857',
                                bounds: new
OpenLayers.Bounds(-200931.8344047, 4681799.186142525,32948.35238090271,
4948113.428142309)
                            }
                            },
                        output: {format:'image/tiff'},
                        }
                        }
                        }
                        },
            {
                identifier:"zones",
                reference:{
                            mimeType:"text/xml; subtype=wfs-collection/1.0",
                            href: "http://geoserver/wfs",
                            method: 'POST',
                            body:{
                                wfs:{
                                    version:'1.0.0',
                                    outputFormat: "GML2",
                                    featureNS:
"http://localhost:8080/thesis/forestry",
                                    featureType:'forestry:Lics',    
                                }
                            }
                        }
            }],

            responseForm:{
                    rawDataOutput:{
                        mimeType:"text/xml;subtype=wfs-collection/1.0",
                        identifier:"statistics"
                }
            }

            });


    OpenLayers.Request.POST({
        url:"http://localhost:8080/geoserver/ows/",
        data:doc,
        headers: {
            "Content-Type": "text/xml;charset=utf-8"
        },
        success: function(response){
            alert(response.responseText);
            }
    });

}/

Once executed, OpenLayers returns this message (selection):

/Process execution ecacba6c-a676-46b5-9010-bd4a2bb35632 failed
Failed to retrieve value for input data
Unrecognized request type {service=WCS, Output=image/tiff,  
Identifier=net.opengis.ows11.impl.CodeTypeImpl at 1ad2fc (value:
forestry:mde200_V4, codeSpace: null),
DomainSubset=net.opengis.ows11.impl.BoundingBoxTypeImpl at 111d0b5
(lowerCorner: [-200931.8344047, 4681799.1861425], upperCorner:
[32948.352380903, 4948113.4281423], crs:
http://www.opengis.net/gml/srs/epsg.xml#3857, dimensions: null),
version=1.1.1}</ows:ExceptionText></ows:Exception></ows:ExceptionReport></wps:ProcessFailed></wps:Status></wps:ExecuteResponse>/

Does anyone an idea about how this can be done (if possible)? My environment
is: Geoserver 2.3.5 / OpenLayers 2.13 / localhost on Apache.

Help will be highly appreciated.

Thanks.

Constan. 



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Use-of-Geoserver-raster-processes-within-OpenLayers-WCS-WPS-problem-tp5092339.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list