54 plot raster
Uncomment the following line to install leafmap if needed.
In [1]:
Copied!
# !pip install leafmap
# !pip install leafmap
In [2]:
Copied!
import os
import leafmap
import os
import leafmap
Download a sample dataset.
In [3]:
Copied!
url = "https://open.gishub.org/data/raster/srtm90.tif"
url = "https://open.gishub.org/data/raster/srtm90.tif"
In [4]:
Copied!
image = "srtm90.tif"
if not os.path.exists(image):
leafmap.download_file(url, image)
image = "srtm90.tif"
if not os.path.exists(image):
leafmap.download_file(url, image)
Plot the raster image in 2D.
In [5]:
Copied!
leafmap.plot_raster(image, cmap="terrain", figsize=(15, 10))
leafmap.plot_raster(image, cmap="terrain", figsize=(15, 10))
Plot the raster image in 3D.
In [6]:
Copied!
leafmap.plot_raster_3d("srtm90.tif", factor=2, cmap="terrain", background="gray")
leafmap.plot_raster_3d("srtm90.tif", factor=2, cmap="terrain", background="gray")