-
Notifications
You must be signed in to change notification settings - Fork 5
/
critical_infrastructure_spatial_index_cisi
113 lines (94 loc) · 4.29 KB
/
critical_infrastructure_spatial_index_cisi
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/**** Start of imports. If edited, may not auto-convert in the playground. ****/
var global_CISI = ee.Image("projects/sat-io/open-datasets/CISI/global_CISI"),
infrastructure = ee.ImageCollection("projects/sat-io/open-datasets/CISI/amount_infrastructure");
/***** End of imports. If edited, may not auto-convert in the playground. *****/
//▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▄▀▄▀▄▀▄▄▀
//▄▀▄▀▄ ▄▀▄▀▄▀▄
//▄▀▄▀▄ COPY THIS URL LINK TO PLAY AROUND WITH THE CODE ▄▀▄▀▄▀▄
//▄▀▄▀▄ ▄▀▄▀▄▀▄
//▄▀▄▀▄ https://code.earthengine.google.com/c09818df9994072215dab348fab99563 ▄▀▄▀▄▀▄
//▄▀▄▀▄ ▄▀▄▀▄▀▄
//▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀
// ######################################### //
// ###### Critical Infrastructure ###### //
// ###### Spatial Index ###### //
// ######################################### //
/**
* This is an example script for visualizing dataset from awesome gee commmunity
* on critical infrastructure (CI). It is a gridded raster data layer integrated with
* global spatial intensity of CI sourcing from the Open Source Map.
*
* This script produce visualization for an area of interest (i.e. Pakistan in this example).
*
* Dataset Source:
* Nirandjan, Sadhana, Koks, Elco E., Ward, Philip J., & Aerts, Jeroen C.J.H. (2021). A spatially-explicit harmonized global dataset of critical infrastructure (v1.0.0.)
* [Data set]. Zenodo. https://doi.org/10.5281/zenodo.4957647
*
* Project Details:
* https://gee-community-catalog.org/projects/cisi/
*
*/
// import modules
var palettes = require('users/gena/packages:palettes');
var analysis = require('users/pinkychow1010/WB_IntraUrban:analysis_utils');
// derive country polygon
var ADM2 = ee.FeatureCollection('projects/earthengine-legacy/assets/projects/sat-io/open-datasets/geoboundaries/CGAZ_ADM2');
// extract Pakistan polygon
var pakistan = ADM2.filter(ee.Filter.eq('shapeGroup', 'PAK'));
// map layout
Map.setOptions("Hybrid");
Map.centerObject(pakistan, 6);
// derive hospital points
print(infrastructure.aggregate_array('id_no'));
var hospital = infrastructure.filter(ee.Filter.eq('id_no','hospital'));
// visualize CI index
var cisi = global_CISI.clip(pakistan);
var vis = {min:0,max:0.2,palette: ['orange','yellow','green','blue']};
Map.addLayer(cisi,vis,'Global CISI');
Map.addLayer(
hospital.sum().clip(pakistan),
{min:0,max:50,palette:'aqua'},
'Hospitals'
);
// get area of interest: Pakistan
var ADM2 = ee.FeatureCollection('projects/earthengine-legacy/assets/projects/sat-io/open-datasets/geoboundaries/CGAZ_ADM2');
var pakistan = ADM2.filter(ee.Filter.eq('shapeGroup', 'PAK'));
// arguments for choropleth map
var vector = pakistan; //ee.FeatureCollection("projects/ee-pinkychow1010/assets/WB_GEE/karachi_union_council_subset");
var attribute = 'mean';
var palette = palettes.cmocean.Balance[6];
var log = 0;
var class_n = 6;
var title = "Mean";
var opacity = 0.9;
// sample raster values
var zonal = cisi.reduceRegions({
collection: vector,
scale: 500,
reducer: ee.Reducer.mean()
});
// print(zonal);
// call function for choropleth_map
analysis.choropleth_map(
vector=zonal,
attribute=attribute,
palette=palette,
opacity=opacity,
log=log,
class_n=class_n,
title=title
);
// customized basemap to enhance visuals
var basemap = require('users/pinkychow1010/WB_IntraUrban:basemap_resources');
basemap.addCustomBasemap('simpleLight');
// add title label
Map.add(ui.Label('CISI in Pakistan (2021)',
{
position: 'top-center',
fontSize: '30px',
backgroundColor: '#0047AB',
fontWeight: '500',
color: 'white'
}
));
Map.centerObject(pakistan, 6);