0

Here is the code. There are 81 sentinel images but I am only seeing the first one (or the last one maybe), how can I visualize other images. Let's say I want to see the 2nd one ?

// Importing S-1 Images
var S1 = ee.ImageCollection("COPERNICUS/S1_GRD");

// Importing Geometry (area of Interest)
geometry = 
ee.Geometry.Polygon(
    [[[74.38065032641738, 12.778968253582836],
      [74.38065032641738, 7.612293582692355],
      [77.74246673266738, 7.612293582692355],
      [77.74246673266738, 12.778968253582836]]], null, false);

// Define Time Interval 
var start_date = ee.Date('2018-07-21');
var end_date = start_date.advance(3, 'month');
var date_filter = ee.Filter.date(start_date, end_date);

//Display of Image 
var collection2 = S1
    .filter(date_filter)
    .filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VV'))
    .filter(ee.Filter.eq('instrumentMode', 'IW'))
    .filterBounds(geometry);
var vis_params2 = {bands:'VV', min:-25, max:5};
var label2 = 'SAR Backscatter';


// Visualizing the map
Map.addLayer(collection2, vis_params2, 'secondimg')
Map.centerObject(geometry);

1 Answer 1

0

When you add an ee.ImageCollection() to the Map, you see the Mosaic of the imagecollection. Note that there is no single date of acquiring a mosaic image- it is a synthetic image composed of the latest available image for each pixel in a queried geometry.

If you want to specifically obtain the nth image in an imagecollection, convert it to a list and plot only the nth element of that list like so:

var n = 50;
var imageList = collection2.toList(n); //convert image collection to list
var image = ee.Image(imageList.get(n-1)); //obtain nth image from 0 indexed list
// Visualizing the map
Map.addLayer(image, vis_params2, 'nthImg') //add nth image to Map

Again, note that since Sentinel-1 doesn't have a fixed acquisition mode over India, the nth image may or may not cover the entire geometry you queried.

Link to corrected code.

3
  • Thankyou. I got the concept now :)
    – Shagun
    Nov 17, 2020 at 2:02
  • Thanks. a follow up question How can I change tohe label of the image (Lets say I am looking for 2nd image and I want its label as its date of acquisition.
    – Shagun
    Jan 10, 2021 at 0:55
  • Use var image = image.set({"system:id":image.get("system:time_start")})
    – kkrao
    Jan 10, 2021 at 5:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.