Michael Barton wrote:
I just ran into a couple modules that choke on map@mapset:
v.rast.stats
# does map exist in CURRENT mapset?
eval `g.findfile element=vector file="$VECTOR" mapset="$MAPSET"`
if [ ! "$file" ] ; then
g.message -e "Vector map <$VECTOR> not found"
exit 1
fi
------------------------------------------------------------------------
r23567 | markus | 2007-04-25 23:08:51 +0100 (Wed, 25 Apr 2007) | 2 lines
test improved: does map exist in CURRENT mapset?
v.db.addtable
# does map exist in CURRENT mapset?
eval `g.findfile element=vector file=$GIS_OPT_MAP mapset=$MAPSET`
if [ ! "$file" ] ; then
g.message -e "Vector map '$GIS_OPT_MAP' not found in current mapset"
exit 1
fi
------------------------------------------------------------------------
r22855 | markus | 2007-03-07 13:01:31 +0000 (Wed, 07 Mar 2007) | 2 lines
check if map exists in current mapset
Perhaps there are others. Can these be updated to accept the
map@mapset form?
One might assume that the author had some reason to require that the
map was in the current mapset, given that they put CURRENT in block
capitals.
In both cases, the script modifies the database associated with the
map, so it might only work for maps in the current mapset. Even if it
happens to work for maps in other mapsets, it may be reasonable to
explicitly prevent it (what if someone else is using the map?).
Or are you asking about the particular case of referencing maps which
happen to be in the current mapset using a qualified name? g.findfile
should[1] handle the situation where file= is qualified and the mapset
matches the mapset= option.
[1] I don't know whether it does; if it doesn't that's a g.findfile
bug.
Also, AFAICT, the parser only understands "old" maps (must exist, can
be in any mapset, won't be modified) and "new" maps (must not exist
unless --o etc is used, must be in the current mapset, will be
created). It doesn't have any concept of maps which are modified
in-place; this is rare for raster maps (only r.null springs to mind),
but seems to be not uncommon for vector maps.
--
Glynn Clements <glynn@gclements.plus.com>