I have used this code https://www.gears-lab.com/intro_rs_lab8/ in order to learn and practice my SAR-1 skills. I have created an almost similar code, but few things are not clear to me regard this code. In the end of the code, I am supposed to display in RGB 3 different layers. How does it work? I get only one image, so what is the meaning of display each one of them as RGB in one image?

  1. When I use the inspector in order to check the values I gave in the RGB stack (seasonal stack) I have "layer" that not suppose to be there- VV. That confuses me even more- why don't I get the 3 layers I stack together? (vv1,vv2, and vv3)

enter image description here

I would say this relates to the first question. of how it displays 3 images as 3 different band in one image.

This is the code I used, it has error with the VH for a reason I don't know yet

var geometry=geometry2;
// Filter the collection for the VV product from the descending track
var collectionVV = ee.ImageCollection('COPERNICUS/S1_GRD')
    .filter(ee.Filter.eq('instrumentMode', 'IW'))
    .filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VV'))
    .filter(ee.Filter.eq('orbitProperties_pass', 'DESCENDING'))

// Filter the collection for the VH product from the descending track
var collectionVH = ee.ImageCollection('COPERNICUS/S1_GRD')
    .filter(ee.Filter.eq('instrumentMode', 'IW'))
    .filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VH'))
    .filter(ee.Filter.eq('orbitProperties_pass', 'DESCENDING'))


var clippedVV=collectionVV.map(function(im){ 
   return im.clip(geometry);

var clippedVH=collectionVH.map(function(im){ 
   return im.clip(geometry);

var VV = clippedVV.median();
var VH= clippedVH.median();

// Adding the VV layer to the map
//Map.addLayer(VV, {min: -30, max: -1}, 'VV');
//Map.addLayer(VH,{min:-30, max:-1}, 'VH');

// Create a 3 band stack by selecting from different periods (months) for VV

var VV1 = ee.Image(clippedVV.filterDate('2017-10-01', '2017-11-30').median());
var VV2 = ee.Image(clippedVV.filterDate('2017-12-01', '2018-12-31').median());
var VV3 = ee.Image(clippedVV.filterDate('2019-01-01', '2019-02-28').median());

// Create a 3 band stack by selecting from different periods (months) for VH

var VH1 = ee.Image(clippedVH.filterDate('2017-10-01', '2017-11-30').median());
var VH2 = ee.Image(clippedVH.filterDate('2017-12-01', '2018-12-31').median());
var VH3 = ee.Image(clippedVH.filterDate('2019-01-01', '2018-02-28').median());
//Add to map
Map.addLayer(VV1.addBands(VV2).addBands(VV3), {min: -30, max: -1}, 'Season compositeVV');
Map.addLayer(VH1.addBands(VH2).addBands(VH3), {min: -30, max: -1}, 'Season compositeVH');

Map.addLayer(VV1,{min:-30,max:-1},'Season composite inly vv1');
Map.addLayer(VV2,{min:-30,max:-1},'Season composite inly vv2');
Map.addLayer(VV3,{min:-30,max:-1},'Season composite inly vv3');

Looks like you want to explore the image.visualize() function. For example, you can create an imageCollection with your Images of interest, then convert that collection into a single Image with 3 bands. The visualize() function allows you to assign those bands to RGB values:

// convert images to Collection
var myCol = ee.ImageCollection.fromImages([VV1,VV2,VV3]); 
// convert to 3-band image
var myColBands = myCol.toBands();
// Visualize using min and max parameters from code above
var myColViz = myColBands.visualize({min:-30, max:1});
// Add to map
  • 1
    You can avoid converting to ImageCollection and back to Image by using the ee.Image.cat() function. var myColBands = ee.Image.cat(VV1, VV2, VV3); – Justin Braaten Nov 11 '19 at 0:20
  • Thaks for your answer, but there is something I am still bot sure about. If I convert those images into image collections and then display it in RGB, then how does it decided which value will get which color? each pixel has 3 values (one from each image), so then how is it decided what will be the value ? – Reut Nov 14 '19 at 9:07
  • Use the Bands argument as per documentation: developers.google.com/earth-engine/image_visualization – JepsonNomad Nov 14 '19 at 16:58

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.