top of page

WEEK1

  • 作家相片: TANG HAORAN
    TANG HAORAN
  • 2024年3月12日
  • 讀畢需時 1 分鐘

GEE Coding:

// Workflow of building and publishing a GEE App

// USGS US LANDCOVER DATA

var nlcd = ee.ImageCollection("USGS/NLCD_RELEASES/2019_REL/NLCD");

print(nlcd);

var nlcds = {

'2001': ee.Image('USGS/NLCD_RELEASES/2019_REL/NLCD/2001').select('landcover').visualize(),

'2004': ee.Image('USGS/NLCD_RELEASES/2019_REL/NLCD/2004').select('landcover').visualize(),

'2006': ee.Image('USGS/NLCD_RELEASES/2019_REL/NLCD/2006').select('landcover').visualize(),

'2008': ee.Image('USGS/NLCD_RELEASES/2019_REL/NLCD/2008').select('landcover').visualize(),

'2011': ee.Image('USGS/NLCD_RELEASES/2019_REL/NLCD/2011').select('landcover').visualize(),

'2013': ee.Image('USGS/NLCD_RELEASES/2019_REL/NLCD/2013').select('landcover').visualize(),

'2016': ee.Image('USGS/NLCD_RELEASES/2019_REL/NLCD/2016').select('landcover').visualize(),

'2019': ee.Image('USGS/NLCD_RELEASES/2019_REL/NLCD/2019').select('landcover').visualize()

};

print(nlcds);

// ADD WIDGET TO THE MAP

function addLayerSelector(map, value, position) {

var label = ui.Label('Choose the year');

// Change to show NLCD maps in different years

function updateMap(selection) {

map.layers().set(0, ui.Map.Layer(nlcds[selection]));

}

// Configure a selection dropdown widget

var select = ui.Select({

items: Object.keys(nlcds),

onChange: updateMap

});

select.setValue(Object.keys(nlcds)[value]);

var controlPanel = ui.Panel({

widgets: [label, select],

style: { position: position }

});

map.add(controlPanel);

}

// Setup two map panels

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, 0, 'top-right');

// Create a SplitPanel to connect two maps

var splitPanel = ui.SplitPanel({

firstPanel: leftMap,

secondPanel: rightMap,

wipe: true,

style: { stretch: 'both' }

});

// Set the SplitPanel into the UI root

ui.root.widgets().reset([splitPanel]);

var linker = ui.Map.Linker([leftMap, rightMap]);

leftMap.setCenter(-119,38,10)


最新文章

查看全部
WEEK13

Week 13: Wrapping up my journey of learning R programming. Consolidated my knowledge and practiced with various exercises. Feeling...

 
 
 
WEEK12

Week 12: Made significant progress in R programming. Explored advanced topics like data mining and machine learning. Excited to dive...

 
 
 

留言


Silver Team

©2024 Silver Team 版權所有。透過 Wix.com 製作的理想網站

bottom of page