2

This is a follow up question from $area gives NULL for some polygons in QGIS's Field Calculator and $area is NULL for over-wrapping geometry.

I have a map of Cambodia at district level (dist) and economic land concession (elc). I am trying to calculate the proportion of district that is occupied by the economic land concession. I have tried the following:

  1. created area for elc layer
  2. for dist layer, 100*intersecting_geom_sum('elc','area_elc')/$area

Problem is, there are some districts that have over 100% coverage because the elc layers in these districts have outrageously large area calculated.

enter image description here

I have used the following data, projected them into EPSG:3148, set the output field length as 21 for area calculation as advised. I also ran fix geometry for elc layer afterwards.

How can I correctly calculate the area for these districts.

*** ADDED

I have found that for a small district, area of one big chunk of elc that cross the district and other district was used- instead of part of elc that is within district. Attached as picture below:

Area of district is 913 km^2

Area of elc is 3336 km^2

When I take the intersection, it works to cut them correctly. How could I possibly correct this problem?

Data using: GEO2_KH (Cambodia shapefile) https://international.ipums.org/international/gis_harmonized_2nd.shtml

ELCs: All economic land concessions shapefile https://data.opendevelopmentcambodia.net/dataset/economiclandconcessions

9
  • @UdithaHerath, Could you please have a look at this at your convenience? I'd appreciate any advice on this. Thank you! – JessicaP Jan 26 at 14:59
  • 2
    Why do you keep the area as square meters and not convert it in square kilometers ? I think it's more meaning full when you work with country, district data. You can create a float number field. – J. Monticolo Jan 26 at 15:05
  • 1
    Try area($geometry) for the calculations. – Erik Jan 26 at 15:13
  • 1
    check that fix geometry actually produced valid geometries – Ian Turton Jan 26 at 17:06
  • 1
    just because it looks ok doesn't mean it is valid - check with isValid() – Ian Turton Jan 28 at 11:29
2
+50

I tried to calculate that proportion and It worked for me. May be you did something wrong with those areas. The issue here is that a single dist can have several elc intersections.

Here is the result: enter image description here

Here I describe you the process:

  1. Correct geometries (otherwise the intersection tool doesn't work).
  2. Intersection (Union) of the layers. This layer will serve as a future dissolved layer with the elc area within each dist.
  3. Filter the layer removing those polygons with null fid(keep just elc).
  4. Dissolve by ADMIN_NAME. This will make a single elc área.
  5. Calculate the área of elc.
  6. Join layers: dist joined to the dissolved layer by ADMIN_NAME.
  7. Calculate the percentage of dist covered with elc.

Here some screenshots:

enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here

1
  • Thank you so much for your answer! – JessicaP Feb 5 at 15:02

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.