I want to calculate the area of forest loss in a region. Is it necessary to reproject first and, if so, is the following code for calculating the area correct?

var Forest_Change = ee.Image("UMD/hansen/global_forest_change_2022_v1_10");
var lossImage = Forest_Change.select(['loss'])
var dataset = ee.FeatureCollection('WCMC/WDPA/current/polygons');

var target_values = ee.Filter.inList('DESIG', [ 'Nationalpark' ]);
var Nationalpark = dataset.filter(ee.Filter.and(
ee.Filter.eq('MARINE', '0')))
var gaul = ee.FeatureCollection("FAO/GAUL_SIMPLIFIED_500m/2015/level1")

var Germany = gaul.filter(
  ee.Filter.eq('ADM0_NAME', 'Germany'))
Map.addLayer(Germany, {palette: ['00FF00']}, 'Germany')
var Loss_PA = lossImage.updateMask(lossImage).clip(Nationalpark)
var Germany_Loss_PA = Loss_PA.clip(Germany)
var pixelArea = ee.Image.pixelArea();
var Loss_Image = Loss_PA.multiply(pixelArea);

var loss_stats_D = Loss_Image.reduceRegion({
    reducer: ee.Reducer.sum(),
    geometry: Germany.geometry(),
    maxPixels: 1e9

var square_meters_loss_D = loss_stats_D.getNumber('loss')
  var squareKilometers_loss_D = square_meters_loss_D.divide(1e6)
  print('Area lost in germany', 
      "square kilometers")

1 Answer 1


You don't need to explicitly reproject, but you should (always) specify a projection and scale in the reduceRegion call, if for no other reason than to make sure you know how its being computed (you're going to get different results if it's as a scale of 1 degree than if its at a scale of 30m).

  • Ah, thank you! So you mean like this: var loss_stats_D = Loss_Image.reduceRegion({ reducer: ee.Reducer.sum(), geometry: Germany.geometry(), crs: "EPSG: 4326", scale: 30, maxPixels: 1e9 })
    – Rodriguez
    Jun 23, 2023 at 14:27

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.