I'm trying to display SENTINEL-2 imagery in Google Earth Engine, code working but displaying blank figure:

var PuntoQuellaveco1 = /* color: #d63000 */ee.Geometry.Point([-70.477294921875, -17.287709050621917]);

var image = ee.ImageCollection('COPERNICUS/S2')
.sort('CLOUD_COVER', false);

var conteo = image.size();
print('conteo de imágenes', conteo);

var mejorImagen = ee.Image(image.sort('CLOUD_COVER').first());

print('La primera con menos nubosidad', mejorImagen);

Map.addLayer(mejorImagen, {bands: ['B4', 'B3', 'B2'], max: 0.3}, 'image');

var fechaAdquirida = mejorImagen.get('DATE_ACQUIRED');

print('Fecha adquirida', fechaAdquirida);

blank displaying, what's wrong?

1 Answer 1


From product description:

The SENTINEL-2 data contain 13 UINT16 spectral bands representing TOA reflectance scaled by 10000

With putting max: 0.3, you are stretching the image from 0 to 0.3, or 0.00003% of reflectance. Try with a stretch from 0 to 3000 (for a 30% of reflectance):

Map.addLayer(mejorImagen, {bands: ['B4', 'B3', 'B2'], max: 3000}, 'image');

enter image description here

And always read product description

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.