[GRASS-dev] modules have problems with @mapset

Michael Barton michael.barton at asu.edu
Tue Feb 12 14:56:37 EST 2008


To make this work better with the GUI parser and not generate an  
error, the script should just strip off the @mapset portion of the name.

Michael
______________________________
Michael Barton, Professor
Professor of Anthropology
Director of Graduate Studies
School of Human Diversity & Social Change
Center for Social Dynamics & Complexity
Arizona State University
Tempe, AZ  85287-2402
USA

voice: 480-965-6262; fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

On Feb 12, 2008, at 1:25 PM, Glynn Clements wrote:

>
> Michael Barton wrote:
>
>> I just ran into a couple modules that choke on map at 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 at 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 at gclements.plus.com>



More information about the grass-dev mailing list