Uncomment the following line to install geemap if needed.
# !pip install geemap
To follow this tutorial, you need to install the [geemap] and xarray_leaflet Python packages. Use the following conda commands to create a conda env and install packages:
conda create -n gee python
conda activate gee
conda install mamba -c conda-forge
mamba install geemap xarray_leaflet -c conda-forge
Import libraries
import geemap
Specify input raster datasets
url1 = "https://open.gishub.org/data/raster/landsat.tif"
url2 = "https://open.gishub.org/data/raster/srtm90.tif"
Download samples raster datasets
More datasets can be downloaded from https://viewer.nationalmap.gov/basic/
landsat = geemap.download_file(url1, "landsat.tif")
dem = geemap.download_file(url2, "srtm90.tif")
Create an interactive map
Map = geemap.Map()
Add local raster datasets to the map
More colormap can be found at https://matplotlib.org/stable/tutorials/colors/colormaps.html
Map.add_raster(dem, colormap="terrain", layer_name="DEM")
Map.add_raster(landsat, indexes=[3, 2, 1], vmin=10, vmax=180, layer_name="Landsat")
Display the map
Map