[Pywps-devel] PyWPS synchronous mode

Jachym Cepicky jachym.cepicky at gmail.com
Tue May 18 15:40:11 CEST 2010


Hi,

it runs synchronously by default, you would have to specify something like

process.assync = true;

in the javascript code, which is false by default.

>  function onSucceeded(process) { 
>       OpenLayers.loadURL(process.outputs[0].value, "", null,
> parseBufferResponse);
>  };

this  is the function which will be called, according to your
configuration, after the process was successfully executed.

you should be able to customise according to your needs

Jachym


alan walsh píše v Út 18. 05. 2010 v 02:05 +0000:
> Hi all,
>  
> I have written the script below to execute and parse with OpenLayers a
> buffer query which has no user inputs (exampleBufferNoInputsProcess). 
>  
> The script is not working fully as yet. The script executes
> successfully on the server which I can see from the server logs.
> Also, when I execute the process from the browser address bar, I can
> see all of the GML data for the features.
>  
> However, I am running PyWPS on Windows 7. I'm not sure what the
> problem is with the script but I know that Jachym said that Windows
> can not operate PyWPS in asynchronous mode. I don't quite understand
> what this means and also how I need to change the code to accomodate
> this problem.
>  
> Does anybody have any ideas on this?
>  
> Regards,
> Alan
>  
>  
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
> http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd>
> <html xmlns=http://www.w3.org/1999/xhtml
>      xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
>      xsi:schemaLocation=http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd
>      xml:lang="en" >
>     <head>
>         <title>WPS Client - Execute</title>
>         <meta http-equiv="Content-Type" content="text/html;
> charset=utf-8" />
>         <script type="text/javascript"
> src="http://openlayers.org/api/OpenLayers.js"></script>
>         <script type="text/javascript" src="WPS.js"></script>
>         <style type="text/css">
>             #map {
>                 width :550px;
>                 height :400px;
>             }
>         </style>
>         <script type="text/javascript">
>   
>             var lon = -100;
>             var lat = 44;
>             var zoom = 6;
>             var map, layer;
>             function init() {
>    
>   map = new OpenLayers.Map('map');
>   map.addLayer(layer);
>     
>   map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
>   // Initialize WPS 
>   var wps = new
> OpenLayers.WPS("http://localhost/cgi-bin/pywps-3.1.0/wps.py",{onSucceeded: onSucceeded});
>     
>   // Define output for process
>   var bufferOut = new OpenLayers.WPS.ComplexPut({
>        identifier: "bufferout",
>        title: "Answer1",
>        asReference: true
>   });
>  
>   // define the process, with one output
>   var process = new OpenLayers.WPS.Process({
>        identifier: "exampleBufferNoInputsProcess",
>        async: false,
>        storeSupported: true,
>        grassLocation: true,
>        statusSupported: false,
>        outputs: [bufferOut]
>   });
>   
>   // add the process to wps
>   wps.addProcess(process);
>   
>   // execute the process
>   wps.execute(process.identifier);
>     
>  };
> 
>  // Load data and call parse response  
>  function onSucceeded(process) { 
>       OpenLayers.loadURL(process.outputs[0].value, "", null,
> parseBufferResponse);
>  };
>     
>  // parse the resulting buffer
>  function parseBufferResponse(req) {
>        var g = new OpenLayers.Format.GML();
>        var features = g.read(req.responseText);
>        features[0].attributes = {};
>        var mPolygon = new
> OpenLayers.Geometry.MultiPolygon(features[0].geometry);
>        features[0].geometry = mPolygon;
>        features[0].state = OpenLayers.State.INSERT;
>        map.addFeatures(features[0]);
>  };
> }
>     
>         </script>
>     </head>
>     <body>
>  
>   <div>
>   <div id="messageLabel"></div>
>   <input type="button" value="Click Me!" onclick="init();" />
>   </div>
>  
>         <h1>WPS Execute</h1>
>   <div id="map" style="width: 600px; height: 300px"></div>        
>   </div>
>   <div>
>         </div>
>     </body>
> </html>
> 
> 
> 
> 
> ______________________________________________________________________
> Hotmail: Free, trusted and rich email service. Get it now.
> _______________________________________________
> Pywps-devel mailing list
> Pywps-devel at wald.intevation.org
> http://lists.wald.intevation.org/mailman/listinfo/pywps-devel
-- 
Jachym Cepicky
e-mail: jachym.cepicky gmail com
URL: http://les-ejk.cz
PGP Public key: http://les-ejk.cz/pgp/JachymCepicky.pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Toto je =?UTF-8?Q?digit=C3=A1ln=C4=9B?=
 =?ISO-8859-1?Q?_podepsan=E1?= =?UTF-8?Q?_=C4=8D=C3=A1st?=
 =?ISO-8859-1?Q?_zpr=E1vy?=
Url : http://lists.wald.intevation.org/pipermail/pywps-devel/attachments/20100518/fe9d03a6/attachment.pgp


More information about the Pywps-devel mailing list