-
Notifications
You must be signed in to change notification settings - Fork 159
Expand file tree
/
Copy pathstyled_layer_descriptors.R
More file actions
35 lines (31 loc) · 1.81 KB
/
Copy pathstyled_layer_descriptors.R
File metadata and controls
35 lines (31 loc) · 1.81 KB
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
library(rgee)
# ee_reattach() # reattach ee as a reserved word
ee_Initialize()
cover <- ee$Image("MODIS/051/MCD12Q1/2012_01_01")$select("Land_Cover_Type_1")
# Define an SLD style of discrete intervals to apply to the image.
sld_intervals <- paste0(
"<RasterSymbolizer>",
' <ColorMap type="intervals" extended="false" >',
'<ColorMapEntry color="#aec3d4" quantity="0" label="Water"/>',
'<ColorMapEntry color="#152106" quantity="1" label="Evergreen Needleleaf Forest"/>',
'<ColorMapEntry color="#225129" quantity="2" label="Evergreen Broadleaf Forest"/>',
'<ColorMapEntry color="#369b47" quantity="3" label="Deciduous Needleleaf Forest"/>',
'<ColorMapEntry color="#30eb5b" quantity="4" label="Deciduous Broadleaf Forest"/>',
'<ColorMapEntry color="#387242" quantity="5" label="Mixed Deciduous Forest"/>',
'<ColorMapEntry color="#6a2325" quantity="6" label="Closed Shrubland"/>',
'<ColorMapEntry color="#c3aa69" quantity="7" label="Open Shrubland"/>',
'<ColorMapEntry color="#b76031" quantity="8" label="Woody Savanna"/>',
'<ColorMapEntry color="#d9903d" quantity="9" label="Savanna"/>',
'<ColorMapEntry color="#91af40" quantity="10" label="Grassland"/>',
'<ColorMapEntry color="#111149" quantity="11" label="Permanent Wetland"/>',
'<ColorMapEntry color="#cdb33b" quantity="12" label="Cropland"/>',
'<ColorMapEntry color="#cc0013" quantity="13" label="Urban"/>',
'<ColorMapEntry color="#33280d" quantity="14" label="Crop, Natural Veg. Mosaic"/>',
'<ColorMapEntry color="#d7cdcc" quantity="15" label="Permanent Snow, Ice"/>',
'<ColorMapEntry color="#f7e084" quantity="16" label="Barren, Desert"/>',
'<ColorMapEntry color="#6f6f6f" quantity="17" label="Tundra"/>',
"</ColorMap>",
"</RasterSymbolizer>"
)
Map$setCenter(0, 0, 1)
Map$addLayer(cover$sldStyle(sld_intervals), name = "IGBP classification styled")