On 16/07/2012 20:22, Manuel Spínola wrote:
Dear list members,
I have a landuse layer and another layer with 20 circular polygons
(buffers) and I want to obtain the amount of each landuse category
within each circular polygon. I tried "clip" from Geoprocessing Tools
but I dont get the information individualized for each circular
polygon. Is it possible to get the landuse within each circular
polygon in one step?
Not exactly "one step" but...
If you don't mind to drop the vectors into spatialite, then a query can
update the buffers layer with area of each landuse category as follows:
Suppose "buffers" has a label column, and there are landuse categories
lu1, lu2, lu3, .... then:
SELECT b.label AS Buffer,
ST_Area(ST_Intersection(b.Geometry, l.Geometry)) AS LandUse1
FROM buffers AS b, landuse AS l
WHERE l.category='lu1' AND
ST_Intersects(b.Geometry, l.Geometry)
GROUP BY b.buff_id;
If you add columns to the buffers table to hold total area for each
landuse category::
ALTER TABLE buffers ADD COLUMN lu1_area float;
ALTER TABLE buffers ADD COLUMN lu2_area float;
....
then you'd update each column like so:
UPDATE buffers SET lu1_area=(
SELECT ST_Area(ST_Intersection(b.Geometry, l.Geometry)) AS LandUse1
FROM buffers AS b, landuse AS l
WHERE l.category='lu1' AND
ST_Intersects(b.Geometry, l.Geometry) AND
b.label=buffers.label
);
HTH,
Micha
Best,
Manuel
--
*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
mspin...@una.ac.cr <mailto:mspin...@una.ac.cr>
mspinol...@gmail.com <mailto:mspinol...@gmail.com>
Teléfono: (506) 2277-3598
Fax: (506) 2237-7036
Personal website: Lobito de río
<https://sites.google.com/site/lobitoderio/>
Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>
This mail was received via Mail-SeCure System.
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user
This mail was received via Mail-SeCure System.
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user