09 split map
Split-panel map¶
The split-panel map requires two layers: left_layer
and right_layer
. The layer instance can be a string representing a basemap, or an HTTP URL to a Cloud Optimized GeoTIFF (COG), or a folium TileLayer instance.
Uncomment and execute the following code block to install geemap if needed.
In [1]:
Copied!
# !pip install geemap
# !pip install geemap
In [2]:
Copied!
import ee
import geemap.foliumap as geemap
import ee
import geemap.foliumap as geemap
In [3]:
Copied!
Map = geemap.Map(height=600)
Map.split_map(left_layer='HYBRID', right_layer='TERRAIN')
Map
Map = geemap.Map(height=600)
Map.split_map(left_layer='HYBRID', right_layer='TERRAIN')
Map
Out[3]:
Save the map as an HTML webpage.
In [4]:
Copied!
Map.to_html('split-map.html')
Map.to_html('split-map.html')
Use folium.WmsTileLayer instance.
In [5]:
Copied!
Map = geemap.Map(center=(40, -100), zoom=4, height=600)
Map.split_map(
left_layer='NLCD 2001 CONUS Land Cover', right_layer='NLCD 2019 CONUS Land Cover'
)
Map.add_legend(builtin_legend='NLCD')
Map
Map = geemap.Map(center=(40, -100), zoom=4, height=600)
Map.split_map(
left_layer='NLCD 2001 CONUS Land Cover', right_layer='NLCD 2019 CONUS Land Cover'
)
Map.add_legend(builtin_legend='NLCD')
Map
Out[5]:
Use Earth Engine layers.
In [6]:
Copied!
Map = geemap.Map(center=(40, -100), zoom=4, height=600)
nlcd_2001 = ee.Image('USGS/NLCD_RELEASES/2019_REL/NLCD/2001').select('landcover')
nlcd_2019 = ee.Image('USGS/NLCD_RELEASES/2019_REL/NLCD/2019').select('landcover')
left_layer = geemap.ee_tile_layer(nlcd_2001, {}, 'NLCD 2001')
right_layer = geemap.ee_tile_layer(nlcd_2019, {}, 'NLCD 2019')
Map.split_map(left_layer, right_layer)
Map
Map = geemap.Map(center=(40, -100), zoom=4, height=600)
nlcd_2001 = ee.Image('USGS/NLCD_RELEASES/2019_REL/NLCD/2001').select('landcover')
nlcd_2019 = ee.Image('USGS/NLCD_RELEASES/2019_REL/NLCD/2019').select('landcover')
left_layer = geemap.ee_tile_layer(nlcd_2001, {}, 'NLCD 2001')
right_layer = geemap.ee_tile_layer(nlcd_2019, {}, 'NLCD 2019')
Map.split_map(left_layer, right_layer)
Map
Out[6]:
In [7]:
Copied!
Map.to_html("NLCD.html")
Map.to_html("NLCD.html")
Linked maps¶
In [8]:
Copied!
import geemap
import geemap
In [9]:
Copied!
image = (
ee.ImageCollection('COPERNICUS/S2')
.filterDate('2018-09-01', '2018-09-30')
.map(lambda img: img.divide(10000))
.median()
)
vis_params = [
{'bands': ['B4', 'B3', 'B2'], 'min': 0, 'max': 0.3, 'gamma': 1.3},
{'bands': ['B8', 'B11', 'B4'], 'min': 0, 'max': 0.3, 'gamma': 1.3},
{'bands': ['B8', 'B4', 'B3'], 'min': 0, 'max': 0.3, 'gamma': 1.3},
{'bands': ['B12', 'B12', 'B4'], 'min': 0, 'max': 0.3, 'gamma': 1.3},
]
labels = [
'Natural Color (B4/B3/B2)',
'Land/Water (B8/B11/B4)',
'Color Infrared (B8/B4/B3)',
'Vegetation (B12/B11/B4)',
]
geemap.linked_maps(
rows=2,
cols=2,
height="400px",
center=[38.4151, 21.2712],
zoom=12,
ee_objects=[image],
vis_params=vis_params,
labels=labels,
label_position="topright",
)
image = (
ee.ImageCollection('COPERNICUS/S2')
.filterDate('2018-09-01', '2018-09-30')
.map(lambda img: img.divide(10000))
.median()
)
vis_params = [
{'bands': ['B4', 'B3', 'B2'], 'min': 0, 'max': 0.3, 'gamma': 1.3},
{'bands': ['B8', 'B11', 'B4'], 'min': 0, 'max': 0.3, 'gamma': 1.3},
{'bands': ['B8', 'B4', 'B3'], 'min': 0, 'max': 0.3, 'gamma': 1.3},
{'bands': ['B12', 'B12', 'B4'], 'min': 0, 'max': 0.3, 'gamma': 1.3},
]
labels = [
'Natural Color (B4/B3/B2)',
'Land/Water (B8/B11/B4)',
'Color Infrared (B8/B4/B3)',
'Vegetation (B12/B11/B4)',
]
geemap.linked_maps(
rows=2,
cols=2,
height="400px",
center=[38.4151, 21.2712],
zoom=12,
ee_objects=[image],
vis_params=vis_params,
labels=labels,
label_position="topright",
)
The folium plotting backend does not support this function.
Last update:
2022-03-25