Skip to content

A fast golang exporter for tilesets created with Apache Baremaps

License

Notifications You must be signed in to change notification settings

flightaware/baremaps-exporter

Repository files navigation

baremaps-exporter

baremaps-exporter is a golang drop-in replacement for the baremaps export command from Apache Baremaps (incubator). This exporter can be up to 10-15x faster at exporting large tilesets.

Written in golang, baremaps-exporter exports vector tiles from a PostGIS database. It can export either as .mvt mapbox vector tile files or as .mbtiles archives.

As input, the exporter requires a tiles.json file generated by Apache Baremaps. These tiles.json files include the queries for each tile layer and zoom level, which baremaps-exporter uses to generate the tiles.

The tiles.json file can be extracted from baremaps when the server is running in dev mode. It is typically at http://localhost:9000/tiles.json.

baremaps-exporter requires a database source name (DSN) connection string. This is typically of the format postgresql://localhost:5432/baremaps?&user=baremaps&password=baremaps, or wherever your database is hosted.

The exporter will automatically detect if the output location ends in .mbtiles and switch to mbtiles output format.

Install

Go must be installed, version 1.20 or later.

Then:

go install github.com/flightaware/baremaps-exporter/cmd/baremaps-exporter

Now you're ready to go.

Usage

Run the application with:

go run github.com/flightaware/baremaps-exporter/cmd/baremaps-exporter --help

All of the options:

export baremaps-compatible tilesets from a postgis server
Usage: baremaps-exporter [--output OUTPUT] [--mbtiles] [--dsn DSN] [--workers WORKERS] [--tileversion TILEVERSION] [--zoom ZOOM] [--file FILE] TILEJSON

Positional arguments:
  TILEJSON               input tilejson file

Options:
  --output OUTPUT, -o OUTPUT
                         output file or directory
  --mbtiles              output mbtiles instead of files (automatically selected if output filename ends in '.mbtiles')
  --dsn DSN, -d DSN      database connection string (dsn) for postgis
  --workers WORKERS, -w WORKERS
                         number of workers to spawn [default: 48]
  --tileversion TILEVERSION
                         version of the tileset (string) written to mbtiles metadata
  --zoom ZOOM            comma-delimited set specific zooms to export (eg: 2,4,6,8)
  --file FILE, -f FILE   a list of tiles to also generate, from a file where each line is a z/x/y tile coordinate
  --help, -h             display this help and exit

Typical usage:

go run github.com/flightaware/baremaps-exporter/cmd/baremaps-exporter -o ./tiles/ -d 'postgres://baremaps:baremaps@localhost:5432/baremaps' tiles.json

LICENSE

This work is licensed by FlightAware under the BSD 3-Clause License.

About

A fast golang exporter for tilesets created with Apache Baremaps

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages