[GRASS-user] Getting Started with GRASS Python Scripts

Nikos Alexandris nik at nikosalexandris.net
Thu May 23 17:14:07 PDT 2013


Martin Lacayo wrote:

> I think I have now figured out most of the answers to my question, but
> I am still wondering about some file management.


If I may chime in, I repeat what Richard already explained actually, just for 
fun :-)

The GRASS GIS data base is the root (of all good geospatial analyses :D). 
Inside it are put Locations.  There can be only one reference system per 
Location. And, inside a Location, Mapsets help to organise stuff.  Note, there 
is always a PERMANENT Mapset per Location and users may/should use it as a 
pool for imported data from which to draw the material that is to be 
processed.


> Is the following command a "normal" way to make a location with a
> projection from a georeferenced file:
> 
>  g.proj -c georef=/home/user/raster.tif location=example

Absolutely.  But, 

1) be careful to define a "location=" otherwise the current location will be 
altered.

2) only from inside an existing GRASS Location!  From outside, you may use 
something like the following

grass70 -c /geo/geodata/SomePointOfInterest.kml 
/geo/grassdb/testing/Test_Location

In this example, the georeferenced file "SomePointOfInterest.kml" will be used 
obtain information about the spatial reference system and a Location will be 
created.  Actually, any georeferenced file recognised by GDAL/OGR should be a 
valid source

Depending on how many of the directories given in the path pre-exist, a Mapset 
will be created (if GISDBASE and LOCATION pre-exist), a LOCATION will be 
created as the last part of the defined path (if only the GISDBASE pre-
exists), etc.

Please, check also the output of 'grass --help' if working in the command line 
(because the word "Scripts" is mentioned in the subject of this thread).

> Is there a command to delete a location?

No. One has/can simply delete it as any other directory.

> I found g.mremove, but that seems to remove data, not locations.

Yes, "g.remove" is for removing single elements inside a GRASS GIS data base 
(raster and vector maps, groups of raster maps and other).  "g.mremove"  (note 
"_m_remove" instead of simply "remove") is for removing multiple elements/maps 
in one go by defining a naming pattern using regular expressions.

Best, Nikos


More information about the grass-user mailing list