3

I am using OpenLayers API in my web application and trying to interact with the local GeoServer via WPS. The problem I am facing is that, WPS client.execute() works only in case, if the output of the Process is Geometry type (i.e. forJTS:intersection,JTS:buffer, etc). It does not seem to work if the output is double/string/bool(i.e. forJTS:area,JTS:envelope,JTS:equalsExact, etc).

For e.g., the following code does not popup a "success" message.

 var geometry = OpenLayers.Geometry.fromWKT(
                   'POLYGON((110 20,120 20,120 10,110 10,110 20))'
                );

 client.execute({
            server: "local",
            //process: "JTS:envelope",
            process: "JTS:geometryType",
            inputs: {
                geom: geometry
            },          
            success: function(output) {
                alert('success');
            }
  });

But if I happen to replace JTS:geometryType with JTS:envelope, it works !!..

Not much of tutorials are available on internet. Is it a restriction in client.execute() or am I doing something wrong in the code ?

2

I haven't found the right answer to this problem, until now... but anyway, for others facing similar problem, here is a workaround solution.

testWPS is my WPS process whose input is string and output is string

OpenLayers.Request.POST({
        url: "http://localhost:8080/geoserver/wps,
        params: {
            "SERVICE": "WPS",
            "REQUEST": "Execute",
            "VERSION": '1.0.0',
            "IDENTIFIER": 'gs:testWPS',
            "RawDataOutput": 'result',
            "datainputs": "name=this now works with string,double,bool as output"
        },
        success: function(response) {
                     //Do something on success
        },
        failure: function(res){     
                     alert('failure');
        }

    });
|improve this answer|||||
0

I think that the OpenLayers WPS client is not up to scratch.

Trying it myself with this code

<script src="http://localhost:8080/geoserver/www/OpenLayers-2.13.1/OpenLayers.debug.js"></script>

    client = new OpenLayers.WPSClient({
        servers: {
            wps_test: 'http://localhost:8080/geoserver/wps/'
        }
    });
    gs_count = client.getProcess('wps_test', 'gs:Count')
    gs_count.execute({
      inputs:{
        features : points,
      },
      success : function(outputs){
        alert(outputs.result);
      }
    });

I get "TypeError: output.complexOutput is undefined" in OpenLayer.debug.js line 65467

mimeType: this.findMimeType(output.complexOutput.supported.formats, options.supportedFormats)

i.e. it appears to expect there to be a complex data output and not be able to cope with a literal data output.

and after more investigation I found this comment

/**
 * Class: OpenLayers.WPSProcess
 * Representation of a WPS process. Usually instances of
 * <OpenLayers.WPSProcess> are created by calling 'getProcess' on an
 * <OpenLayers.WPSClient> instance.
 *
 * Currently <OpenLayers.WPSProcess> supports processes that have geometries
 * or features as output, using WKT or GeoJSON as output format. It also
 * supports chaining of processes by using the <output> method to create a
 * handle that is used as process input instead of a static value.
 */

Update...

You can use PyWPS. This has a web client, example here... http://pywps.wald.intevation.org/documentation/course/client/index.html#

This handles literal data output.

|improve this answer|||||

Your Answer

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

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