[GRASS-user] Joining vectors by location

Daniel Lee lee at isi-solutions.org
Mon Nov 21 13:24:39 EST 2011


Alright, I just figured out a way to do it, albeit an unelegant way that
requires using another program.

I converted the rasters to vectors as usual. Then I did the following in
order to preserve the original polygons:
- Extracted the centroids by using v.select
- Converted the centroids to points with v.type_wrapper
- Do a join by location between the polygons in points in QGIS

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.

--

B.Sc. Daniel Lee
Geschäftsführung für Forschung und Entwicklung
ISIS - International Solar Information Solutions

Deutschhausstr. 10
35037 Marburg
Festnetz: +49 6421 379 6256
Mobil: +49 176 6127 7269
E-Mail: Lee at isi-solutions.org
Web: http://www.isi-solutions.org

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




2011/11/21 Daniel Lee <lee at isi-solutions.org>

> 2011/11/21 daniel mcinerney <daniel.o.mcinerney at gmail.com>
>
>> According to the documentation of [1] and previous discussions [2],
>> v.rast.stats2 should be a lot faster.
>>
> Awesome! Only... I've got a problem here... Sorry to be so nooby, but
> here's what's going on:
>
> GRASS 6.4.2RC1 (ETRS89_ll):~ > g.extension extension=r.univar.zonal
> WARNING: GRASS_ADDON_PATH is not defined, installing to ~/.grass6/addons/
> Fetching <r.univar.zonal> from GRASS-Addons SVN (be patient)...
> A    r.univar.zonal/stats.c
> A    r.univar.zonal/sort.c
> A    r.univar.zonal/globals.h
> A    r.univar.zonal/r.univar.zonal.html
> A    r.univar.zonal/r.univar_main.c
> A    r.univar.zonal/r3.univar.zonal.html
> A    r.univar.zonal/r3.univar_main.c
> A    r.univar.zonal/Makefile
>  U   r.univar.zonal
> Checked out revision 49316.
> Compiling <r.univar.zonal>...
> Makefile:10: /opt/grass/include/Make/Multi.make: No such file or directory
> make: *** No rule to make target `/opt/grass/include/Make/Multi.make'.
>  Stop.
> ERROR: Compilation failed, sorry. Please check above error messages.
>
> 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:
>
> GRASS 7.0.svn (ETRS89_ll at Niedersachsen_Test):~ > g.extension
> extension=r.univar.zonal svnurl=https://svn.osgeo.org/grass/grass-addons/
> Fetching 'r.univar.zonal' from GRASS-Addons SVN (be patient)...
> A    r.univar.zonal/stats.c
> A    r.univar.zonal/sort.c
> A    r.univar.zonal/globals.h
> A    r.univar.zonal/r.univar.zonal.html
> A    r.univar.zonal/r.univar_main.c
> A    r.univar.zonal/r3.univar.zonal.html
> A    r.univar.zonal/r3.univar_main.c
> A    r.univar.zonal/Makefile
>  U   r.univar.zonal
> Checked out revision 49316.
> Compiling 'r.univar.zonal'...
> mkdir -p
> /home/lee/Documents/GRASS_Data/ETRS89_ll/Niedersachsen_Test/.tmp/pc19453/6059.0/r.univar.zonal/etc/r.univar.zonal
> test -d OBJ.x86_64-unknown-linux-gnu || mkdir -p
> OBJ.x86_64-unknown-linux-gnu
> 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
> In file included from r.univar_main.c:21:0:
> globals.h:22:23: fatal error: grass/G3d.h: No such file or directory
> compilation terminated.
> make: *** [OBJ.x86_64-unknown-linux-gnu/r.univar_main.o] Error 1
> ERROR: Compilation failed, sorry. Please check above error messages.
>
> 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?
>
>
>>
>>
> You should be able to change the BASECOLS variable in the script
>> to only output the sums, which might speed things up for you.
>>
> Do you mean just taking the line in v.rast.stats2 with
>
> BASECOLS="n min max range mean stddev variance cf_var sum"
>
> 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.
>
> Thanks a lot!
> Daniel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20111121/18c8ffe8/attachment-0001.html


More information about the grass-user mailing list