[Pywps-devel] [Pywps-commits] My First Pywps3.0 Process
Jachym Cepicky
jachym.cepicky at gmail.com
Mon Jan 19 09:27:55 CET 2009
Hi,
2009/1/14 Andres Herrera <t763rm3n at gmail.com>:
> Hi, i wrote these "dummy" script to convert gml vector data to raster png
does it work?
can I add your example process to doc/examples/processes directory?
Jachym
>
> How to :
>
> 1) Create a new pywps process into your : PYWPS_PROCESSES directory
> 2) Copy and paste the code bellow ( "remove: <code> tag") into a
> gml2png.py file
> 3) Define the process into your __init__.py
>
> __all__=["gml2png"]
>
> 4) Thats All...
>
> + Test if gml2png is on ProcessOfferings
>
> http://localhost/cgi-bin/wps?service=wps&request=GetCapabilities&version=1.0.0
>
> + Execute the process
>
> http://localhost/cgi-bin/wps?version=1.0.0&service=wps&request=execute&identifier=gml2png&datainputs=[data=http://localhosttmp/wgs84_vallecauca_v.gml]&responsedocument=[pngresult=@asreference=true]
>
> + wait for your ProcessSucceeded response ..
>
> and check for the generated file into your defined : outputPath accessed
> over outputUrl ..
>
> <code>
>
> # GML2PNG
> # Author: Andres Herrera <t763rm3n gmail com>
> # For: PyWPS 3.0.0
>
> from pywps.Process.Process import WPSProcess
>
> import os
>
> class Process(WPSProcess):
> def __init__(self):
> WPSProcess.__init__(self,
> identifier = "gml2png",
> version = "0.1",
> storeSupported = "true",
> statusSupported = "true",
> title="GML2PNG",
> abstract="Converts a GML Vector File to Raster PNG File",
> grassLocation = True)
>
> self.dataIn = self.addComplexInput(identifier="data",
> title="Input data",
> formats=[{"mimeType":"text/xml"}])
>
> self.dataOutPNG = self.addComplexOutput(identifier="pngresult",
> title="PNG Result",
> formats=[{"mimeType":"image/png"}])
>
> def execute(self):
>
> self.cmd("g.region -d")
>
> out=self.cmd("v.in.ogr dsn=%s output=data" %\
> (self.getInputValue('data')))
>
> self.cmd("g.region vect=data")
>
> os.system("export GRASS_TRANSPARENT=true")
> self.cmd("d.mon start=PNG",stdout=False)
> self.cmd("d.vect data")
> self.cmd("d.mon stop=PNG")
>
> self.dataOutPNG.setValue("map.png")
>
>
> </code>
>
>
>
>
>
> --
> =====================================================
> Ing. Fabio Andres Herrera
> Gerente de Proyectos
> From Sky - UAV & RPV Systems
> Santiago de Cali
> Web Site :http://fromsky.hrglobalideas.com
> e-mail:
> andres at hrglobalideas.com
> fandresherrera at hotmail.com
>
> _______________________________________________
> Pywps-commits mailing list
> Pywps-commits at wald.intevation.org
> http://lists.wald.intevation.org/mailman/listinfo/pywps-commits
>
>
--
Jachym Cepicky
e-mail: jachym.cepicky gmail com
URL: http://les-ejk.cz
GPG: http://les-ejk.cz/pgp/JachymCepicky.pgp
More information about the Pywps-devel
mailing list