0

I'm interested in calculating the area I have classified of a certain class. Do you need to account for projection to assess class area or can you run the following code and it will be accurate? I'm particularly thinking about areas towards the poles where pixel sizes might differ based on how the satellite is positioned in space.

var count = image3.select("classification").reduceRegion({
    reducer: ee.Reducer.count(),
    geometry: bounds,
    scale: 20,
    maxPixels: 9e12
  });
print(count);

Then divide the count number by 25 to reach hectares.

https://developers.google.com/earth-engine/guides/projections

1
  • From work I have done, it appears that GEE can account for changing pixel size with latitude, so it is able to deal with projections itself, without you specifically casting one
    – GeoMonkey
    Feb 3, 2022 at 19:58

1 Answer 1

1

Earth Engine understands area, but that doesn't mean that what you asked it to do accounts for area. In this case, your reduction is literally counting pixels, so the meaning of the result is entirely dependent on the size of pixels, in the image's default projection, at the requested scale, within the bounds.

The general tool for working with true area in Earth Engine is ee.Image.pixelArea — it returns a special image whose every pixel (regardless of the projection or scale involved) has a value equal to the pixel's area in meters. So, if you mask this image, then apply a sum reducer, you have the area of the unmasked region.

var area = ee.Image.pixelArea()
  .updateMask(image3.select("classification").eq(classToMeasure))
  .reduceRegion({
    reducer: ee.Reducer.sum(),   // sum, not count
    geometry: bounds,
    scale: 20,
  });

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.