[GRASS-user] windows format for temporary file path
Richard Edmonds
richard.edmonds at lasra.co.nz
Mon Mar 19 17:12:03 EDT 2012
On 16/03/2012 6:14 p.m., Glynn Clements wrote:
>
> The "usual" convention for temporary map names is to combine the name
> of the script, "tmp", and the current PID, e.g.:
>
> temprast="myscript.tmp.$$"
>
OK, now using that convention
> There doesn't appear to be anything wrong with your commands; whatever
> value is chosen for temp1, I would expect "g.remove rast=$temp1" to
> remove the map created by "v.to.rast ... output=$temp1", provided that
> it hasn't changed in the meantime.
>
Ok this is very strange, my script is very small 30 odd lines, using the
correct convention I still get an error. Here's a script with ONLY the
offending commands as follows with the subsequent error:
#!/bin/sh
# g.parser demo script for shell programing
#%module
#% description: g.parser test script
#%end
#%option
#% key: input_vector
#% type: string
#% gisprompt: old,vector,vector
#% description: shoreline vector file
#% required : yes
#%end
if [ -z "$GISBASE" ] ; then
echo "You must be in GRASS GIS to run this program." 1>&2
exit 1
fi
if [ "$1" != "@ARGS_PARSED@" ] ; then
exec g.parser "$0" "$@"
fi
if [ -n "$GIS_OPT_OPTION1" ] ; then
echo "Value of GIS_OPT_OPTION1: '$GIS_OPT_OPTION1'"
fi
TMPLAYER1="v.myscript.tmp.$$"
v.to.rast --overwrite input=$GIS_OPT_INPUT_VECTOR output=$TMPLAYER1
use=attr column=elevation
echo $TMPLAYER1
g.remove rast=$TMPLAYER1
# DONE
v.myscript.tmp.1564
Loading data...
Reading features...
Writing raster map...
Converted areas: 0 of 0
Converted points/lines: 4 of 4
v.to.rast complete.
Removing raster <v.myscript.tmp.1564>
raster: couldn't be removed
(Tue Mar 20 08:41:16 2012) Command finished (0 sec)
If my script appears correct and I still cant correctly remove the temp
layer I've created does this mean I've got a setting deep in GRASS set
incorrectly, or is it related to the fact I'm running winGRASS? Perhaps
something to do with the data? Permissions problems (my go-to bug in
LINUX) seem unlikely if GRASS made the file to begin with. I'm stumped,
nothing I've read so far seems to relate. Perhaps this is a simple
enough script for someone to copy and paste into winGRASS/GRASS and confirm?
More information about the grass-user
mailing list