[GRASS-user] New CLI option --tmp-location in 7.5 to enhance --exec

Vaclav Petras wenzeslaus at gmail.com
Tue Aug 14 20:20:16 PDT 2018

Dear user list,

The (main) GRASS GIS executable, usually available as simply `grass` on
most systems has now a new option (flag/parameter) in trunk (aka 7.5). The
option is called --tmp-location.

When specified, GRASS GIS automatically creates an new (and empty) location
based on provided EPSG code or georeferenced file (similarly to what -c
flag does). Newly it is also possible to provide string "XY" instead of
EPSG to create XY (non-georeferenced) location.

This temporary location has only PERMANENT mapset and the whole location is
removed. The location is created in a temporary directory (which is also
deleted at the end).

The flag --tmp-location is meant to be used together with --exec and it is
a part of a lager endeavor to make the CLI easier for use from outside of
the GRASS GIS session.

If you are interested, please, test this new functionality. It is an
opportunity to provide feedback before this feature lands in the 7.6

Here are some things to try:

* Execute a module in a location created based on EPSG:

  grass --tmp-location EPSG:3358 --exec g.region -p

* Execute Python script in a location created based on EPSG:

  grass --tmp-location EPSG:3358 --exec script.py

* Examine the created location using a Bash command:

  grass --tmp-location EPSG:3358 --exec bash -c "g.proj -p && g.region -p
&& g.mapset -p && g.gisenv GISDBASE,LOCATION_NAME sep=/"

* Get SRS/CRS for a file:

  grass --tmp-location ~/data/elevation.tiff --exec g.proj -p

* Get help text for a module:

  grass --tmp-location XY --exec r.neighbors --help

See the documentation and `grass --help` for more hints (and let me know
how these can be enhanced).

Best regards,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20180814/d06cb09d/attachment.html>

More information about the grass-user mailing list