[GRASS-dev] v.rast.stats - was Re: QGIS winGRASS blank space problem

Hamish hamish_nospam at yahoo.com
Wed Jul 4 03:44:14 EDT 2007


> Glynn Clements wrote:
> >> > Also, I would be inclined to clean up the above by looping over
> >> > the column names i.e.:
> >> > 
> >> >  (
> >> >   for var in n min max range mean stddev variance cf_var sum ; do
> >> >   eval val=\${$var}
> >> >   if [ $DBFDRIVER -eq 1 ] ; then
> >> >    col="`echo ${COLPREFIX}_${var}| cut -b1-10`"
> >> >   else
> >> >    col="${COLPREFIX}_${var}"
> >> >   fi
> >> >   echo "UPDATE $VECTOR SET ${col}=${val} WHERE cat=$i;"
> >> >  ) | db.execute database=$DB_DATABASE driver=$DB_SQLDRIVER

Markus:
> I have seen the changes in CVS. Is the module now (way) faster?
> That would be great.

db.execute is now run once per session when it used to run once per cat.

It should be slightly faster. The bigger improvement is with code
readability/simplicity. Note it doesn't follow the (...) | db.execute
method shown above, it writes all commands to a file and then passes
that to db.execute. (debugging is easier with a paper trail)



Hamish




More information about the grass-dev mailing list