4

I need to calculate the area of landusetypes in 50m around various dots (all in one shapefile). My problem is, the buffers around the dots are overlapping each over in some places. I tried to intersect/clip the layer (e.g. grassland) with the layer "buffer", but the overlapping parts are only counted once to the overlapping buffers not twice.

Is there any tool in QGIS which might help me? Or is there any other way to get this output?

enter image description here

8
  • Have you tried the Group Stats Plugin? Here is a tutorial that is similar to what you are trying to accomplish: anitagraser.com/2013/02/02/group-stats-tutorial Simply replace states with your buffers and use your Grassland as the land use layer. I'm making this a comment because I am not 100% sure this is what you're looking for.
    – evv_gis
    Commented Sep 9, 2014 at 19:29
  • Sorry, but that's not really what I am looking for. The problem is, the intersect (or clip) tool assigns the grassland to the number of each dot/buffer. With overlapping buffers the first buffer gets the whole grasland area intersecting with it, the second gets only the remaining areas and so on until the last buffer gets only grasland which doesn't overlap with any other buffer. But I need to get the whole grasland area to each buffer. I hope this is more understandable now.
    – Anna
    Commented Sep 10, 2014 at 8:56
  • I have the same problem than Anna as I need to get the area of intersected wood_zone within each buffer (created from points shapefile centroid_layer), knowing that almost all my buffers are overlapping each others. Thus I need to include the wood_zone polygones as many times as the number of intersecting buffers. I was trying to proceed with SS_Rebelious solution using SQL not in Spatialite but in PostGIS/PostgreSQL (9.6 version) as following : CREATE TABLE buff AS SELECT gid, ST_Buffer(geom, 1000,'quad_segs=100') FROM centroid_layer ; and then : UPDATE centroid_layer SET areacolu
    – PGeo
    Commented Aug 16, 2017 at 13:50
  • I think you should ask this as a new question instead of posting it as an answer. You can always include a link to this post in your question to show you did some research :)
    – Joseph
    Commented Aug 16, 2017 at 13:54
  • Ok thank you, II wasn't sure how to proceed as I indeed realised my answer was not really "answering" the initial question. I'll start a new question then... :)
    – PGeo
    Commented Aug 16, 2017 at 13:57

1 Answer 1

2

This task is fairly easy if you use spatial databases. You can use Spatialite database for your needs. Use spatialite_gui to create spatialite database and import your shp-files into it (there is a 'Load shapefile' button at the toolbar).

Once you have your data inside spatialite database you just need to run a query to get needed information. Assuming that you have 2 tables:

  1. points with fields: pkuid - primary key (id); grass_area - field to be populated with the area of grassland that is covered by buffer from this point; geometry - the geometry (points) is stored here;
  2. grassland with fields: pkuid - primary key (id); geometry` - the geometry (polygons or myltipoligons) is stored here;

and you don't concern that same parts of grassland will be counted in several buffers (if I understood your question correctly) run the code below.

At first we need to create buffers and store them in temporary table buff (if buffers are needed only for calculations there is no point in permanent table for them).

CREATE TEMPORARY TABLE buff AS
SELECT pkuid, ST_Buffer(geometry, 50) AS geom FROM points; /* 50 - is your buffer radius */

ST_Buffer is the function that creates buffers. If grassland table consists only of grassland polygons and has fairly small amount of objects in it we (for simplicity of query) can just merge them with each other to get single multipolygon to work with. Run following querry to populate grass_area field with area of intersection of the given buffer

UPDATE points 
SET grass_area = (SELECT ST_Area( 
                          (SELECT ST_Intersection(
                            (SELECT ST_Union(geometry) FROM grassland), 
                            (SELECT geom FROM buff WHERE points.pkuid == buff.pkuid)
                                                 )

                           )
                                )
                  );

The main function that was used here are ST_Area (calculates area of the given geometry), ST_Intersection (return intersection of given geometries), ST_Union (return a union of given geometries). Functions are described here.

Now we can get rid of buffers:

DROP TABLE buff;

You can run these queries either from Spatialite_GUI or from DB Manager in QGIS (hit SQL Window button in DB Manager).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.