[Pywps-devel] grass online

Jachym Cepicky jachym.cepicky at gmail.com
Mon Jan 18 07:52:15 CET 2010


This you can found in 

trunk/doc/examples/clients/WPS.js

and some example should be in trunk/doc/examples/clients/wps-WPS.html

there is some OpenLayers-minimal-wps.js, but you better use full  
OpenLayers.js

basicaly, there are two ways, how to get it work:

a) (semi) automatic
b) by hand

the seccond approach (by hand) is maybe easier to understand, because it 
copies the way, you define the process in pywps

1) you have to define the the wps instance
2) you have to define the process, you need to run
3) you have to define inputs and outputs the process needs
4) you have to assign in- and outputs to particular process
5) you have to assing process to particular wps instance
6) you run the execute method
7) you get the result, which is parsed and you can display it in the map

which translated to javascript could look like

//1) define wps instance
var wps = new OpenLayers.WPS(url,{onStatusChanged: some_function, onSucceeded: 
other_function});

//2) define the in and ouputs
var input1 =  new OpenLayers.WPS.ComplexPut({
                              identifier: "Input", 
			      asReference: false,
                              value: gmlData
		});

...

//3) 	define the process			
var process = new OpenLayers.WPS.Process({
				identifier: "process",
				assync: false,
                                inputs: [input1, ...],
				outputs: [output1, ... ]
			});

// 4)  assign the process to wps instance
wps.addProcess(process);

// 5) execute

wps.execute('process_identifier');

function on_succeeded(process) {
	var outputValue = process.ouputs[0].value;

    
};


the second approach works semi-automatic way

1) you have to define the wps instalce
2) you have to call get capabilities
3) you have to call describe process 
4) user has to input some data - there must be some auto-generated html form 
for this and this is not done in this library
5) you have to run execute
6) you can display results

// 1) wps 
var wps = new OpenLayers.WPS(url, {onStatusChagned: status_changed, 
onSucceeded: on_succedded});
wps.getCapabilities(url);

// 2) describe process
for (var i = 0; i <  wps.processes.length; i++) {
	wps.describeProcess(wps.processes[i].identifier);
}


// 3) for each process, generate the input form
for (var i = 0; i < wps.processes.length; i++) {
	// define the input form and display it to HTML page, you have all the 
attributes of each processes
}

// 4) call the execute method just like in the previous example

if you need any (mapping) data, to be displayed within OpenLayers,   it must 
be PNG, JPG or GIF (for raster data), GML or any other text or xml-based 
format. Do not to forget, to add asReference=true to you output request and 
set propper supported output format, such as

        self.out = self.addComplexOutput(identifier = "out",
                            title = "Resulting output map",
                            formats = [
                                {"mimeType":"image/tiff"},
                                {"mimeType":"image/png"}
                            ]#,
                             # useMapscript=True // this here is for the           
							       // mapscript part, see below
)

so the client can choose, which output format she preferes

than you can define just the OpenLayers.Layer.Image or OpenLayers.Layer.GML or 
whatever, and OpenLayers will display the result to you.


In the trunk, there is basic support for MapServer urls, so the ouput is not a 
file reference, but complete WMS/WCS/WFS request. Your client can later 
manipulate with it easier, than with standard files (OpenLayers.Layer.WMS and 
OpenLayers.Layer.WFS comes to word here).

the OpenLayers.WPS is relatively fresh and undocumented. I tested it and for 
my purposes, it works. But any input from yours side is always accepted.

Thanks

Jachym

Dne Ne 17. ledna 2010 16:03:28 Mohammed Rashad napsal(a):
> I know i am wasting your precious time but i have no other choices. I must
> get help from author of PyWPS.
> My PyWPS installation works fine and i got xml output in the web browser. I
> don't know how to handle it in OpenLayers and how to get image as output
> after execute function of PyWPS Process.
> 
> I had seen an example in PyWPS gallery ---> http://geo.sazp.sk/.
> I also go through the code of the above example and got some idea about how
> to handle the request to calculate visibility process.
> My question is how to make a general extenstion in OpenLayers to handle any
> typw of PyWPS requests.
> 
> Its working fine and I thought I should ask your help. Do i need to write
>  an extension for openlayers to support PyWPS in openlayers
> such as *makeWpsRequest* in *hslayer.js* of the above demo link.
> 
> On Sun, Jan 17, 2010 at 6:39 PM, Jachym Cepicky 
<jachym.cepicky at gmail.com>wrote:
> > hi,
> >
> > Dne Ne 17. ledna 2010 10:04:09 Mohammed Rashad napsal(a):
> > > Hi,
> > > I am developing a webGIS application which needs some online analysis
> > > of GRASS data.
> > > GRASS data is not converted to shapefiles, GML or any other formats.
> > > It must be accessed from GRASS database directly and some of grass
> >
> > modules
> >
> > > will be applied on the data and output must be displayed on web
> > > browser.
> > >
> > > My actual problem is when i searched for such a web application, I
> > > found nothing.
> >
> > Did you hear about PyWPS ?
> >
> > > So i decided to develop a new extension for openlayers.
> > > If  you know any existing application which can solve my problem, I can
> > >  save my time developing a useless module for openalyers.
> >
> > OpenLayers is JavaScript - client-side programming language (usually).
> > You need some server-script. There is OpenLayers-based client for WPS,
> > which is part of PyWPS, so you can interpret results Execute results from
> > WPS and handle them in OpenLayers.
> 
> I didn't undestand this section. will you please elaborate if you are not
> very busy. please..
> 
> > > I have no trouble with programming in javascript because basically I am
> > > a developer.
> > >
> > > what is your opinion about my problem?. I expect you help and
> >
> > co-operation.
> >
> > As long as you will need something for PyWPS, yes, othervice, I have
> > enough work to do, thank you.
> >
> > > Please reply as soon as possilbe for you.
> > >
> > > Thanks in advance
> >
> > --
> > Jachym Cepicky
> > e-mail: jachym.cepicky gmail com
> > URL: http://les-ejk.cz
> > PGP Public key: http://les-ejk.cz/pgp/JachymCepicky.pgp
> 

-- 
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