[GRASS-user] GRASS GIS through PyWPS bridge

Vaclav Petras wenzeslaus at gmail.com
Fri Dec 6 12:05:15 PST 2013


On Fri, Dec 6, 2013 at 1:59 PM, Nitendra Gautam <nitendra.gautam at my.ndsu.edu
> wrote:

>  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?
>
>
> The error message is from pyWPS not GRASS, so you need to check with them
how to get something which can you tell more about what happened.

However, I think that you are calling GRASS command in the wrong way:

self.cmd(["r.in.gdal -o", "inp...

I'm not sure about the interface there (in pyWPS) but I guess that it
should be:

self.cmd(["r.in.gdal", "-o", "inp...

Each parameter (grass option or flag in this case) should be a separate
item in the list (self.cmd).

Vaclav


>  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
> [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> 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
>> 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/abe9471c/attachment.html>


More information about the grass-user mailing list