Re: [GRASS-user] Retrieve list of values in Python

2011-03-29 Thread Martin Landa
Hi,

2011/3/30 Christian Schwartze :
> In order to get a list, here is just one approach:
> vals = os.popen(“r.stats –Nn your_map”).readlines()

use GRASS Scripting Library [1]

grass.read_command('r.stats', flags='Nn',input = 'map').splitlines()

Martin

[1] http://grass.osgeo.org/programming7/pythonlib.html

-- 
Martin Landa  * http://geo.fsv.cvut.cz/~landa
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Retrieve list of values in Python

2011-03-29 Thread Christian Schwartze
In order to get a list, here is just one approach:
vals = os.popen(“r.stats –Nn your_map”).readlines()

Christian.

From: Jenny Turner 
Sent: Tuesday, March 29, 2011 11:55 PM
To: GRASS user list 
Subject: [GRASS-user] Retrieve list of values in Python

Greetings 

I would like to know how can I retrieve the list of available values in a 
Raster map in a Python Script?
Thanks
Best regards,
Jenny Turner



___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] Retrieve list of values in Python

2011-03-29 Thread Jenny Turner
Greetings

I would like to know how can I retrieve the list of available values in a
Raster map in a Python Script?
Thanks
Best regards,
Jenny Turner
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] DEM_corrected.zip.gz (grass-user@lists.osgeo.org)

2011-03-29 Thread Edgar Pimiento
Hi,

Do you have any problem with the DEM? Which is the spatial reference of the DEM?

Best,

 Edgar Pimiento Chamorro
e_pimie...@yahoo.com





From: "gcordobaguerr...@gmail.com" 
To: grass-user@lists.osgeo.org
Cc: twey...@lsu.edu
Sent: Tue, March 29, 2011 12:27:39 PM
Subject: [GRASS-user] DEM_corrected.zip.gz (grass-user@lists.osgeo.org)


 I've shared DEM_corrected.zip.gz 
Click to open: 
* DEM_corrected.zip.gz
Google Docs makes it easy to create, store and share online documents, 
spreadsheets and presentations. 



  ___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Problem with Python Scripts and grass.script (GRASS 6.5SVN) on Mac

2011-03-29 Thread Johannes Radinger
The script I am trying is the simpliest form of a script calling just one
function of GRASS (e.g. mapcalc or r.thin),

attached you can find that script which can be applied e.g. on the spearfish
rasterdataset...and in my opinion it is correct and in the correct order
of commands as mentioned in the grass-wiki and with the correct line endings.

/johannes

#!/usr/bin/env python
#

#
# MODULE:   Modell
#
# AUTHOR(S):	Johannes Radinger
#   
# PURPOSE:  
#
# DATE: Tue Feb 01 14:00:50 2011
#
#
#%Module
#% description: mapcalc test
#%End
#%option
#% key: newmap
#% type: string
#% gisprompt: new,cell,raster
#% description: output
#% required: yes
#%end
#%option
#% key: elevation
#% type: string
#% gisprompt: old,cell,raster
#% description: input 1
#% required: yes
#%end
#%option
#% key: geology
#% type: string
#% gisprompt: old,cell,raster
#% description: input 2
#% required: yes
#%end


import sys
import os

import grass.script as grass


def main():
grass.mapcalc("${newmap} = ${elevation} * ${geology}",
   newmap = options['newmap'],
   elevation = options['elevation'],
   geology = options['geology'])

if __name__ == "__main__":
options, flags = grass.parser()
main()


Am 29.03.2011 um 17:38 schrieb Michael Barton:

> It looks like it it is going to the GRASS commmand before you push the run 
> button. So I think you have the commands in the wrong place in the script.
> 
> Trying grabbing a python script out of the scripts directory in GRASS 7. 
> Since those all work, you should be able to modify it bit by bit to transform 
> it to yours.
> 
> Michael
> 
> C. Michael Barton
> Director, Center for Social Dynamics & Complexity 
> Professor of Anthropology, School of Human Evolution & Social Change
> Arizona State University
> 
> voice:480-965-6262 (SHESC), 480-727-9746 (CSDC)
> fax:  480-965-7671 (SHESC),  480-727-0709 (CSDC)
> www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On Mar 29, 2011, at 8:35 AM, Johannes Radinger wrote:
> 
>> Hello Michael,
>> 
>> thank you for your answer and your tip with the debugging code,
>> but it doesn't matter where I put it, I fail. I that case grass doesn't
>> open anymore the interactive menu (from g.parser) for that script and I just 
>> get the error:
>> 
>> my program gets this far
>> ERROR: Required parameter  not set:
>>   (output)
>> ERROR: Required parameter  not set:
>>   (input 1)
>> ERROR: Required parameter  not set:
>>   (input 2)
>> 
>> if I leave the debugging code out, the interactive menu pops up and I can 
>> set the parameters, but nothing is afterwards processed.
>> 
>> what am I doing wrong?
>> 
>> /johannes
>> 
>> 
>>  Original-Nachricht 
>>> Datum: Tue, 29 Mar 2011 07:40:28 -0700
>>> Von: Michael Barton 
>>> An: grass-user grass-user , Johannes Radinger 
>>> 
>>> Betreff: [GRASS-user] Problem with Python Scripts and grass.script  (GRASS  
>>> 6.5SVN) on Mac
>> 
>>> Hi Johannes,
>>> 
>>> Sorry I couldn't get back to you sooner. But it seems like others have
>>> told you about the line ending issue. That's a real problem because most
>>> people (myself included) will want to start out by copying an example 
>>> program
>>> from the GRASS site. 
>>> 
>>> ...and it will utterly fail to run.
>>> 
>>> Anyway, now that your got it started, it is a debugging issue. Put in some
>>> debugging code like...
>>> 
>>> print 'my program gets this far'
>>> 
>>> ...at different places to see where it is getting stuck. This is tedious
>>> but always seems needed.
>>> 
>>> Michael
>>> 
>>> C. Michael Barton
>>> Director, Center for Social Dynamics & Complexity 
>>> Professor of Anthropology, School of Human Evolution & Social Change
>>> Arizona State University
>>> 
>>> voice:  480-965-6262 (SHESC), 480-727-9746 (CSDC)
>>> fax:  480-965-7671 (SHESC),  480-727-0709 (CSDC)
>>> www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu
>>> 
>>> 
>>> 
>>> 
>>> 
>>> On Mar 29, 2011, at 3:25 AM,  wrote:
>>> 
 Date: Tue, 29 Mar 2011 11:11:12 +0200
 From: "Johannes Radinger" 
 Subject: [GRASS-user] Problem with Python Scripts and grass.script
(GRASS  6.5SVN) on Mac
 To: grass-user@lists.osgeo.org
 Message-ID: <20110329091112.282...@gmx.net>
 Content-Type: text/plain; charset="utf-8"
 
 Hello Grass users!
 
 I am working with GRASS 6.5 SVN (r45714, last weeks source) and try to
>>> run Python Scripts. After I solved the problem with the line endings, GRASS
>>> seems to be able to read my scripts (via launch script...). At least the
>>> interactive interface pops up correctly (it seems g.parser can read all my
>>> options etc.), but after executing it no

[GRASS-user] Mapset names and problems

2011-03-29 Thread ambijat

Hi! All.
This is a documentation of experience that I have faced after having 
named one of the mapsets with two words and a space eg. watershed 
analysis. There were a lot of problems in QGIS and GRASS as well for 
copying the data (raster n vector) and the values would not transfer. I 
hope there must be some indication while writing a name of mapset that 
it should be a single word.


Thanks!
Ambrish Dhaka
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Problem with Python Scripts and grass.script (GRASS 6.5SVN) on Mac

2011-03-29 Thread Johannes Radinger
Hello Michael,

thank you for your answer and your tip with the debugging code,
but it doesn't matter where I put it, I fail. I that case grass doesn't
open anymore the interactive menu (from g.parser) for that script and I just 
get the error:

my program gets this far
ERROR: Required parameter  not set:
(output)
ERROR: Required parameter  not set:
(input 1)
ERROR: Required parameter  not set:
(input 2)

if I leave the debugging code out, the interactive menu pops up and I can set 
the parameters, but nothing is afterwards processed.

what am I doing wrong?

/johannes


 Original-Nachricht 
> Datum: Tue, 29 Mar 2011 07:40:28 -0700
> Von: Michael Barton 
> An: grass-user grass-user , Johannes Radinger 
> 
> Betreff: [GRASS-user] Problem with Python Scripts and grass.script(GRASS  
> 6.5SVN) on Mac

> Hi Johannes,
> 
> Sorry I couldn't get back to you sooner. But it seems like others have
> told you about the line ending issue. That's a real problem because most
> people (myself included) will want to start out by copying an example program
> from the GRASS site. 
> 
> ...and it will utterly fail to run.
> 
> Anyway, now that your got it started, it is a debugging issue. Put in some
> debugging code like...
> 
> print 'my program gets this far'
> 
> ...at different places to see where it is getting stuck. This is tedious
> but always seems needed.
> 
> Michael
> 
> C. Michael Barton
> Director, Center for Social Dynamics & Complexity 
> Professor of Anthropology, School of Human Evolution & Social Change
> Arizona State University
> 
> voice:480-965-6262 (SHESC), 480-727-9746 (CSDC)
> fax:  480-965-7671 (SHESC),  480-727-0709 (CSDC)
> www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu
> 
> 
> 
> 
> 
> On Mar 29, 2011, at 3:25 AM,  wrote:
> 
> > Date: Tue, 29 Mar 2011 11:11:12 +0200
> > From: "Johannes Radinger" 
> > Subject: [GRASS-user] Problem with Python Scripts and grass.script
> > (GRASS  6.5SVN) on Mac
> > To: grass-user@lists.osgeo.org
> > Message-ID: <20110329091112.282...@gmx.net>
> > Content-Type: text/plain; charset="utf-8"
> > 
> > Hello Grass users!
> > 
> > I am working with GRASS 6.5 SVN (r45714, last weeks source) and try to
> run Python Scripts. After I solved the problem with the line endings, GRASS
> seems to be able to read my scripts (via launch script...). At least the
> interactive interface pops up correctly (it seems g.parser can read all my
> options etc.), but after executing it nothing happens and nothing is
> processed. I tried it with mapcalc but also with r.thin (one input, one 
> output, so
> very simple).
> > 
> > I don't know what is the problem or how can I check what the problem
> is...
> > ...what I've tried already and which may cause the problem is that I
> cannot import grass.script (import grass.script) in the Terminal (pyhton)
> and/or IDLE... it says: module not found...
> > 
> > Just for your information I run GRASS on a Apple Mac Snow Leopard
> (10.6.6)
> > with Python 2.6.6.
> > 
> > /johannes
> > -- 
> > NEU: FreePhone - kostenlos mobil telefonieren und surfen!   
> > Jetzt informieren: http://www.gmx.net/de/go/freephone
> 
> ___
> grass-user mailing list
> grass-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user

-- 
GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit 
gratis Handy-Flat! http://portal.gmx.net/de/go/dsl
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] Problem with Python Scripts and grass.script (GRASS 6.5SVN) on Mac

2011-03-29 Thread Michael Barton
Hi Johannes,

Sorry I couldn't get back to you sooner. But it seems like others have told you 
about the line ending issue. That's a real problem because most people (myself 
included) will want to start out by copying an example program from the GRASS 
site. 

...and it will utterly fail to run.

Anyway, now that your got it started, it is a debugging issue. Put in some 
debugging code like...

print 'my program gets this far'

...at different places to see where it is getting stuck. This is tedious but 
always seems needed.

Michael

C. Michael Barton
Director, Center for Social Dynamics & Complexity 
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University

voice:  480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax:  480-965-7671 (SHESC),  480-727-0709 (CSDC)
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu





On Mar 29, 2011, at 3:25 AM,  wrote:

> Date: Tue, 29 Mar 2011 11:11:12 +0200
> From: "Johannes Radinger" 
> Subject: [GRASS-user] Problem with Python Scripts and grass.script
>   (GRASS  6.5SVN) on Mac
> To: grass-user@lists.osgeo.org
> Message-ID: <20110329091112.282...@gmx.net>
> Content-Type: text/plain; charset="utf-8"
> 
> Hello Grass users!
> 
> I am working with GRASS 6.5 SVN (r45714, last weeks source) and try to run 
> Python Scripts. After I solved the problem with the line endings, GRASS seems 
> to be able to read my scripts (via launch script...). At least the 
> interactive interface pops up correctly (it seems g.parser can read all my 
> options etc.), but after executing it nothing happens and nothing is 
> processed. I tried it with mapcalc but also with r.thin (one input, one 
> output, so very simple).
> 
> I don't know what is the problem or how can I check what the problem is...
> ...what I've tried already and which may cause the problem is that I cannot 
> import grass.script (import grass.script) in the Terminal (pyhton) and/or 
> IDLE... it says: module not found...
> 
> Just for your information I run GRASS on a Apple Mac Snow Leopard (10.6.6)
> with Python 2.6.6.
> 
> /johannes
> -- 
> NEU: FreePhone - kostenlos mobil telefonieren und surfen! 
> Jetzt informieren: http://www.gmx.net/de/go/freephone

___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] New location with .prj file in tcltk

2011-03-29 Thread Aldo Clerici
Dear GRASS users and developers,

I'm trying to create a new location with the "Georeferenced file" button  in
the "Welcome"  window of the tcltk GUI, but an error message is output (see
error.png in attachment).

I tried with the gdc.prj file of the North Carolina data set and with other
.prj files, and with three different releases of 6.4.0.

With the "Location wizard" of the wxpython GUI the location is correctly
created.

Is this a bug of the tcltk GUI?

 

Greetings

 

Aldo Clerici

Parma University

 

<>___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Re: GUI for ps.map ready for testing

2011-03-29 Thread Martin Landa
Hi,

2011/3/29 Hamish :
>
> just copy the files in to the right places manually (try to follow the
> Makefile), but really a 6.5 or 7 snapshot built from source is you best
> bet.

it's quite easy, copy

docs/*.html -> gui/wxpython/docs
gui_modules/*.py -> gui/wxpython/gui_modules
xml/*.xml -> gui/wxpython/xml
images/*.png -> gui/images

and run in `gui`

$ make

Martin

-- 
Martin Landa  * http://geo.fsv.cvut.cz/~landa
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] Output of g.proj?

2011-03-29 Thread Thomas Huld
Hello,

I am trying to use the r.out.gmap script from grass-addons. This script 
generates map tiles for Google Maps based on an existing raster. 

I have generated a new location/mapset using the special EPSG code of 900913, 
defined at the end of /usr/local/share/proj/esri.extra. 

But when I try r.out.gmap it gives me an error:


ERROR: projection for location "google2" differs from required google map
   mercator projection
current projection: +proj=merc +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0
+k=1.0 +no_defs +a=6378137 +rf=298.257223563
+nadgrids=/usr/local/grass-6.4.1RC2/etc/nad/@null +to_meter=1
required projection: +proj=merc +lat_ts=0.00 +lon_0=0.00
+k_0=1.00 +x_0=0 +y_0=0 +no_defs +a=6378137 +b=6378137

(google2 being my new location).

(This happens both with GRASS-6.4.1RC2 and 6.4.0RC4)


The info on the current projection  in the script comes from the output of 
g.proj -jf.

This is slightly different from the information in esri.extra, which is 
identical to the "required projection" printed out in the error message.

Hence a couple of quick questions:

1) Does the difference mean I did something wrong in the definition of the 
location?

2) Does it matter? If you use the -f ('force') option to r.out.gmap it seems 
to work.

3) If (not 1)&&(not 2), I would suggest changing the r.out.gmap script to 
reflect the current output from g.proj.

TIA

Thomas


-- 
--
Thomas Huld   
Joint Research Centre of the European Commission
T.P. 450
I-21027 Ispra, Italy
phone: +39 0332785273
e-mail: thomas.h...@jrc.ec.europa.eu
--
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] Problem with Python Scripts and grass.script (GRASS 6.5SVN) on Mac

2011-03-29 Thread Johannes Radinger
Hello Grass users!

I am working with GRASS 6.5 SVN (r45714, last weeks source) and try to run 
Python Scripts. After I solved the problem with the line endings, GRASS seems 
to be able to read my scripts (via launch script...). At least the interactive 
interface pops up correctly (it seems g.parser can read all my options etc.), 
but after executing it nothing happens and nothing is processed. I tried it 
with mapcalc but also with r.thin (one input, one output, so very simple).

I don't know what is the problem or how can I check what the problem is...
...what I've tried already and which may cause the problem is that I cannot 
import grass.script (import grass.script) in the Terminal (pyhton) and/or 
IDLE... it says: module not found...

Just for your information I run GRASS on a Apple Mac Snow Leopard (10.6.6)
with Python 2.6.6.

/johannes
-- 
NEU: FreePhone - kostenlos mobil telefonieren und surfen!   
Jetzt informieren: http://www.gmx.net/de/go/freephone
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Using r.buffer on image with geographic coordinates

2011-03-29 Thread Markus Neteler
On Tue, Mar 29, 2011 at 8:27 AM, Markus Metz
 wrote:
...
> If you ran make in the v.buffer directory and afterwards configure,
> make and make install in /usr/local/src/grass6_devel, you would end up
> with v.buffer2.
>
> 1. run configure, make, but not make install in /usr/local/src/grass6_devel
>
> 2. run make in the v.buffer directory, watch out for errors to make
> sure it compiles all right
>
> 3. run make install in /usr/local/src/grass6_devel, but not again
> configure and/or make
>
> 4. that should give you the original v.buffer

An alternative: simply modify
  vector/Makefile
to point to v.buffer and not v.buffer2...

Markus
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user