[GRASS-user] Get current location projection in a Python Script

Nikos Alexandris nikos.alexandris at felis.uni-freiburg.de
Tue May 25 14:14:02 EDT 2010


Kim Besson:
> >>> I'm building a GRASS Python Script to automatically import a set of
> >>> data to my location. At GRASS book (chapter 3.3.3) it uses g.proj -wf
> >>> to to check current location projection. Can I use the same command in
> >>> Python to retrieve the same?

> >>> And how about calling gdalwarp in a Python-GRASS Script? can it be
> >>> called and used by a Python_GRASS Script? if so, is there any Python
> >>> example with that?
> >>> 
> >>> Regarding "g.proj -wf" command. I get a lot of information. I suppose
> >>> GDALWARP can read this right ? If not, How can I obtain current
> >>> Location EPSG code? 

Michael Barton:
> >> Use the region() command from the GRASS Python library.
> >> <http://download.osgeo.org/grass/grass6_progman/pythonlib.html>

Nikos Alexandris:
> > Just for the records, a thread not _directly_ about it but close
> > (enough?):
> > <http://osgeo-org.1803224.n2.nabble.com/Getting-rows-cols-of-a-region-in
> > -a- script-tc2787474.html#a2788062>
 
> The thread is for BASH and does not work for Python.

Michael, the thread started for bash but in the last posts (in it) python 
stuff are demonstrated ( I recall so). Maybe I've posted directly a post where 
no "python" is included? Hmm... let me see... ... ok, here it is:

1. http://www.mail-archive.com/grass-user@lists.osgeo.org/msg08280.html
2. http://www.mail-archive.com/grass-user@lists.osgeo.org/msg08288.html

Maybe they are outdated though (?).

Cheers, Nikos


More information about the grass-user mailing list