[GRASS-dev] Re: [GRASS-user] GRASS 7.0 svn location/map creation using console

On Thu, Jul 30, 2009 at 8:13 PM, Glynn Clements<glynn@gclements.plus.com> wrote:

[CC to grass-dev]

(now really)

Enrico Gallo wrote:

I can use g.proj and g.mapset only inside GRASS environment,
but if I have non correct location I cannot enter in GRASS 7.x from
console, using -text flag, of course

Without the GUI, you currently have to create a new location manually,
e.g.:

olddbase=`g.gisenv get=GISDBASE`
g.gisenv set=GISDBASE=/path/to/database
g.proj -c location=newlocation ...
g.gisenv set=GISDBASE=$olddbase
g.mapset -c gisdbase=/path/to/database location=newlocation mapset=newmapset
g.mapset gisdbase=/path/to/database location=newlocation mapset=newmapset
g.region -d

See in Addons also "grass_create_location.sh" for this:
http://trac.osgeo.org/grass/browser/grass-addons/general/grass_create_location

(as so often, it should better a Python script, consider above a proof
of concept)

Note that GRASS 7 includes a dummy location at $GISDBASE/demolocation;
this can be used to get into GRASS, provided that you're the owner of
the GRASS installation (probably root).

For developers:

1. init.{sh,py} need an option to create a new database/location/mapset
without using the GUI.

2. g.proj should have a database= option so that -c can create a new
database along with the location.

3. g.mapset complains if the current database/location/mapset aren't
valid; it should probably be changed to use G_no_gisinit() to handle
this.

Markus