🌐 localtileserver#
Need to visualize a rather large (gigabytes+) raster? This is for you.
Try it out below!
from localtileserver import TileClient, get_leaflet_tile_layer, examples
from ipyleaflet import Map
# Create a TileClient from a raster file
# client = TileClient('path/to/geo.tif')
client = examples.get_san_francisco() # use example data
# Create ipyleaflet TileLayer from that server
t = get_leaflet_tile_layer(client)
# Create ipyleaflet map, add tile layer, and display
m = Map(center=client.center(), zoom=client.default_zoom)
m.add_layer(t)
m
A Python package for serving tiles from large raster files in
the Slippy Maps standard
(i.e., /zoom/x/y.png) for visualization in Jupyter with ipyleaflet
or folium
.
Launch a demo on MyBinder
Under the hood, this is also a Flask blueprint/application for use as a standalone web app or in your own web deployments needing dynamic tile serving.
🌟 Highlights#
Launch a tile server for large geospatial images
View local or remote* raster files with
ipyleaflet
orfolium
in JupyterView rasters with CesiumJS with the built-in Flask web application
Extract regions of interest (ROIs) interactively
Use the example datasets to generate Digital Elevation Models
remote raster files should be pre-tiled Cloud Optimized GeoTiffs
ℹ️ Overview#
The TileClient
class can be used to to launch a tile server in a background
thread which will serve raster imagery to a viewer (see ipyleaflet
and
folium
examples in 🚀 User Guide).
This tile server can efficiently deliver varying resolutions of your raster imagery to your viewer; it helps to have pre-tiled, Cloud Optimized GeoTIFFs (COG), but no wories if not as the backing library, large_image, will tile and cache for you when opening the raster.
There is an included, standalone web viewer leveraging CesiumJS and GeoJS. You can use the web viewer to select and extract regions of interest from rasters.
🪢 Community Usage#
leafmap and geemap: use localtileserver for visualizing large raster images in a Jupyter-based geospatial mapping application
streamlit-geospatial: uses localtileserver’s flask-based remote tile server for viewing image tiles
remotetileserver: uses the core flask application to spin up a production ready tile server
Kaustav Mukherjee’s blog post: a user-created demonstration on how to get started with localtileserver
Serving up SpaceNet Imagery for Bokeh: Adam Van Etten’s blog post using localtileserver to view imagery with Bokeh