1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| var test_c3_30 = ee.Image("users/daviddoyle1/test_c3_30"), var test_c3 = ee.Image("users/daviddoyle1/test_c3"); var coverVis = { min: 0.0, max: 3.0, palette: [ "000000","0000ff","00ff00","0000ff" ] };
var images ={ 'high resolution':test_c3.visualize(coverVis), '30m resolution':test_c3_30.visualize(coverVis), };
var leftMap = ui.Map(); leftMap.setControlVisibility(false); var leftSelector = addLayerSelector(leftMap, 0, 'top-left');
var rightMap = ui.Map(); rightMap.setControlVisibility(false); var rightSelector = addLayerSelector(rightMap, 1, 'top-right');
function addLayerSelector(mapToChange, defaultValue, position) { var label = ui.Label('Choose an image to visualize');
function updateMap(selection) { mapToChange.layers().set(0, ui.Map.Layer(images[selection])); }
var select = ui.Select({items: Object.keys(images), onChange: updateMap}); select.setValue(Object.keys(images)[defaultValue], true);
var controlPanel = ui.Panel({widgets: [label, select], style: {position: position}});
mapToChange.add(controlPanel); }
var splitPanel = ui.SplitPanel({ firstPanel: leftMap, secondPanel: rightMap, wipe: true, style: {stretch: 'both'} });
ui.root.widgets().reset([splitPanel]); var linker = ui.Map.Linker([leftMap, rightMap]);
|