Local raster
Visualize local raster datasets
This notebook demonstrates how to visualize local raster datasets with localtileserver.
Uncomment the following line to install leafmap if needed.
In [ ]:
Copied!
# %pip install "leafmap[maplibre]"
# %pip install "leafmap[maplibre]"
In [ ]:
Copied!
import leafmap.maplibregl as leafmap
import leafmap.maplibregl as leafmap
In [ ]:
Copied!
# import os
# os.environ["MAPTILER_KEY"] = "YOUR_API_KEY"
# import os
# os.environ["MAPTILER_KEY"] = "YOUR_API_KEY"
In [ ]:
Copied!
url = "https://github.com/opengeos/datasets/releases/download/raster/landsat.tif"
filepath = "landsat.tif"
leafmap.download_file(url, filepath)
url = "https://github.com/opengeos/datasets/releases/download/raster/landsat.tif"
filepath = "landsat.tif"
leafmap.download_file(url, filepath)
In [ ]:
Copied!
m = leafmap.Map(style="streets")
m.add_raster(filepath, indexes=[3, 2, 1], vmin=0, vmax=100, name="Landsat-321")
m.add_raster(filepath, indexes=[4, 3, 2], vmin=0, vmax=100, name="Landsat-432")
m
m = leafmap.Map(style="streets")
m.add_raster(filepath, indexes=[3, 2, 1], vmin=0, vmax=100, name="Landsat-321")
m.add_raster(filepath, indexes=[4, 3, 2], vmin=0, vmax=100, name="Landsat-432")
m
In [ ]:
Copied!
m.layer_interact()
m.layer_interact()

In [ ]:
Copied!
url = "https://github.com/opengeos/datasets/releases/download/raster/srtm90.tif"
filepath = "srtm90.tif"
leafmap.download_file(url, filepath)
url = "https://github.com/opengeos/datasets/releases/download/raster/srtm90.tif"
filepath = "srtm90.tif"
leafmap.download_file(url, filepath)
In [ ]:
Copied!
m = leafmap.Map(style="streets")
m.add_raster(filepath, colormap="terrain", name="DEM")
m
m = leafmap.Map(style="streets")
m.add_raster(filepath, colormap="terrain", name="DEM")
m
In [ ]:
Copied!
m.layer_interact()
m.layer_interact()
