<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Micha and Nikos<br>
<br>
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.<br>
<br>
Thanks a lot!<br>
Patrick<br>
<br>
<br>
<br>
<i>for i in `g.list type=rast`</i><i><br>
</i><i>do </i><i><br>
</i><i> echo "adding layer '$i'" </i><i><br>
</i><i> eval `r.info -g $i`</i><i><br>
</i><i> if [ $datatype == "CELL" ] </i><i><br>
</i><i> then</i><i><br>
</i><i> v.db.addcolumn map=pt_grid column="$i integer"</i><i><br>
</i><i> else</i><i><br>
</i><i># if ( $datatype == 'DCELL' ) </i><i><br>
</i><i> v.db.addcolumn map=pt_grid column="$i double"</i><i><br>
</i><i> fi</i><i><br>
</i><i> v.what.rast map=pt_grid rast=$i col=$i</i><i><br>
</i><i>done;</i><i><br>
</i><br>
<br>
<div class="moz-cite-prefix">On 25.07.2015 19:47, Micha Silver
wrote:<br>
</div>
<blockquote cite="mid:55B3CBC0.7@arava.co.il" type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
<br>
<br>
<div class="moz-cite-prefix">On 07/25/2015 08:08 PM, patrick s.
wrote:<br>
</div>
<blockquote cite="mid:55B3C277.5020800@gmx.net" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
Dear all<br>
<br>
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:<br>
</blockquote>
<br>
You can use r.info -g to get information about each rast,
including datatype.<br>
So:<br>
eval `r.info -g $i`<br>
will put all raster parameters into shell variables, among them
datatype.<br>
if ( $datatype == 'CELL' ) ...<br>
<blockquote cite="mid:55B3C277.5020800@gmx.net" type="cite"> <i><br>
for i in `g.list type=rast ` #ideally </i><i>only type
integer OR float<br>
</i><i>do </i><i><br>
</i><i> echo "adding layer '$i'" </i><i><br>
</i><i> v.db.addcolumn map=pt_grid column="$i double" #adapt
datatype of column according to raster type</i><i><br>
</i><i> v.what.rast map=pt_grid rast=$i col=$i</i><i><br>
</i><i>done;<br>
<br>
</i>Happy about any help and hint,<br>
Patrick<br>
<i><br>
</i><br>
<br>
<br>
This mail was received via Mail-SeCure System.<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
grass-user mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/grass-user">http://lists.osgeo.org/mailman/listinfo/grass-user</a>
This mail was received via Mail-SeCure System.
</pre>
</blockquote>
<br>
</blockquote>
<br>
</body>
</html>