6

I have the map of Cambodia(map) and the economic land concessions(elc). In trying to find the proportion of district covered by land concesions, I need the area variable. But when I create the variable as $area, there are some entries that are NULL - it is the case for both layers. I have tried 'fix geometries.' It mostly fixed the problem for elc layer but still is NULL for one layer as following. Smaller piece and the bigger piece are seperate entries but area is calculated only for the small area.

enter image description here

The area calculation issue is not fixed at all for the elc layer. What is the next thing I could try to fix this problem?

I am following the steps from this link: Finding overlay percentage between two polygon shapefiles

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

JessicaP
  • 173
  • 11

1 Answers1

10

Short Answer

you have to re-project the shapefile to EPSG:3148 - Indian 1960 / UTM zone 48N

Long Answer

  1. Load the shapefile
  2. Left click the shapefile in Layers pallet
  3. Go to Export > Save feature as
  4. Save as ESRI Shapefile with giving a new File Name and setting the coordinate system CRS as EPSG:3148 (EPSG:3148- Indian 1960 / UTM zone 48N)

enter image description here

  1. Then go to Attribute Table of the newly created shapefile
  2. Go to Field Calculator
  3. And enter $area in the Expression Field while giving a name to the column with data type int (if you prefer int64 over int give int64 but not required) enter image description here

then all the shapes with a positive geometry will display an area.

enter image description here

but areas with unknown geometry will not display any area

enter image description here

Taras
  • 32,823
  • 4
  • 66
  • 137
Uditha Herath
  • 703
  • 5
  • 16
  • 1
    Thanks Uditha! Could I ask why re-projection was necessary? – JessicaP Jan 26 '21 at 07:15
  • I have tried several methods but this was the method gave the answer. if I found another method I will update you ASAP – Uditha Herath Jan 26 '21 at 07:20
  • 1
    Thank you so much, Uditha! – JessicaP Jan 26 '21 at 07:26
  • 2
    As explanation, $area returns the area calculated in the units of the CRS being used. EPSG:4326 is unprojected, in degrees latitude and longitute. So the answer is in "square degrees" (it's actually a bit more complicated) with one "square degree" being about 10000 sq km on the ground. I expect some of your areas were close to zero at this scale. When you reproject to a better CRS, the calculation takes place in square meters. – Houska Jan 26 '21 at 12:09
  • Yes @Houska that was my initial idea as well. And i tried to find if there are errors with in the original shape file and for several of them yes there were. So I intentionally reprojected it to meters. – Uditha Herath Jan 26 '21 at 12:36
  • 1
    Good Answer, thanks for taking time for this detailed answer, – Mapperz Jan 26 '21 at 14:20
  • 1
    What do you mean by a "positive geometry"? I have the same problem, as some polygons return NULL areas, but I already had my data projected (I'm using UTM Zone 36N) – hnagaty Feb 04 '21 at 12:17
  • here with in this shapefile there are entries where the geometry had been deleted. but the attribute table entry is there. therefore, for all the attribute table entries with geometries I had noted them as Positive Geometries.

    @Hany Nagaty can you give me more details where I can probe in to your problem like this. with in the area column is it specifically stated as NULL or stated as 0

    – Uditha Herath Feb 06 '21 at 15:35