Skip to main content

Locally serve geospatial raster tiles in the Slippy Map standard.

Project description

tile-diagram

🌐 Local Tile Server for Geospatial Rasters

codecov PyPI conda

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

A Flask application for serving tiles from large raster files in the Slippy Maps standard (i.e., /zoom/x/y.png)

Launch a demo on MyBinder MyBinder

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

🌟 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
tile_client = TileClient('path/to/geo.tif')

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

m = Map(center=tile_client.center(), zoom=6)
m.add_layer(t)
m

ipyleaflet

ℹ️ Overview

This is a Flask application (blueprint) for serving tiles of large images. 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 Jupyter notebook examples below).

This tile server can efficiently deliver varying levels of detail 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 libraries, 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.

Disclaimer: This is a hobby project and I am doing my best to make it more stable/robust. Things might break between minor releases (I use the major.minor.patch versioning scheme).

⬇️ Installation

Get started with localtileserver to view rasters locally in Jupyter or deploy in 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, and know how to install GDAL on your system, then you can install from PyPI: https://pypi-hypernode.com/project/localtileserver/

pip install localtileserver

📝 A Brief Note on Installing GDAL

GDAL can be a pain in the 🍑 to install, so you may want to handle GDAL before installing localtileserver when using pip.

If on linux, I highly recommend using the large_image_wheels from Kitware.

pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL

💭 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())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

localtileserver-0.5.3.tar.gz (8.7 MB view details)

Uploaded Source

Built Distribution

localtileserver-0.5.3-py3-none-any.whl (8.7 MB view details)

Uploaded Python 3

File details

Details for the file localtileserver-0.5.3.tar.gz.

File metadata

  • Download URL: localtileserver-0.5.3.tar.gz
  • Upload date:
  • Size: 8.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.12

File hashes

Hashes for localtileserver-0.5.3.tar.gz
Algorithm Hash digest
SHA256 efc90c19e3c34ae80c8a2b730e125b85fe15a01be4666e5e56a449dbf4878397
MD5 91ee2ea0349c2157cbe7b9b5f69ebbde
BLAKE2b-256 69bfc23530d77fb8b977a93886727e63e377e3e6b571015afcae88fd2fc11d9b

See more details on using hashes here.

Provenance

File details

Details for the file localtileserver-0.5.3-py3-none-any.whl.

File metadata

File hashes

Hashes for localtileserver-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7157926fbcce19c682be36f95015e72e3ac17f54a00c7a8b44df1cef06799b5f
MD5 14cdff44a7e3bb841ef6252319801451
BLAKE2b-256 63bd282b977eb3bbae938895c6918b91e652fb01e5a6378d425fc9e770338628

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page