[GRASS-dev] i.rectify still chokes on @mapset

Glynn Clements glynn at gclements.plus.com
Mon Apr 27 01:34:13 EDT 2009


Hamish wrote:

> > Perhaps I misunderstand, but I thought the idea was that all GRASS modules
> > were supposed to respect @mapset now. Shouldn't a fix be heading in that
> > direction rather than finding a way to strip off the @mapset specifier?
> 
> it strips it off but at the same time populates another variable with
> the value.
> 
> actually the function I am thinking of changes the map name variable
> (stripping off the @mapset part) and returns the name of the mapset
> (or NULL if not found). So information is not lost, that's just the
> way it works in most raster modules too...

> here G_find_cell2() strips off the @mapset and returns the (confirmed)
> mapset name as it's result.

G_find_cell2() leaves the name untouched. G_find_cell() modifies the
name in place, so you can't use it on a const char * or if you need to
retain the @mapset part.

The ideal solution is to avoid explicitly dealing with mapsets
wherever possible. Map names taken from command line arguments or
files should just be passed down to library functions without
enquiring as to the structure of the name.

If this isn't possible, the next best solution is to determine whether
this can easily be rectified (no pun intended), e.g. by adding new
library functions.

In some cases, there are compatibility issues, e.g. existing file
formats which store the map name and mapset separately. This applies
to some of the imagery files.

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


More information about the grass-dev mailing list