[GRASSLIST:7694] g.mapset OR g.gisenv (GUI wishlist discussion)

having posted a wish to be able to move between mapsets and locations without closing out of GRASS I was given two options from two people (ref bug#3456).

One was g.mapset and the other is g.gisenv. Some questions.

1. What is the difference between the two
2. Can a button be built in to show ALL mapsets and coresponsing locations for either or both of these. This could enhance the gui
3. It appears that g.mapset creates only a NEW location. How do you access a created location that is not current.
4. for g.gisenv is it possible to provide options of what variables are possible to change? eg dataset, mapset, location and have these accesible through a button.
5. could someone provide an example of how I might COMPLETELY move from one location and mapset to a new location with a mapset of the same name.
6. Is thera followup wish I should post?

Again, I'm looking at this function from a users point of view. I'm sure I will learn when I get the hang of it.

--
+---------------------------------------------------------------+
|Dave Sampson: Geographic Information System (GIS) Technician |
| |
|Centre for Sustainable Watersheds |
|Cooperative Approaches to Protect Canada's Water Resources |
| |
|14 Water St, P.O Box 280. Portland Ontario, Canada. K0G 1V0 |
|Lat: 44.700 Long: -76.19 |
|www.watersheds.ca gis@watersheds.ca |
+---------------------------------------------------------------+

Dave Sampson wrote:

having posted a wish to be able to move between mapsets and locations
without closing out of GRASS I was given two options from two people
(ref bug#3456).

One was g.mapset and the other is g.gisenv. Some questions.

1. What is the difference between the two

g.gisenv is a general-purpose utility for modifying GRASS parameters.

g.mapset is more specific. It can only modify the GISDBASE,
LOCATION_NAME and MAPSET parameters; however, it does some sanity
checking, handles locking correctly, etc.

With the addition of g.mapset, the g.gisenv approach should be
considered deprecated.

2. Can a button be built in to show ALL mapsets and coresponsing
locations for either or both of these. This could enhance the gui

It would be possible to make the location and mapset fields into combo
boxes.

3. It appears that g.mapset creates only a NEW location. How do you
access a created location that is not current.

If so, that's a bug. The code explicitly checks that the selected
database, location or mapset exists.

4. for g.gisenv is it possible to provide options of what variables are
possible to change? eg dataset, mapset, location and have these
accesible through a button.

Not realistically; the set of GRASS variables is open-ended.

g.gisenv is a low-level tool, primarily for use by scripts, or for
quick hacks where a more suitable tool doesn't exist.

5. could someone provide an example of how I might COMPLETELY move from
one location and mapset to a new location with a mapset of the same name.

Convenient tools for creating a new database, location or mapset are
currently missing. At present, this can only easily be done at
startup.

--
Glynn Clements <glynn@gclements.plus.com>

Dave,

I'd just like to reiterate what Glynn said. G.mapset (not g.mapsets) does
exactly what I think you want to do.

It allows you to move completely between mapsets within a location, between
locations (and mapsets) within your GRASS database (i.e., the folder where
you keep GRASS locations), and between different GRASS databases (with their
own locations and mapsets).

For example, let's assume you are working in the "PERMANENT" mapset of the
"wgs84" location of your gisdbase /home/dave/grassdata

Issuing the command (or doing the same thing via the GUI)...

g.mapset mapset=PERMANENT location=nad27 gisdbase=/home/dave/grassdata2

...would now have you working in the "PERMANENT" mapset of location "nad27"
in the GRASS database /home/dave/grassdata2

The command...

g.mapset mapset=PERMANENT location=wgs84 gisdbase=/home/dave/grassdata

...would have you working back in the place (mapset - location - gisdbase)
where you started.

You need to know the name of the database, location, and/or mapset you want
to move to. No browse buttons at the moment, but as Glynn says they could be
added to the GUI with some programming.

Nevertheless, I think this does what you want.

Note, you can also open multiple sessions of GRASS 6.1. That is, you can
start GRASS in the "wgs84" location and then start another session in the
"nad27" location.

Michael

On 7/23/05 4:55 PM, "Glynn Clements" <glynn@gclements.plus.com> wrote:

Dave Sampson wrote:

having posted a wish to be able to move between mapsets and locations
without closing out of GRASS I was given two options from two people
(ref bug#3456).

One was g.mapset and the other is g.gisenv. Some questions.

1. What is the difference between the two

g.gisenv is a general-purpose utility for modifying GRASS parameters.

g.mapset is more specific. It can only modify the GISDBASE,
LOCATION_NAME and MAPSET parameters; however, it does some sanity
checking, handles locking correctly, etc.

With the addition of g.mapset, the g.gisenv approach should be
considered deprecated.

2. Can a button be built in to show ALL mapsets and coresponsing
locations for either or both of these. This could enhance the gui

It would be possible to make the location and mapset fields into combo
boxes.

3. It appears that g.mapset creates only a NEW location. How do you
access a created location that is not current.

If so, that's a bug. The code explicitly checks that the selected
database, location or mapset exists.

4. for g.gisenv is it possible to provide options of what variables are
possible to change? eg dataset, mapset, location and have these
accesible through a button.

Not realistically; the set of GRASS variables is open-ended.

g.gisenv is a low-level tool, primarily for use by scripts, or for
quick hacks where a more suitable tool doesn't exist.

5. could someone provide an example of how I might COMPLETELY move from
one location and mapset to a new location with a mapset of the same name.

Convenient tools for creating a new database, location or mapset are
currently missing. At present, this can only easily be done at
startup.

____________________
C. Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
PO Box 872402
Arizona State University
Tempe, AZ 85287-2402
USA

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

Michael Barton wrote:

You need to know the name of the database, location, and/or mapset you want
to move to. No browse buttons at the moment, but as Glynn says they could be
added to the GUI with some programming.

More precisely, g.mapset could be made to enumerate the legal values
for location/mapset, in which case the GUI would automatically show a
combo box rather than a text field.

However:

1. You can't enumerate the set of possible database directories. You
might be able to specify it as type "file", in which case a "browse"
button would appear which opens a file selection dialog. However, I
don't know if this works with directories at present; if it doesn't,
it shouldn't be a great deal of work to change it.

2. It would only be practical to enumerate the locations for the
current database directory, and the mapsets for the current location.
If you wanted to change all three, you would have to do it one step at
a time (change database, change location within the new database,
change mapset within the new location).

--
Glynn Clements <glynn@gclements.plus.com>

Glynn,

This is indeed the best way for this to work. If we could get a browse
function that could recognize directories, it would also be useful elsewhere
(e.g. V.in.ogr).

Michael

On 7/26/05 12:54 AM, "Glynn Clements" <glynn@gclements.plus.com> wrote:

Michael Barton wrote:

You need to know the name of the database, location, and/or mapset you want
to move to. No browse buttons at the moment, but as Glynn says they could be
added to the GUI with some programming.

More precisely, g.mapset could be made to enumerate the legal values
for location/mapset, in which case the GUI would automatically show a
combo box rather than a text field.

However:

1. You can't enumerate the set of possible database directories. You
might be able to specify it as type "file", in which case a "browse"
button would appear which opens a file selection dialog. However, I
don't know if this works with directories at present; if it doesn't,
it shouldn't be a great deal of work to change it.

2. It would only be practical to enumerate the locations for the
current database directory, and the mapsets for the current location.
If you wanted to change all three, you would have to do it one step at
a time (change database, change location within the new database,
change mapset within the new location).

____________________
C. Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
PO Box 872402
Arizona State University
Tempe, AZ 85287-2402
USA

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

On Sat, 23 Jul 2005 16:09:21 -0400

having posted a wish to be able to move between mapsets and locations
without closing out of GRASS I was given two options from two people
(ref bug#3456).

One was g.mapset and the other is g.gisenv. Some questions.

..

2. Can a button be built in to show ALL mapsets and coresponsing
locations for either or both of these. This could enhance the gui

[replying to another old email, but a handy hint]

have a look at g.mapsets for setting which mapsets are in the map name
search path, and also be aware of the mapname@mapset syntax which isn't
well documented outside of the books. And "g.list rast mapset=..."

i.e. you can access maps from different mapsets without switching.
For a location (change of map projection), you'd need to use the *.proj
modules to bring the map into the current location/mapset or use a
different GRASS session.

Hamish