Shapefile to Land Use tree


Rational

Take a set of shapefiles, download the ESA WorldCover GeoTIFFs that the shapefile elements cover and determine the percentage of each land use type in each shape file element.

Input Files

Shapefile

Learn how to produce this shapefile from a CSV of sample names, latitudes and longitudes here: Site Locations to Shapefile

Scripts Used

Github Repository of Scripts

Environmental Data / Land Use - ESA WorldCover

  1. download-from-shapefile.py
  2. percent.py
  3. landuse_pies.py

Steps

1. Downloading ESA LandCover tiles

python download_from_shapefile.py -s '/path/to/shapefile/output_shapes.shp'

Arguments

Outputs

2. Extracting Land Use within Shapefiles

python percent.py '/path/to/geotiffs_folder' 'path/to/shapefile.shp' landuse_output.csv

Don’t worry about the warnings as long as it says “Results saved to …”

Each column in the CSV represents a percentage of each land type contained within each shapefile element.

ESA Land Use Codes

Layer (Class) Colour (RGB) Hex Colour Map Code
Trees 0,100,0 #006400 Trees 10
Shrub Land 255, 187, 34 #FFBB22 Shrub Land 20
Grassland 255, 255, 76 #FFFF4C Grassland 30
Cropland 240, 150, 255 #F096FF Cropland 40
Built 250, 0, 0 #FA0000 Built 50
Bare / Sparse Vegetation 180, 180, 180 #B4B4B4 Bare / Sparse Vegetation 60
Snow and Ice 240, 240, 240 #F0F0F0 Snow and Ice 70
Permanent Water Bodies 0, 100, 200 #0064C8 Permanent Water Bodies 80
Herbaceous Wetland 0, 150, 160 #0096A0 Herbaceous Wetland 90
Mangroves 0, 207, 117 #00CF75 Mangroves 95
Moss and Lichen 250, 230, 160 #FAE6A0 Moss and Lichen 100

Arguments

Outputs

3. Generating a Map of Land Use in Each Group (optional)

python landuse_pies.py '/path/to/shapefile/output_shapes.shp' '/path/to/landuse/percentages/landuse_output.csv' 

Arguments

Outputs