🧩 Rasterio#

localtileserver.TileClient supports viewing rasterio.DatasetReader so that you can easily visualize your data when working with rasterio. This will only work when opening a raster in read-mode.

import rasterio
from ipyleaflet import Map
from localtileserver import TileClient, get_leaflet_tile_layer

src = rasterio.open('path/to/geo.tif')

client = TileClient(src)

t = get_leaflet_tile_layer(client)

m = Map(center=client.center(), zoom=client.default_zoom)

localtileserver actually uses rasterio under the hood for everything and keeps a reference to a rasterio.DatasetReader for all clients.

from localtileserver import examples

# Load example tile layer from publicly available DEM source
client = examples.get_elevation()