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.