2

I use QGIS 3.2.3. I have two polygon layers "municipalities" and "landuse".

I want to update municipalities with the summarized area off landusepolygons within every municipality. landuse polygons do, in some cases, cross the borders of municipalities, in those cases I want only the intersection area in the calculation.

I can't find a way to do it with the build ind tools in QGIS. I have installed the plugin "refFunctions", but I can't figure out how to set it up.

A virtual layer with some sql would do it, I think. I can calculate the total area, but how do I get an summarized area for the landusepolygons in every municipality?

2

Using refFunctions plugin, this is a workflow I would suggest.

(0) Sample Data: To simplify I prepared only one municipalities.

enter image description here

(1) Open attribute table of landuse layer. Calculate intersecting area of each landuse polygon, and summarize (aggregate) them to new field sum_area.

The expression is:

 sum(area(intersection(geom_from_wkt(geomintersects('municipalities', '$geometry')), $geometry)), group_by:= "type")  

enter image description here

(2) Open the attribute table of municipalities and extract data from landuse layer.

The expression is attribute(get_feature('landuse', 'type', 'oat'), 'sum_area') and you will need to repeat this for each landuse type (e.g. 'oat', 'vegie', 'wheat',...)

enter image description here

Caveat: As you can see, this workflow covers one municipalities polygon only. You will have multiple polygons, so you might need either (aa) to break them into single polygon and repeat above process one by one; or (bb) to automatically loop through all municipalities polygons by model builder.

Would not be easy, but hope this helps to some extent...

1

Well..

I endet up with a more manuel solution... I clippet my landuselayer. Savet it as a new table, and calculated the areas of each part. Then, by using refFunctions, i summarized the areas in my municipalities table.

It works for now, but it was not the "smart solution" I was hoping for...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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