Google Earth Engine Tutorial: Calculate Administrative Area
Credit: Youtube Channel “Terra Spatial, Learn how to calculate area statistics for any administrative boundary using spatial analysis in GEE.”
You can see all the tutorials from here: Techgeo Academy.
Introduction
Google Earth Engine (GEE) is a powerful platform for geospatial analysis and earth observation. One of its practical applications is calculating the administrative area of regions, such as countries, states, or zones, using datasets like the FAO’s Global Administrative Areas (GADM). This tutorial will guide you through the process of extracting and computing administrative boundaries and their respective areas in GEE.
Steps to Calculate Administrative Area in Google Earth Engine
1. Set Up Your GEE Environment
Access the GEE Code Editor at https://code.earthengine.google.com. Authenticate with your Google account and open a new script.
2. Load the Administrative Boundary Dataset
GEE provides built-in datasets like GADM for administrative boundaries. For example:
var adminBoundaries = ee.FeatureCollection("FAO/GAUL/2015/level1");
3. Filter the Dataset for Your Region
Select features based on your administrative level. For instance, to get boundaries for a specific country:
var countryBoundary = adminBoundaries.filter(ee.Filter.eq('ADM1_NAME', 'Your Country Name'));
4. Calculate the Area of the Selected Region
Use the geometry()
method to get the region’s geometry and the area()
function for calculation:
var area = countryBoundary.geometry().area();
5. Visualize and Export the Results
Display the area on a map and export it for further analysis:
Map.centerObject(countryBoundary, 6);
Map.addLayer(countryBoundary, {color: 'red'}, 'Administrative Area');
print('Administrative Area in square meters:', area);
FAQ
What is the unit of the area calculated in GEE?
The area is calculated in square meters by default. To convert it to square kilometers, divide by 1,000,000.
How do I handle large datasets efficiently?
Use reduceRegion()
or reduceImage()
with appropriate geometries to minimize processing time and resource usage.
Can I calculate areas for multiple administrative levels at once?
Yes. Filter the dataset by different attributes (e.g., ‘ADM0_NAME’, ‘ADM1_NAME’) and iterate through them using loops or map()
functions.
What if the dataset lacks precise administrative boundaries?
Ensure you use the correct dataset version and verify data accuracy. Explore alternative datasets like OpenStreetMap or custom uploads if needed.
How to export the calculated area to a file?
Use Export.image.toDrive()
or Export.table.toDrive()
for exporting results. Example:
Export.table.toDrive({collection: countryBoundary, description: 'admin_area', fileFormat: 'CSV'});