[GIS] How to find Sentinel-2 dataset ID on Google Earth Engine

google-earth-enginesentinel-2

I'm new at Google Earth Engine and Javascript.

I'm trying to use Sentinel-2 data in the API following this tutorial of Landsat data .

According to this, it is possible to load/add a Sentinel-2 granule by naming the image like this:

COPERNICUS/S2/20151128T002653_20151128T102149_T56MNN

So, in my case, I've tried to load an existing Sentinel-2 granule, writing this:

var s2 = ee.ImageCollection('COPERNICUS/S2/20160412T015159_20150828T110656_T30SVG');
Map.centerObject(s2, 8);

The result of this script is:

s2 image: Layer error: ImageCollection.load: ImageCollection asset 'COPERNICUS/S2/20160412T015159_20150828T110656_T30SVG' not found.

However, if I look Sentinel-2 images in the same area of the granule with the following code:

Map.addLayer(ee.ImageCollection('COPERNICUS/S2'));
Map.setCenter(-2.44, 37.77, 12);

I can visualize the Sentinel-2 image.

How can I know the ID of the visualized image?

Best Answer

Two issues with your script:

1) A single image works best when you use ee.Image instead of ee.ImageCollection.

2) You switched up the granule name. The first part is the sensing time and the second the ingestion time. An acquisition taken in 2016 cannot be ingested in 2015. It should be 20150828T110656_20160412T015159_T30SVG not the other way round.

As a complete script (on EarthEngine):

// not in Collection - switched sensing and acquisition time
// var s2 = ee.Image('COPERNICUS/S2/20160412T015159_20150828T110656_T30SVG');
// in Collection - correct granule
var s2 = ee.Image('COPERNICUS/S2/20150828T110656_20160412T015159_T30SVG');
Map.addLayer(s2, {bands: ['B8', 'B4', 'B3'], max: 4000}, 'S2')
Map.centerObject(s2, 8);