<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Dec 6, 2013 at 1:59 PM, Nitendra Gautam <span dir="ltr"><<a href="mailto:nitendra.gautam@my.ndsu.edu" target="_blank">nitendra.gautam@my.ndsu.edu</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">




<div dir="ltr">
<div name="divtagdefaultwrapper" style="font-size:12pt;margin:0px;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Thank You Vaclav Peters for your reply.<br>
</p>
<p>Well i am trying to use GRASS GISas a back end server for web processing service.</p>
<p>I did  modified my code according to your suggestions but did some mistake on the say</p>
<p>i have pasted my code here(<a href="http://pastie.org/8533927" target="_blank">http://pastie.org/8533927</a>).</p>
<p><br>
</p>
<p>I think i did some mistake on passing the argument in the function .you can check on link 2 on
<a href="http://134.129.125.124/." target="_blank">http://134.129.125.124/.</a></p>
<p>I am getting the following error message in my error log.<br>
</p>
<p><br>
</p>
<p> Premature end of script headers: newcode2.py, referer: <a href="http://134.129.125.124/" target="_blank">
http://134.129.125.124/</a></p>
<p>Any suggestions on where i did wrong?</p>
<p><br></p></div></div></blockquote><div>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.</div><div><br></div><div>However, I think that you are calling GRASS command in the wrong way:</div>

<div><br></div><div><pre class="" style="font-family:Inconsolata,Inconsolata,Monaco,Consolas,'Courier New',monospace;font-size:14px;line-height:18.1875px;margin-top:0em;color:rgb(0,0,0)"><span class="">self.cmd(["r.in.gdal -o", "inp...</span></pre>

I'm not sure about the interface there (in pyWPS) but I guess that it should be:<br><br><pre class="" style="font-family:Inconsolata,Inconsolata,Monaco,Consolas,'Courier New',monospace;font-size:14px;line-height:18.1875px;margin-top:0em;color:rgb(0,0,0)">

<span class="">self.cmd(["r.in.gdal", "</span>-o", "inp...</pre><div>Each parameter (grass option or flag in this case) should be a separate item in the list (self.cmd).</div><br>Vaclav<br> </div>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div name="divtagdefaultwrapper" style="font-size:12pt;margin:0px;font-family:Calibri,Arial,Helvetica,sans-serif">

<p>
</p>
<p>Thank You</p>
<p>Nitendra Gautam<br>
</p>
<div style="color:rgb(40,40,40)">
<hr style="display:inline-block;width:98%">
<div dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> Vaclav Petras <<a href="mailto:wenzeslaus@gmail.com" target="_blank">wenzeslaus@gmail.com</a>><br>
<b>Sent:</b> Friday, December 06, 2013 9:15 AM<br>
<b>To:</b> Nitendra Gautam<br>
<b>Cc:</b> <a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>
<b>Subject:</b> Re: [GRASS-user] GRASS GIS through PyWPS bridge</font>
<div> </div>
</div><div><div class="h5">
<div>
<div dir="ltr">Hi Nitendra,
<div><br>
</div>
<div>your code says<br>
<div><br>
</div>
<div>
<pre style="font-family:Inconsolata,Inconsolata,Monaco,Consolas,'Courier New',monospace;font-size:14px;line-height:18.1875px;margin-top:0em;color:rgb(0,0,0)"><span>"r.out.png","input=the/tiff/file","out=/the/png/file"</span></pre>


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.</div>
<div><br>
</div>
<div>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].</div>
<div><br>
</div>
<div>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].</div>
<div><br>
</div>
<div>Than you can do what ever processing you want and then export the result as PNG using r.out.png.</div>
<div><br>
</div>
<div>Hope that helps,</div>
<div>Vaclav</div>
<div><br>
</div>
<div>[1] <a href="http://grass.osgeo.org/grass70/manuals/r.out.png.html" target="_blank">http://grass.osgeo.org/grass70/manuals/r.out.png.html</a></div>
<div>[2] <a href="http://www.imagemagick.org/" target="_blank">http://www.imagemagick.org</a></div>
<div>[3] <a href="http://www.gdal.org/" target="_blank">http://www.gdal.org/</a></div>
<div>[4] <a href="http://grass.osgeo.org/grass70/manuals/r.in.gdal.html" target="_blank">http://grass.osgeo.org/grass70/manuals/r.in.gdal.html</a></div>
<div>[5] <a href="http://grass.osgeo.org/grass70/manuals/r.external.html" target="_blank">http://grass.osgeo.org/grass70/manuals/r.external.html</a></div>
</div>
<div>[6] <a href="http://grass.osgeo.org/grass70/manuals/r.composite.html" target="_blank">http://grass.osgeo.org/grass70/manuals/r.composite.html</a></div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Wed, Dec 4, 2013 at 3:19 PM, Nitendra Gautam <span dir="ltr">
<<a href="mailto:nitendra.gautam@my.ndsu.edu" target="_blank">nitendra.gautam@my.ndsu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr">
<div name="divtagdefaultwrapper" style="font-size:12pt;margin:0px;font-family:Calibri,Arial,Helvetica,sans-serif">
Hi all,
<div><br>
</div>
<div>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 .</div>
<div>right now my web page(<a href="http://134.129.125.124/" title="http://134.129.125.124/
Ctrl+click or tap to follow link" style="font-size:12pt" target="_blank">http://134.129.125.124/</a>)<span style="font-size:12pt">  displays a normal JPG image by from
 <JPG image button>.</span></div>
<div>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.</div>
<div>I have pasted my script (<a href="http://pastie.org/8529097" title="http://pastie.org/8529097
Ctrl+click or tap to follow link" style="font-size:12pt" target="_blank">http://pastie.org/8529097</a>).But its not working right now.</div>
<div><br>
</div>
<div>Can you please give me suggestions ?</div>
<div> </div>
<div>Thank You</div>
<span><font color="#888888">
<div>Nitendra</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</font></span></div>
</div>
<br>
_______________________________________________<br>
grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</div></div></div>
</div>
</div>

</blockquote></div><br></div></div>