[GRASS-user] Joining vectors by location
daniel.o.mcinerney at gmail.com
Mon Nov 21 09:46:16 EST 2011
You should use v.rast.stats  as it "Calculates univariate statistics
from a raster map based on
vector polygons and uploads statistics to new attribute columns. " Should
be a more straight
On Mon, Nov 21, 2011 at 3:40 PM, Daniel Lee <lee at isi-solutions.org> wrote:
> Hi group,
> Does anyone have a good idea of how to join vector areas by location? I'm
> trying to do aggregated statistics on vector maps using extracted values
> from rasters. I want the sum of the raster cells that lie within the
> vectors to be inserted into the vector attribute table. So far I've done
> stuff along these lines, but it's got a problem, and the main problem is
> that when I convert the rasters to polygons the polygons end up with
> stair-like boundaries rather than the smooth boundaries they had before
> they were converted to rasters. A second problem if I overlay the
> stair-like polygons over the original areas, the product of v.overlay is
> two polygons with a single centroid, which is absolutely wrong.
> Here's what I've been doing:
> 1. Convert the polygons to rasters with v.to.rast
> 2. Convert the rasters that I want to sum into the polygons to integers
> with r.mapcalc
> 3. Find the sums of the rasters for each polygon (in raster form) with
> 4. Extract the summed values from the product of r.statistics with
> r.mapcalc, so that each polygon has the sum from the rasters as its value
> for all pixels.
> 5. Convert the rasters to vectors with r.to.vect
> -- This is where the first problem comes up - the boundaries are very
> 6. Connect the attributes with v.overlay
> -- Second problem: I get all the boundaries, not just the smooth ones or
> the jagged ones.
> - Extract the centroids from the polygons and then join the polygon tables
> (extract the centroids with v.select, then use v.overlay? And as a last
> step use v.db.join to join the new values to the old geometries and get rid
> of the jagged boundaries?
> - Convert the rasters to points and then sum them inside the polygons?
> With what tool?
> - How can I connect the tables that no longer have thematic connections by
> the position of the geometries they belong to? I can connect the tables to
> the geometries by adding a layer to the map, but then I can't e.g. add the
> values of different fields together. I'm kind of at a loss.
> Thanks a lot fo the help!
> 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.
> grass-user mailing list
> grass-user at lists.osgeo.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the grass-user