3

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:

https://gis.stackexchange.com/questions/200043/how-do-i-find-sentinel-2-dataset-id-on-google-earth-engine

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

https://scihub.copernicus.eu/dhus/odata/v1/Products('d3c42954-1eb8-4fb2-b297-061f1f9c0d19')/$value
```[![enter image description here][1]][1]


  [1]: https://i.sstatic.net/mijBJ.jpg
1
  • I don't know if there is something I have to consider before doing the query of an image in that way. Commented Oct 22, 2019 at 14:25

1 Answer 1

3

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.


Map.centerObject(geometry)

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

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');
Map.centerObject(s2,8);

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.