Gazetteer is an open source pipeline for producing Mapbox vector tiles from OpenStreetMap with Postgis and Java.
It is inspired by Osmosis, but it comes with additional features, such as the ability to:
- Process data in parallel with the Stream API of Java
- Import data faster with the COPY API of Postgresql
- Create postgis geometries on the fly with JTS
- Create and serve customized Mapbox Vector Tiles
On the longer run, the aim of the project is to work with a variety of data sources in order to create highly specialized and customized maps.
- Docker 18
- Java 8
- Maven 3
Clone and build the repository:
git clone [email protected]:gazetteerio/gazetteer.git
cd gazetteer
mvn clean install
Unzip the binary distribution and add the /bin
folder to your PATH
variable:
unzip gazetteer-cli/target/gazetteer-cli-1.0-SNAPSHOT.zip
export PATH=$PATH:/path/to/gazetteer/bin
Calling the gazetteer
command should now result in an output similar to the following:
Usage: <main class> [COMMAND]
Commands:
osm
tiles
postgis
serve
The gazetteer
command comes with shorthands to manage a postgis docker container.
The following commands will pull the docker image, create and start the container:
gazetteer postgis pull
gazetteer postgis create
gazetteer postgis start
As a small country, Liechtenstein is suitable for testing and fits in this git repository. You can now import this data in that postgis container using the following command.
gazetteer osm import \
'data/liechtenstein.osm.pbf' \
'jdbc:postgresql://localhost:5432/gazetteer?allowMultiQueries=true&user=gazetteer&password=gazetteer'
To preview this data, you can simply run the embed web server with the following command:
gazetteer serve \
'config/config.yaml' \
'jdbc:postgresql://localhost:5432/gazetteer?allowMultiQueries=true&user=gazetteer&password=gazetteer'
Well done, the test server should have started and a map of liechtenstein should appear in your browser (http://localhost:8082/)!
Gazetteer is a work in progress and is not production ready, i.e., it comes with a lot of limitations. Additional work is needed to:
- Configure the map and its style at all zoom levels
- Improve the creation of geometries for OSM relations with JTS
- Apply OSM diffs on existing postgresql databases
- Optimize the SQL queries used to create Mapbox Vector Tiles
- Add additional datasets
- Stabilize and document the codebase
Being a side project, gazetteer does not have clear contribution guidelines yet. As the development work happens on github, feel free to report an issue, suggest a feature, or make a pull request. Generally speaking, as a contributor, you should:
- be nice, inclusive and constructive when interacting with others;
- agree with the terms of the Apache Software License;
- try to follow the Google Java Style Guide;
- try to be concise and relevant in commit messages;
- agree to rewrite portions of your code to make it fit better into the upstream sources.