Mapping tile server for Datasette, serving tiles from MBTiles packages
Datasette plugin for serving MBTiles map tiles
Install this plugin in the same environment as Datasette.
$ datasette install datasette-tiles
You can try this plugin out at https://datasette-tiles-demo.datasette.io/-/tiles
This plugin scans all database files connected to Datasette to see if any of them are valid MBTiles databases.
It can then serve tiles from those databases at the following URL:
An example map for each database demonstrating the configured minimum and maximum zoom for that database can be found at
/-/tiles/db-name - this can also be accessed via the table and database action menus for that database.
/-/tiles for an index page of attached valid databases.
You can install the datasette-basemap plugin to get a
basemap default set of tiles, handling zoom levels 0 to 6 using OpenStreetMap.
datasette-tiles can be configured to serve tiles from multiple attached MBTiles files, searching each database in order for a tile and falling back to the next in line if that tile is not found.
For a demo of this in action, visit https://datasette-tiles-demo.datasette.io/-/tiles-stack and zoom in on Japan. It should start showing Stamen's Toner map of Japan once you get to zoom level 6 and 7.
/-/tiles-stack/1/1/1.png endpoint provides this feature.
If you start Datasette like this:
datasette world.mbtiles country.mbtiles city1.mbtiles city2.mbtiles
Any requests for a tile from the
/-/tiles-stack path will first check the
city2 database, than
If you have the datasette-basemap plugin installed it will be given special treatment: the
basemap database will always be the last database checked for a tile.
Rather than rely on the order in which databases were attached, you can instead configure an explicit order using the
tiles-stack-order plugin setting. Add the following to your
"tiles-stack-order": ["world", "country"]
You can then run Datasette like this:
datasette -m metadata.json country.mbtiles world.mbtiles
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
python3 -mvenv venv
Or if you are using
Now install the dependencies and tests:
pip install -e '.[test]'
To run the tests:
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Hashes for datasette_tiles-0.4-py3-none-any.whl