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 ofee.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):