Thanks all (esp. Jachym, Dylan, Jonathan)<br>
<br>
Dylan/Jonathan, I havent tried Starspan, but it <br>looks good. i'll get into it if i find i have to. I cant compile from sourcecode since i'm not that Linux savvy.<br>
<br>
Jachym, I tried your approach on a small set of 12 rasters. v.what.vect
is not there in my Grass 6.0.1; but i was able to do the same thing
with v.what.rast<br>
Basically values from each raster were added on as a column in the vector attribute table. Thanks Jachym!<br>
<br>
However, even with just 12 rasters, it took a bit of time (~10
seconds). With some 100 rasters to process at a time, I have the
following doubts:<br>
1. Can the vector attribute table handle 100 additional tables, or is there a limit?<br>
<br>
2. My rasters are large, covering south asia (60E-100E, 5N-45N; 0.5
degree resolution). My vectors are very small (covering small part of
south-west India). Perhaps this effects the processing time..should i
mask the rasters and then do the adding of columns?<br>
<br>
3. Since my watershed are small, most fall within one
pixel. When they do cross 2 pixels, the v.to.rast clips the
raster watershed to one pixel. Any suggestion on perhaps better ways of
handling this?<br>
<br>
Thanks very much! <br>
cheers,<br>
vishal<br>
<br>
<br>
<div><span class="gmail_quote">On 6/27/06, <b class="gmail_sendername">Jachym Cepicky</b> <<a href="mailto:jachym.cepicky@centrum.cz">jachym.cepicky@centrum.cz</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hallo,<br><br>On Tue, Jun 27, 2006 at 04:16:38PM +0530, Vishal Mehta wrote:<br>> Hi all,<br>><br>> I have a vector polygon shapefile which contains 8 polygons (each watershed<br>> is a polygon). I also have some 100 GRASS raster files of environmental data
<br>> (rainfall, temperature etc).<br>><br>> Whats the best way to extract for each watershed, the corresponding average<br>> data from each raster file and put it in a text file?<br>><br>> I've looked at
v.what.rast but it seems to be quite cumbersome for this<br>> application. I'm using Grass 6.0.1 on Ubuntu linux.<br>><br>> cheers,<br>> vishal<br><br>v.type in=polygons out=polygons2 type=centroid,point<br>v.to.rast
in=polygons2 out=wathershed use=cat<br>r.average base=wathershed cover=rainfalls out=rainfalls.avg<br>echo "ALTER TABLE polygons2 ADD COLUMN rainfalls double"|db.execute<br>v.what.vect vect=polygons2 rast=rainfalls.avg
coulmn=rainfalls<br>...<br><br>v.type in=polygons2 out=polygons3 type=point,centroid<br>d.vect polygons3<br>d.what.vect polygons3<br><br><br>in the batch:<br><br>#----<br># convert centorids to points<br>v.type in=polygons out=polygons2 type=centroid,point
<br>v.to.rast in=polygons2 out=wathershed use=cat<br><br># make 100 rasters<br>for raster in $( g.mlist rast ); do<br> echo "Working on: $raster"<br> r.average base=wathershed cover=$raster out=$raster.avg
<br> echo "ALTER TABLE polygons2 ADD COLUMN $raster double"|db.execute<br> v.what.vect vect=polygons2 rast=$raster.avg coulmn=$raster<br><br># convert points to centroids<br>v.type in=polygons2 out=polygons3 type=point,centroid
<br>d.vect polygons3<br>d.what.vect polygons3<br>#----<br><br>copy & paste<br><br>jachym<br><br>--<br>Jachym Cepicky<br>e-mail: <a href="mailto:jachym.cepicky@centrum.cz">jachym.cepicky@centrum.cz</a><br>URL: <a href="http://les-ejk.cz">
http://les-ejk.cz</a><br>GPG: <a href="http://les-ejk.cz/gnupg_public_key/jachym_cepicky-gpg_public_key.asc">http://les-ejk.cz/gnupg_public_key/jachym_cepicky-gpg_public_key.asc</a><br>-----------------------------------------
<br>OFFICE:<br>GDF-Hannover<br>Mengendamm 16d<br>30177 Hannover<br>Germany<br>e-mail: <a href="mailto:cepicky@gdf-hannover.de">cepicky@gdf-hannover.de</a><br>URL: <a href="http://gdf-hannover.de">http://gdf-hannover.de
</a><br>Tel.: +49 511-39088507<br><br><br>-----BEGIN PGP SIGNATURE-----<br>Version: GnuPG v1.4.3 (GNU/Linux)<br><br>iD8DBQFEoSC6yKt0uAjU4I8RAs7bAJ0VbEJZ7763uMKCL7HPRQvCk7XztQCfarwE<br>yKmI8KxGdTk0qskBiEFSE2E=<br>=CJ47<br>
-----END PGP SIGNATURE-----<br><br><br></blockquote></div><br>