Alright, I just figured out a way to do it, albeit an unelegant way that requires using another program.<div><br></div><div>I converted the rasters to vectors as usual. Then I did the following in order to preserve the original polygons:</div>
<div>- Extracted the centroids by using v.select</div><div>- Converted the centroids to points with v.type_wrapper</div><div>- Do a join by location between the polygons in points in QGIS</div><div><br></div><div>That worked, but it is VERY unelegant. Does anyone have a better idea? If not, perhaps that'll help someone else :) It'd definitely be much more elegant if I were to do the whole thing in PostGIS, but in the interest of time I decided not to this time.</div>
<div>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="font-family:arial, sans-serif;font-size:13px;background-color:rgb(255, 255, 255)"></span></p><p>--<br></p><p>B.Sc. Daniel Lee<br>
Geschäftsführung für Forschung und Entwicklung<br>ISIS - International Solar Information Solutions</p><p>Deutschhausstr. 10<br>35037 Marburg<br>Festnetz: <a value="+4964213796256" style="color:rgb(28, 81, 168)">+49 6421 379 6256</a><br>
Mobil: <a value="+4917661277269" style="color:rgb(28, 81, 168)">+49 176 6127 7269</a><br>E-Mail: <a href="mailto:Lee@isi-solutions.org" style="color:rgb(28, 81, 168)" target="_blank">Lee@isi-solutions.org</a><br>Web: <a href="http://www.isi-solutions.org/" style="color:rgb(28, 81, 168)" target="_blank">http://www.isi-solutions.org</a></p>
<p>ISIS wird gefördert durch die Bundesrepublik Deutschland, Zuwendungsgeber: Bundesministerium für Wirtschaft und Technologie aufgrund eines Beschlusses des Deutschen Bundestages, sowie durch die Europäische Union, Zuwendungsgeber: Europäischer Sozialfonds.<br>
Zusätzliche Unterstützung erhält ISIS von dem Entrepreneurship Cluster Mittelhessen, der Universität Marburg, dem Laboratory for Climatology and Remote Sensing und dem GIS-Lab Marburg.</p><p></p><br>
<br><br><div class="gmail_quote">2011/11/21 Daniel Lee <span dir="ltr"><<a href="mailto:lee@isi-solutions.org">lee@isi-solutions.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="gmail_quote"><div class="im">2011/11/21 daniel mcinerney <span dir="ltr"><<a href="mailto:daniel.o.mcinerney@gmail.com" target="_blank">daniel.o.mcinerney@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>According to the documentation of [1] and previous discussions [2], <br>v.rast.stats2 should be a lot faster.<br></div></blockquote></div><div>Awesome! Only... I've got a problem here... Sorry to be so nooby, but here's what's going on:</div>
<div><br></div><div><div>GRASS 6.4.2RC1 (ETRS89_ll):~ > g.extension extension=r.univar.zonal</div><div>WARNING: GRASS_ADDON_PATH is not defined, installing to ~/.grass6/addons/</div><div>Fetching <r.univar.zonal> from GRASS-Addons SVN (be patient)...</div>
<div>A r.univar.zonal/stats.c</div><div>A r.univar.zonal/sort.c</div><div>A r.univar.zonal/globals.h</div><div>A r.univar.zonal/r.univar.zonal.html</div><div>A r.univar.zonal/r.univar_main.c</div><div>A r.univar.zonal/r3.univar.zonal.html</div>
<div>A r.univar.zonal/r3.univar_main.c</div><div>A r.univar.zonal/Makefile</div><div> U r.univar.zonal</div><div>Checked out revision 49316.</div><div>Compiling <r.univar.zonal>...</div><div>Makefile:10: /opt/grass/include/Make/Multi.make: No such file or directory</div>
<div>make: *** No rule to make target `/opt/grass/include/Make/Multi.make'. Stop.</div><div>ERROR: Compilation failed, sorry. Please check above error messages.</div></div><div><br></div><div>I can't find any Multi.make either, except for in my GRASS 7 sources. I'm actually wanting to work in GRASS 6, but even if I try the same command in GRASS 7, another problem happens. Although I did swap the repository for it, that might be causing the problem (?)? Here it is:</div>
<div><br></div><div><div>GRASS 7.0.svn (ETRS89_ll@Niedersachsen_Test):~ > g.extension extension=r.univar.zonal svnurl=<a href="https://svn.osgeo.org/grass/grass-addons/" target="_blank">https://svn.osgeo.org/grass/grass-addons/</a></div>
<div>Fetching 'r.univar.zonal' from GRASS-Addons SVN (be patient)...</div><div>A r.univar.zonal/stats.c</div><div>A r.univar.zonal/sort.c</div><div>A r.univar.zonal/globals.h</div><div>A r.univar.zonal/r.univar.zonal.html</div>
<div>A r.univar.zonal/r.univar_main.c</div><div>A r.univar.zonal/r3.univar.zonal.html</div><div>A r.univar.zonal/r3.univar_main.c</div><div>A r.univar.zonal/Makefile</div><div> U r.univar.zonal</div><div>Checked out revision 49316.</div>
<div>Compiling 'r.univar.zonal'...</div><div>mkdir -p /home/lee/Documents/GRASS_Data/ETRS89_ll/Niedersachsen_Test/.tmp/pc19453/6059.0/r.univar.zonal/etc/r.univar.zonal</div><div>test -d OBJ.x86_64-unknown-linux-gnu || mkdir -p OBJ.x86_64-unknown-linux-gnu</div>
<div>gcc -g -Wall -Werror-implicit-function-declaration -fno-common -Wextra -Wunused -I/usr/local/grass-7.0.svn/include -I/usr/local/grass-7.0.svn/include -D_FILE_OFFSET_BITS=64 -DPACKAGE=\""grassmods"\" -I/usr/local/grass-7.0.svn/include -I/usr/local/grass-7.0.svn/include -o OBJ.x86_64-unknown-linux-gnu/r.univar_main.o -c r.univar_main.c</div>
<div>In file included from r.univar_main.c:21:0:</div><div>globals.h:22:23: fatal error: grass/G3d.h: No such file or directory</div><div>compilation terminated.</div><div>make: *** [OBJ.x86_64-unknown-linux-gnu/r.univar_main.o] Error 1</div>
<div>ERROR: Compilation failed, sorry. Please check above error messages.</div></div><div><br></div><div>I tried hardwiring my top include folder (/usr/local/grass-7.0.svn/) where the makefile seemed to be looking for Multi.make into the makefile, but that didn't help either. Any ideas?</div>
<div class="im">
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div> </div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>You should be able to change the BASECOLS variable in the script<br>to only output the sums, which might speed things up for you.</div></blockquote></div></div>Do you mean just taking the line in v.rast.stats2 with <div>
<pre style="word-wrap:break-word;white-space:pre-wrap">BASECOLS="n min max range mean stddev variance cf_var sum"
</pre></div><div>and removing everything except for sum? Unfortunately, my knowledge of bash scripting limits me here, I'd just try it out, but since I can't get the extension installed yet anyway I figured I'd ask.</div>
<div><br></div><div>Thanks a lot!</div><span class="HOEnZb"><font color="#888888"><div>Daniel</div>
</font></span></blockquote></div><br></div>