Free Maps For All
- geo go
TL;DR; simply run docker pull akhenakh/kvtiles:planet-9-latest
for a self hosted free performant world map (more maps and levels available see kvtiles docker tags).
I’ve blogged in the past to describe how to generate and serves your own map tiles server, but I wanted an easier solution.
KVTiles
kvtiles is a map tiles self hosted solution written in Go, it’s using Mapbox vector format but rather than using the regular sqlite3 database it’s using a key-value storage.
Key-value
The sqlite3 Go client is not native and require compiling using CGO.
By not using it we can use a lighter Docker image like distroless.
Also on this specific workload and environment, where we do reads only queries against the database, a key-value storage is more efficient.
kvtiles is using bbolt.
I’ve been testing several key-value engines for this type of workloads and you can see some results in another geo related project insideout.
Docker & Kubernetes
The main target of kvtiles is to be run in Docker/Kubernetes.
During the build, the maps are pregenerated then stored in a key value database.
The database is then embedded in a Docker image with the proper tags.
You can browse all the different regions and levels on docker hub via kvtiles docker tags
docker run --rm -it -p 8080:8080 akhenakh/kvtiles:us-9-latest
Then point your browser to http://yourdockerip:8080/static/
Having giant images is not a proper solution to scale, so chose the smallest map you need.
Since kvtiles is capable of serving thousands of requests per seconds you won’t need extra solutions but if you plan on very high traffic a reverse proxy cache and/or CDNs are recommended.
APIs & Maps
Tiles are available at /tiles/{z:[0-9]+}/{x:[0-9]+}/{y:[0-9]+}.pbf
, an optional key
URL param can be passed to secure access to your tiles server, (use the tilesKey
option).
Metrics are provided via Prometheus at http://host:httpMetricsPort/metrics
.
A debug visual map is available at http://host:httpAPIPort/static/
.
Health status is provided via gRPC host:healthPort
or via HTTP http://host:httpAPIPort/healthz
.
A http://host:httpAPIPort/version
is giving you running version but also information on the dataset.
kvtiles exposes vectors tiles, use MapBox js or Openlayers to build your own map and point to kvtiles file: /static/osm-liberty-gl.style
See the examples in the static folder
Free
I was thinking about creating a paid service to offer supports and maps updates but regarding the situation with Covid-19, having a free self hosted map could maybe help some organizations works in the field.