[GRASS-user] Getting Started with GRASS Python Scripts

Martin Lacayo mlacayo at stanford.edu
Thu May 23 13:49:15 PDT 2013


Hello,

I am having trouble getting started with GRASS Python scripts. I am
using GRASS 6.4 on Debian. Could some provide a basic example of a
Python script that imports a raster and exports the same raster? In
particular I am interested in seeing the entire setup of a database
(locally on disk), location, and mapset from start to finish. Every
example I have found starts with an existing database, location, and
mapset. I have been able to get past this part by using the GUI, but I
need to be able to script their creation.

Have I understood correctly that a database can only contain one
projection, which is set when it is first created, and that besides
importing and exporting data all processing has to happen with data
that is in the database?

My ultimate goal is to decrease our development time for our open
source ecosystem service tools: http://invest-natcap.googlecode.com,
but more specifically at the moment I am trying to use r.viewshed so I
do not have to write my own.

Is it possible to script the creation of a database (locally on disk),
location, and mapset? And how would you remove them afterwards?

Any help or references would be very appreciated.

Thank you,
Martin


More information about the grass-user mailing list