Datasette and raster Tiles

Using simple png based tiles seems like the best choice for my planned pet project. But all the vector tiles to raster tiles posts and Github repositories are either years old or commercial. After fiddling around with some of the code out there I gave up and started using stadiamaps rastered tiles.

But now I wanted to use them in Datasette. First as a preview in the table view by using datasette-leaflet-geojson. To get a preview map in the table view the dataset needs to have a field that looks like geojson.

Generate a dataset using sqlite-utils with a valid geojson field:

echo '{"name": "Vaihingen / Hauptstrasse", "map": {"type": "Point", "coordinates": [9.1116853, 48.7297610]}}' | \
sqlite-utils insert demo.db cycle-rental -

Opened in Datasette table view this looks like:

osm

I changed the tile server to stadiamaps because I don't want to use Openstreetmap tiles without a license later.

The same dataset with stadiamaps:

stadiamaps

If the 200k credits are not enough later I will think about a different solution.