I am trying to start using GEE. However, I cannot visualize an image when using the Code Editor. Here is my code:

var s2 = ee.Image('COPERNICUS/S2_SR/20190314T155521_20190314T205515_T17PLK')
Map.addLayer(s2, {bands: ['B8', 'B11', 'B4'], max: 4000}, 'S2')
Map.centerObject(s2, 8);

I followed the recommendation found in this post:


However, it does not work. The image I want to visualize is this one:

```[![enter image description here][1]][1]

  [1]: https://i.stack.imgur.com/mijBJ.jpg
  • I don't know if there is something I have to consider before doing the query of an image in that way. – Roger Almengor Oct 22 '19 at 14:25

There are two issues in your code, first, the image that you are looking for is not in the collection that you specified, second, the name of the image is not the same as the one in sentinel hub.

What I did here was to first limit the area of interest by drawing a polygon, and then filter the sentinel 2 collection by date and area of interest.


var s2 = ee.ImageCollection('COPERNICUS/S2').filterDate('2019-03-13', '2019-03-15').filterBounds(geometry)
Map.addLayer(s2, {bands: ['B8', 'B11', 'B4'], max: 4000}, 'S2');

or just change the collection where you are searching the image:

var s2 = ee.Image('COPERNICUS/S2/20190314T155521_20190314T155521_T17PLK')
Map.addLayer(s2, {bands: ['B8', 'B11', 'B4'], max: 4000}, 'S2');
|improve this answer|||||

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.