[Pywps-devel] PyWPS synchronous mode
alan walsh
alanwalsh at hotmail.com
Tue May 18 04:05:59 CEST 2010
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.
https://signup.live.com/signup.aspx?id=60969
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wald.intevation.org/pipermail/pywps-devel/attachments/20100518/fa28b5ff/attachment.htm
More information about the Pywps-devel
mailing list