Hi Micha and Nikos
This was exactly what I was looking for! "Eval" seems a bit more
straightforward, as I do not need to query the string, but both
approaches seem to be valid.
Thanks a lot!
Patrick
/for i in `g.list type=rast`//
//do //
// echo "adding layer '$i'" //
// eval `r.info -g $i`//
// if [ $datatype == "CELL" ] //
// then//
// v.db.addcolumn map=pt_grid column="$i integer"//
// else//
//# if ( $datatype == 'DCELL' ) //
// v.db.addcolumn map=pt_grid column="$i double"//
// fi//
// v.what.rast map=pt_grid rast=$i col=$i//
//done;//
/
On 25.07.2015 19:47, Micha Silver wrote:
On 07/25/2015 08:08 PM, patrick s. wrote:
Dear all
Is there a function in GRASS70 to match multiple rasters as values to
a point-vector. Some of the rasters are of type integer, some of type
float and the columns should ideally respect the datatype. It might
be possible as a bash.loop on v.what.rast, but I do not find a way to
query the datatype of a raster and get warnings:
You can use r.info -g to get information about each rast, including
datatype.
So:
eval `r.info -g $i`
will put all raster parameters into shell variables, among them datatype.
if ( $datatype == 'CELL' ) ...
/
for i in `g.list type=rast ` #ideally //only type integer OR float
//do //
// echo "adding layer '$i'" //
// v.db.addcolumn map=pt_grid column="$i double" #adapt datatype
of column according to raster type//
// v.what.rast map=pt_grid rast=$i col=$i//
//done;
/Happy about any help and hint,
Patrick
/
/
This mail was received via Mail-SeCure System.
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user
This mail was received via Mail-SeCure System.
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user