[GRASS-user] "Spatial joining" in GRASS?

Alex Mandel tech_dev at wildintellect.com
Sun Dec 7 19:08:31 EST 2008


Jonathan Greenberg wrote:
> I was hoping for a "crash course" in performing a spatial join between a
> polygon and a point layer in GRASS.  I want to know, for each polygon in
> vector A, how many points from vector B fall within it, and the average,
> min, max and stdev of several numeric fields of those points from vector
> B falling in a given polygon from vector A.  I was trying to do this in
> Arc but (surprise surprise) it keeps crashing...
> 
> --j
> 

I can think of several ways to do this, though I haven't tried to do any
of things I'm about to mention.

The most elegant seems to be:

1.v.what.vect
http://grass.itc.it/grass63/manuals/html63_user/v.what.vect.html
Create a column in the point layer to hold the polgyon id then use this
command to populate it based on the polygon layer. Once you have that
you can sum, avg, min, max with sql on the point table and group by
polygon id which let's you link it back to the polygon layer as a 1:1.

Other things to look at
v.patch
v.distance
v.overlay

Note specifically for you and other UCDavis affiliates we have a copy of
the GRASS book in the library(currently checked out) and have access to
the springer digital version.
http://www.springerlink.com/content/j21632/ just log into the library
proxy/vpn first.

Of course this could also be done in PostGIS and possibly Spatialite
SQLite(Testing that right now) with a single query.

Alex


More information about the grass-user mailing list