0

Im trying to calculate the area of terrestrial protected areas in Google Earth Engine using the polygons from the world database on protected areas. I'm iterating over a list of countries and for each country only selecting terrestrial polygons and dissolving them so that it dosen't count polygons inside other polygons yet my results differ quite a bit from the numbers I get from protectedplanet.com, which uses the same data set and I'm not quite sure why.

Here's my code: https://code.earthengine.google.com/6dc92998c40df81e15d954471c70f3d4

var dataset = ee.FeatureCollection('WCMC/WDPA/current/polygons');

var protected_terrestrial = dataset.filter(ee.Filter.and(
  ee.Filter.eq('MARINE', '0'),
  ee.Filter.lt('STATUS_YR', 2016), 
  ee.Filter.neq('STATUS', 'proposed')));

var countries = ee.List(['NIC', 'CRI', 'PAN', 'COL', 'VEN', 'SUR', 'ECU', 'PER', 'BRA', 'BOL', 'PRY', 'URY', 'ARG', 'SLE', 'LBR', 'CIV', 'GHA', 'TGO', 'BEN', 'NGA', 'CMR', 'GNQ', 'GAB', 'COD', 'COG', 'RWA', 'UGA', 'KEN', 'TZA', 'MOZ', 'MWI', 'AGO', 'ZWE', 'ZMB', 'BWA', 'ZAF', 'MDG', 'THA', 'IND', 'MMR', 'LAO', 'VNM', 'KHM', 'MYS', 'IDN', 'PHL', 'PNG', 'TLS']);

// Create a list to store the results

var results = [];

// Loop over the countries and calculate the protected area for each country co

untries.evaluate(function(countries) {
  countries.forEach(function(country) {
    var selected = protected_terrestrial.filter(ee.Filter.and(
      ee.Filter.eq('PARENT_ISO', country),
      ee.Filter.neq('STATUS', 'proposed')));

//Dissolve polygons inside each other so that it creates one polygon for the entire country

var all = ee.FeatureCollection(selected).geometry().dissolve();

var polygonArea = all.area({'maxError': 1});
var polygonareakm = ee.Number(polygonArea).divide(ee.Number(1000000));

// Add the results to the list

results.push([country, polygonareakm]);

});

// Export the results as a CSV file to Google Drive

  Export.table.toDrive({
    collection: ee.FeatureCollection(results.map(function(row) {
      return ee.Feature(null, {country: row[0], protected_area: row[1]});
    })),
    description: 'protected_areas_by_country',
    fileFormat: 'CSV'
  });

});

1 Answer 1

1

When you take collection.geometry(), overlapping polygons are merged in ways that can be counter-intuitive, and therefore it's an operation you should essentially never use on a collection.

Instead, flatten the collection to an image using paint or reduceToImage and compute the area using pixels. (geometry could come from country here)

var area = ee.Image(0).paint(collection, 1)
    .multiply(ee.Image.pixelArea())
    .reduceRegion(ee.Reducer.sum(), geometry, 100)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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