1

I am generating a image consisting of 3 bands and would like to generate a thumbnail from it. Unfortunately the thumbnail is not displayed, only a placeholder is shown.

png thumbnail placeholder

My script is the following (Script in Earth Engine Code Editor)

var europe_bbox = ee.Geometry.Polygon(
    [[[-12.222935630617995, 47.34321448670071],
      [-12.222935630617995, 34.021613745857614],
      [7.288783119382005, 34.021613745857614],
      [7.288783119382005, 47.34321448670071]]], null, false);

// Make a black background image
var background = ee.Image(0).visualize({palette: '000000'});

// Make a grey Europe outline
var addID = function(feature) { return feature.set({ID: 1});};

var europe = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017')
           .filter(ee.Filter.eq('wld_rgn', 'Europe'))
           .map(addID);

// Create an image from the feature collection
var europeImg = europe.reduceToImage(['ID'], ee.Reducer.first());

//Make the tree loss layer
var treeLoss = ee.Image('UMD/hansen/global_forest_change_2019_v1_7').select('lossyear');

// Blend background - dark europe outline - tree loss layer
treeLoss = treeLoss.visualize({ palette: ['yellow', 'red'], min: 0, max: 19});

var composite = background.blend(europeImg).blend(treeLoss);

print(ui.Thumbnail(composite,
 {format: 'PNG', dimensions: 2000, region: europe_bbox, crs:'EPSG:3035'}));

Does anyone know why this happens and what I may be doing wrong?

1 Answer 1

2

There is no argument crs in the ui.Thumbnail, commenting it out should make the script work: https://code.earthengine.google.com/6ac90c2779e8eefe40bec733afb9986a.

Getting the thumbnail generated in EPSG:3035 is a bit more tricky in EE, you will need to fiddle a bit with projections, making sure the region fits into your AOI (rectangle in EPSG:3857 won't look the same in EPSG:3035), this code should give you a hint on how this can be done: https://code.earthengine.google.com/c27cb0b665e6bdbaa710cf7ad373e6ec

var scale = 5000

composite = composite
  .blend(ee.FeatureCollection([europe_bbox]).style({width:2, color: '00ffff', fillColor: '00000000'}))
  .reproject(ee.Projection('EPSG:4326').atScale(scale))
  .changeProj(
    ee.Projection('EPSG:3035').translate(3400000, -2000000).scale(100000, 100000),
    ee.Projection('EPSG:4326')
)

Map.addLayer(composite, { min: 0, max: 255}, 'reprojected')

composite = composite.reproject(ee.Projection('EPSG:4326').atScale(scale))

print(ui.Thumbnail(composite, {
  format: 'PNG', 
  dimensions: 2000, 
  region: europe_bbox, 
}));


enter image description here

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.