-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
386 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
var ezui = require('users/TEST/theGeoict:ui/widgets'); | ||
|
||
// data layers | ||
var dmsp = ee.ImageCollection("projects/sat-io/open-datasets/Harmonized_NTL/dmsp"); | ||
var viirs = ee.ImageCollection("projects/sat-io/open-datasets/Harmonized_NTL/viirs"); | ||
var viirsMasked = viirs.map(function(f){ | ||
var mask = f.gte(50); | ||
return f.updateMask(mask); | ||
}); | ||
var dmsp1990 = dmsp.first(); | ||
var viirs2020 = viirs.sort('system:time_start',false).first(); | ||
var timeseries = viirsMasked.merge(dmsp).map(function(f){return f.unmask()}); | ||
|
||
// ui components | ||
// introPanel(params: client side dict) | ||
// title: title of intro panel | ||
// subtext: optional - a desctipion of the app | ||
// width: the width of the panel as a format string (e.g. '300px') | ||
// key: dictionary key for introPanel object | ||
var panel = ezui.introPanel({ | ||
key:'main', | ||
title:'Harmonized Global Night Time Lights (1992-2020)', | ||
subtext:'An example of ezui', | ||
width:'300px' | ||
|
||
}); | ||
|
||
// add a text box textBox(key:str, panel:[ee.Panel, ezui panel object ], text:str) | ||
ezui.textBox( | ||
'description', | ||
panel, | ||
"In this study, the authors generated an integrated and consistent NTL dataset at the global scale by harmonizing the inter-calibrated NTL observations from the DMSP data and the simulated DMSP-like NTL observations from the VIIRS data. The generated global DMSP NTL time-series data (1992–2018) show consistent temporal trends. This temporally extended DMSP NTL dataset provides valuable support for various studies related to human activities such as electricity consumption and urban extent dynamics." | ||
); | ||
|
||
// Some visulization parameters | ||
var viz = ["67001f","b2182b","d6604d","f4a582","fddbc7","ffffff","e0e0e0","bababa","878787","4d4d4d"].reverse(); | ||
|
||
// lets add checkboxs to view the main layers | ||
// checkBoxLayer(params:client side dict) | ||
// label: title of the check box | ||
// Map: the maplayer to turn layer on/off | ||
// layer object: image, feature, feacture collection | ||
// key: optional - dictionary key for checkbox object (defaults to checkboxN) | ||
// value : optional - default value of check box (defaults to false) | ||
ezui.checkBoxLayer({ | ||
label: "DMSP NTL 1992", | ||
map:Map, | ||
layer: dmsp1990, | ||
visParams:{min:50,max:65,palette:viz} | ||
}); | ||
ezui.checkBoxLayer({ | ||
label:"Harmonized Simulated VIIRS NTL 2020", | ||
map:Map, | ||
layer:viirs2020, | ||
visParams:{min:50,max:65,palette:viz} | ||
}); | ||
|
||
// Adds checkBoxLayer elements to a panel. | ||
ezui.addCheckBoxesToPanel(panel); | ||
|
||
ezui.textBox('chartInfo',panel,"Click anywhere in the map to create a chart."); | ||
|
||
// clickToInspectChart(params:client side dict) | ||
// panel: the panel to add the chart to | ||
// key : a key to identify the chart | ||
// imageCollection: the image collection for the time serise chart | ||
// index : optional - int - the index of the ui panel live in. if not selected panels will be added each time clicked | ||
// title: optional- the chart title, defaults 'Chart' | ||
// vAxis: optional - vertical axis title, defaults '' | ||
// hAxis: optional - horizional axis title, defaults 'time' | ||
// reducer optional - defaults mean, | ||
// scale: optional - defaults 30m, | ||
ezui.clickToInspectChart({ | ||
panel:panel, | ||
key:'timeseriesChart', | ||
imageCollection:timeseries, | ||
title: "Time series of night lights", | ||
scale:100 | ||
}); | ||
|
||
// add a bsemap | ||
ezui.basemap.addCustomBasemap('Dark'); | ||
|
||
// add a legend | ||
// add a legend to the app. | ||
var legendPalette = viz; | ||
var legendLabels = ["low","","","","medium","","","","","high"]; | ||
var legendTitle = "Night lights"; | ||
|
||
ezui.addLegendToMap(legendPalette, legendLabels, legendTitle); | ||
|
||
ui.root.insert(0, panel); |
Oops, something went wrong.