25 load rasters
Uncomment the following line to install geemap if needed.
In [ ]:
Copied!
# !pip install geemap
# !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
In [ ]:
Copied!
import geemap
import geemap
Specify input raster datasets
In [ ]:
Copied!
url1 = "https://open.gishub.org/data/raster/landsat.tif"
url2 = "https://open.gishub.org/data/raster/srtm90.tif"
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/
In [ ]:
Copied!
landsat = geemap.download_file(url1, "landsat.tif")
dem = geemap.download_file(url2, "srtm90.tif")
landsat = geemap.download_file(url1, "landsat.tif")
dem = geemap.download_file(url2, "srtm90.tif")
Create an interactive map
In [ ]:
Copied!
Map = geemap.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
In [ ]:
Copied!
Map.add_raster(dem, colormap="terrain", layer_name="DEM")
Map.add_raster(dem, colormap="terrain", layer_name="DEM")
In [ ]:
Copied!
Map.add_raster(landsat, indexes=[3, 2, 1], vmin=10, vmax=180, layer_name="Landsat")
Map.add_raster(landsat, indexes=[3, 2, 1], vmin=10, vmax=180, layer_name="Landsat")
Display the map
In [ ]:
Copied!
Map
Map