Side by Side comparison of sentinel-2 images
// import images var img2018 = ee.Image("COPERNICUS/S2/20180717T104021_20180717T104258_T31UGT"); var img2017 = ee.Image("COPERNICUS/S2/20170717T104019_20170717T104022_T31UGT"); var NAMES = [ 'July 2017', 'July 2018', ]; var IMAGES = [img2017,img2018]; var VIS_PARAMS = [ {gamma:1.3,min: 0, max: 3000, bands: ['B4','B3','B2']}, {gamma:1.3,min: 0, max: 3000, bands: ['B4','B3','B2']}, ]; // Create a map for each visualization option. var maps = []; NAMES.forEach(function(name, index) { var map = ui.Map(); map.add(ui.Label(name)); map.addLayer(IMAGES[index], VIS_PARAMS[index], name); map.setControlVisibility(false); maps.push(map); }); var linker = ui.Map.Linker(maps); // Enable zooming on the top-left map. maps[0].setControlVisibility({zoomControl: true}); // Show the scale (e.g. '500m') on the bottom-right map. maps[1].setControlVisibility({scaleControl: true}); // Create a title. var title = ui.Label('Drought in Europe?', { stretch: 'horizontal', textAlign: 'center', fontWeight: 'bold', fontSize: '24px' }); // Create a grid of maps. var mapGrid = ui.Panel( [ ui.Panel([maps[0]], null, {stretch: 'both'}), ui.Panel([maps[1]], null, {stretch: 'both'}) ], ui.Panel.Layout.Flow('horizontal'), {stretch: 'both'} ); // Add the maps and title to the ui.root. ui.root.widgets().reset([title, mapGrid]); ui.root.setLayout(ui.Panel.Layout.Flow('vertical')); maps[0].centerObject(img2017, 12);