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)
Downloading... From: https://open.gishub.org/data/raster/srtm90.tif To: /home/runner/work/leafmap/leafmap/docs/notebooks/srtm90.tif 100%|██████████| 15.2M/15.2M [00:00<00:00, 207MB/s]
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')
Last update:
2023-09-22
Created: 2023-09-22
Created: 2023-09-22