[GRASS-user] Query raster type

Nikos Alexandris nik at nikosalexandris.net
Sat Jul 25 11:02:09 PDT 2015


* patrick s.:

> 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 ...

You could get that info with

r.info RasterMapName -g |grep datatype

So I think it is possible to adapt the "datatype" below somehow.

Nikos

> ...and get warnings:
> /
> 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;


More information about the grass-user mailing list