1

While trying to calculate forest coverage per country with MODIS/006/MOD44B and LSIB data, I get the following error:

FeatureCollection (Error)
Unable to transform edge (89589.000000, 86393.171875 to 89589.000000, 86393.261719) from SR-ORG:6974 PLANAR [231.65635826399998, 0.0, -2.0015109353988E7, 0.0, -231.65635826400006, 1.0007554676994E7] to EPSG:4326.

The main part of code is below:

var modisScale = 250 // m
var forestImg = modis_filtered.gte(forestThreshold).rename('forest_cover');
    var areaImage = forestImg.multiply(ee.Image.pixelArea());
    
    var stats = areaImage.reduceRegions({
      collection: countries,
      reducer: ee.Reducer.sum(),
      scale: modisScale,
    });

I guess GEE stumbles on reprojecting MODIS SR-ORG:6974 projection. However, if I add .reproject('EPSG:4326', null, modisScale); before reducing, everything works.

var forestImg = modis_filtered.gte(forestThreshold).rename('forest_cover');
var areaImage = forestImg.multiply(ee.Image.pixelArea()).reproject('EPSG:4326', null, modisScale); \\ REPROJECTING

var stats = areaImage.reduceRegions({
  collection: countries,
  reducer: ee.Reducer.sum(),
  scale: modisScale,
});

The question is whether this proir reprojection to WGS84 is the correct way to go.

Complete scrit is here

1 Answer 1

1

LSIB includes Antarctica, which spans the pole. Filter that out and you should be fine:

var countries = ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017")
    .filter("country_na != 'Antarctica'")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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