[GRASS-user] GRASS GIS through PyWPS bridge

Nitendra Gautam nitendra.gautam at my.ndsu.edu
Fri Dec 6 10:59:19 PST 2013


Thank You Vaclav Peters for your reply.

Well i am trying to use GRASS GISas a back end server for web processing service.

I did  modified my code according to your suggestions but did some mistake on the say

i have pasted my code here(http://pastie.org/8533927).


I think i did some mistake on passing the argument in the function .you can check on link 2 on http://134.129.125.124/.

I am getting the following error message in my error log.


 Premature end of script headers: newcode2.py, referer: http://134.129.125.124/

Any suggestions on where i did wrong?


Thank You

Nitendra Gautam

________________________________
From: Vaclav Petras <wenzeslaus at gmail.com>
Sent: Friday, December 06, 2013 9:15 AM
To: Nitendra Gautam
Cc: grass-user at lists.osgeo.org
Subject: Re: [GRASS-user] GRASS GIS through PyWPS bridge

Hi Nitendra,

your code says



"r.out.png","input=the/tiff/file","out=/the/png/file"

But r.out.png [1] is not converter between image formats (this is what ImageMagic does [2]). If the images are georeferenced then GDAL [3] is the right option for file format conversion. r.out.png exports GRASS raster map, so input should be GRASS raster map not a tiff file.

If you want to use GRASS for this conversion (e.g. this conversion is only example process and in fact you want to do some serious processing in GRASS), you need to import the tiff file first or link it as external map. For import to GRASS use r.in.gdal [4]. For linking the tiff file as external map use r.external [5].

Note that if the tiff has colors it will be splitted into three maps and if you want to show it as one RGB map, you need to use r.composite [6].

Than you can do what ever processing you want and then export the result as PNG using r.out.png.

Hope that helps,
Vaclav

[1] http://grass.osgeo.org/grass70/manuals/r.out.png.html
[2] http://www.imagemagick.org<http://www.imagemagick.org/>
[3] http://www.gdal.org/
[4] http://grass.osgeo.org/grass70/manuals/r.in.gdal.html
[5] http://grass.osgeo.org/grass70/manuals/r.external.html
[6] http://grass.osgeo.org/grass70/manuals/r.composite.html


On Wed, Dec 4, 2013 at 3:19 PM, Nitendra Gautam <nitendra.gautam at my.ndsu.edu<mailto:nitendra.gautam at my.ndsu.edu>> wrote:
Hi all,

I want to make a simple web page that uses web processing capabilities of GRASS as  a back end and displays image on the webpage.I am using CGI interface of python and PyWPS bridge connecting them .
right now my web page(http://134.129.125.124/)  displays a normal JPG image by from <JPG image button>.
I want to write a  simple python script which uses Grass GIS to convert a TIFF image to png or other formats.This script should run as a back end.
I have pasted my script (http://pastie.org/8529097).But its not working right now.

Can you please give me suggestions ?

Thank You
Nitendra





_______________________________________________
grass-user mailing list
grass-user at lists.osgeo.org<mailto:grass-user at lists.osgeo.org>
http://lists.osgeo.org/mailman/listinfo/grass-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20131206/bbbb6afb/attachment.html>


More information about the grass-user mailing list