Basic example doesn't work under foliumap plotting backend #1719
-
I simply tried to run the first example from the documentation (https://geemap.org/get-started/) but the final plot doesn't display the layers that I added to it. When I changed to You can test it on Colab: # -*- coding: utf-8 -*-
"""test_geemap.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1Xk_tQuSvGIjA5PXO6UDt_na70olioOOB
"""
!pip install geemap
import ee
import geemap.foliumap as geemap
lat, lon = -23.5546721, -46.7318389
my_map = geemap.Map(center=(lat, lon), zoom=15)
my_map
dem = ee.Image('USGS/SRTMGL1_003')
landcover = ee.Image("ESA/GLOBCOVER_L4_200901_200912_V2_3").select('landcover')
landsat7 = ee.Image('LANDSAT/LE7_TOA_5YEAR/1999_2003')
states = ee.FeatureCollection("TIGER/2018/States")
dem_vis = {
'min': 0,
'max': 4000,
'palette': ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']}
landsat_vis = {
'min': 0,
'max': 200,
'bands': ['B4', 'B3', 'B2']
}
my_map.addLayer(dem, dem_vis, 'SRTM DEM', True, 0.5)
my_map.addLayer(landcover, {}, 'Land cover')
my_map.addLayer(ee_object=landsat7, vis_params=landsat_vis, name='Landsat 7', shown=True, opacity=1)
my_map.addLayer(states, {}, "US States")
my_map
my_map.__dict__
My map output was the following::
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Folium map is a one way street. You can need to add all layers before displaying the map. Once the map is displayed, no additional changes can be made to the map. In your example, you already display the map after creating it, all EE layers added later on would not be added to the map. import ee
import geemap.foliumap as geemap
lat, lon = -23.5546721, -46.7318389
my_map = geemap.Map(center=(lat, lon), zoom=15)
dem = ee.Image('USGS/SRTMGL1_003')
landcover = ee.Image("ESA/GLOBCOVER_L4_200901_200912_V2_3").select('landcover')
landsat7 = ee.Image('LANDSAT/LE7_TOA_5YEAR/1999_2003')
states = ee.FeatureCollection("TIGER/2018/States")
dem_vis = {
'min': 0,
'max': 4000,
'palette': ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']}
landsat_vis = {
'min': 0,
'max': 200,
'bands': ['B4', 'B3', 'B2']
}
my_map.addLayer(dem, dem_vis, 'SRTM DEM', True, 0.5)
my_map.addLayer(landcover, {}, 'Land cover')
my_map.addLayer(ee_object=landsat7, vis_params=landsat_vis, name='Landsat 7', shown=True, opacity=1)
my_map.addLayer(states, {}, "US States")
my_map |
Beta Was this translation helpful? Give feedback.
Folium map is a one way street. You can need to add all layers before displaying the map. Once the map is displayed, no additional changes can be made to the map. In your example, you already display the map after creating it, all EE layers added later on would not be added to the map.