0

I'm processing an image with 6 bands (called D) according to a condition from another layer (forest fraction)

When the condition is met I apply a function to the unmasked pixels and as a last step I unmask my image (D_forest) using the original input D The resulting image is 'incomplete' however. Part of Russia and North America are cut out, and I don't understand how to overcome this issue. Sometime I also get the Error "Layer 2: Tile error: Reprojection output too large (20859x19524 pixels)."

I've tried to export to asset with no success.

input: input "D" from https://www.isric.org/news/soilgrids-data-now-available-google-earth-engine

output D_forest variable of part of Russia, if I click on the map (see red dot) the inspector will tell me that is masked

PArt of the ouput

here part of the code:

#declare threshold nd apply it to layer var lt_th=80 var condition_FOREST = forest_fraction.select('tree-coverfraction').gt(lt_th); # function bandNames.forEach(function(band) { remove_f[param +'_' + band] = '(1-(('+lt_th+' - b("tree-coverfraction"))/1000)) * b("'+ param +'_' + band + '")'; }); //FOREST var D_forest_selected = D.updateMask(condition_FOREST); var reverseMask = condition_FOREST.not(); var D_forest_unselected =D.updateMask(reverseMask); // combine forest fraction layer and D layer var combinedD_forest = forest_fraction.addBands(D_forest_unselected); // Apply each expression to the combined image individually. var D_forest_done = Object.keys(remove_f).map(function(key) { return combinedD_forest.expression(remove_f[key]).rename(key); }); // cat and unmask layer var D_forest_done = ee.Image.cat(D_forest_done); var D_forest = D_forest_done.unmask(D); 

Do you know how I could get the D_forest output complete?

Here's the complete link to the script: https://code.earthengine.google.com/8e4e7d04f59323ce915b9b7c75194854

1 Answer 1

0

Remove this reproject call in your code:

var forest_fraction = forest_Globe .reproject({crs: template_Global_250m.projection(), scale: template_Global_250m.projection().nominalScale()}); 

Quoting from the reproject docs,

Use of ee.Image.reproject is rarely needed and should generally be avoided. Defining the projection and scale of analysis should be handled by "scale", "crs", and "crsTransform" parameters whenever they are offered by a function.

When you run the reproject, you're bypassing Earth Engine's pyramiding system and forcing it to calculate everything on screen at 250m, which causes the "Reprojection output too large" errors if you're zoomed out. The missing data is also an artifact of the reprojection.

This is a big difference between Earth Engine and most other GIS software where you would start analysis by projecting everything into the same CRS. In Earth Engine, you simply specify the scale and CRS at export and it will handle the reprojection automatically.

2
  • Hello, Aaron, thanks for your answer. What shall I put instead of reproject? I've been making couple of trials but I'm not managing to change scale and projection without the reproject(). Thanks a lot! Commented Oct 20, 2024 at 16:52
  • You shouldn't need to manually change scale and projection, since those will be handled by Earth Engine when you export to asset or do any kind of analysis like applying a reducer (via the scale and crs parameters). If you rename forest_Globe to forest_fraction, does everything work as expected? Commented Oct 20, 2024 at 18:41

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.