[Pywps-devel] grass online

Jachym Cepicky jachym.cepicky at gmail.com
Mon Jan 25 08:15:23 CET 2010


hi,

Dne Ne 24. ledna 2010 21:58:30 ivan marchesini napsal(a):
> Dear Jachym (and pyWPS users/developers),
> I'm still at the same point of last e-mail but with one new question.
> 
> This is the OpenLayers code of the function calling my test pyWPS
> process:
> 
> __________________________________________
> 
> var calculate = function() {
>     var wps = new OpenLayers.WPS("http://mywpswrapper",
>                                     {
>                                         onSucceeded : onSucceeded,
>                                         onStatusChanged :
> onStatusChanged
>                                     });
> 
> var output1 = new OpenLayers.WPS.ComplexPut({
>                         identifier: "output",
>                         title: "output_voronoi"
>                });
> 
> 
> var process = new OpenLayers.WPS.Process({
>                                 identifier: "voronoi_sanf",
>                                 assync: false,
>                                 outputs: [output1]
>                });
> 
> wps.addProcess(process);
> 
> wps.execute(process.identifier);
> 
> }
> ___________________________________________________
> 
> 
> Activating the function (by means of a click on a extjs button) the
> process starts and all seems working well.
> A code containing this text:
> ________________
> <?xml version="1.0" encoding="utf-8"?>
> <wps:ExecuteResponse xmlns:wps="http://www.opengis.net/wps/1.0.0"
> xmlns:ows="http://www.opengis.net/ows/1.1" xmln [.....]
> _______________
> with a lot of points coordinates, arrives into my browser (I can see it
> with firebug)
> 
> 
> Now I'm trying to load this xml into my openlayer.map (which is called
> "mappa"):
> 
> ______________________________________
>      var onSucceeded = function() {
>                 wps.parseExecuteOutput(process,output1);
>                 console.log("CIAO");
>                 mappa.addLayer(output.value);
>         }
> ______________________________________
> 
> 
> It doesn't work... but the main problem is that I can't see, into
> firebug, the word "CIAO"!!!!!
> 
> It seems that the onSucceeded function is not called at the end of the
> process execution...
> 
> could be???
> Please give me some hints..
> 
> many many thanks...
> 
> 
> Ivan
> 

this seems to be correct, 

1) are you using WPS.js from trunk?
2) does wps.parseExecuteOutput(process.output1); return something, or it 
failes?

seems, you are assuming, that there is directly OpenLayers.Layer object in the 
output.value object - it is not. Either you are using asReference=true 
(default for vectors), and then there is a link to the file, and if it is GML 
file, you can do 

	new OpenLayes.Layer.GML("Name",output.value);

or there are the raw data, and you have to parse them, something like


	// 1)  create new vector layer
	var vlayer = new OpenLayers.Layer.Vector("Name");
	map.addLayer(vlayer);
	
	// 2) the output.value might be in XMLDOM representation, we need to convert 
it to text
	var xmlParser = new OpenLayers.Format.XML();
	var value = xmlParser.write(process.value);

	// 3) convert the GML in text form to OpenLayers.Features
	var gmlParser =  new OpenLayer.Format.GML();
	vlayer.addFeatures(gmlParser.read(value));


jachym

-- 
Jachym Cepicky
e-mail: jachym.cepicky gmail com
URL: http://les-ejk.cz
PGP Public key: http://les-ejk.cz/pgp/JachymCepicky.pgp


More information about the Pywps-devel mailing list