• Stars
    star
    274
  • Rank 149,399 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 3 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🌐 dynamic tile server for visualizing rasters in Jupyter with ipyleaflet or folium

tile-diagram

🌐 Local Tile Server for Geospatial Rasters

codecov PyPI conda

Need to visualize a rather large (gigabytes+) raster? This is for you.

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 MyBinder

Documentation: https://localtileserver.banesullivan.com/

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 or folium in Jupyter
  • View 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

πŸš€ Usage

Usage details and examples can be found in the documentation: https://localtileserver.banesullivan.com/

The following is a minimal example to visualize a local raster file with ipyleaflet:

from localtileserver import get_leaflet_tile_layer, TileClient
from ipyleaflet import Map

# First, create a tile server from local raster file
client = TileClient('path/to/geo.tif')

# Create ipyleaflet tile layer from that server
t = get_leaflet_tile_layer(client)

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

ipyleaflet

ℹ️ 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 (usually ipyleaflet or folium in Jupyter notebooks).

This tile server can efficiently deliver varying resolutions of your raster imagery to your viewer; it helps to have pre-tiled, Cloud Optimized GeoTIFFs (COGs), 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.

⬇️ Installation

Get started with localtileserver to view rasters in Jupyter or deploy as your own Flask application.

🐍 Installing with conda

Conda makes managing localtileserver's dependencies across platforms quite easy and this is the recommended method to install:

conda install -c conda-forge localtileserver

🎑 Installing with pip

If you prefer pip, then you can install from PyPI: https://pypi.org/project/localtileserver/

pip install localtileserver

πŸ’­ Feedback

Please share your thoughts and questions on the Discussions board. If you would like to report any bugs or make feature requests, please open an issue.

If filing a bug report, please share a scooby Report:

import localtileserver
print(localtileserver.Report())