This repo houses instructions and configuration files to aid with standing up an OpenStreetMap export into a PostGIS enabled database that uses tegola for creating and serving vector tiles.
- imposm3.json - an imposm3 mapping file for the OSM PBF file.
- tegola.toml - a tegola configuration file for the OSM import produced by imposm3.
- mapbox.json - a mapbox-gl style config used for client side rendering.
- Postgres server with PostGIS enabled.
- imposm3 (download - linux only)
- tegola (download)
- gdal - required for Natural Earth import
curl -O https://planet.openstreetmap.org/pbf/planet-latest.osm.pbf
./imposm3 import -connection postgis://username:password@host/database-name -mapping imposm3.json -read /path/to/osm/planet-latest.osm.pbf -write
./imposm3 import -connection postgis://username:password@host/database-name -mapping imposm3.json -deployproduction
Update the database credentials inside of natural_earth.sh
, then run: ./natural_earth.sh
. This will download the natural earth dataset and insert it into PostGIS under a database named natural_earth
. The script is idempotent.
Execute postgis_helpers.sql
against your OSM database.
psql -U tegola -d database-name -a -f postgis_helpers.sql
Execute postgis_index.sql
against your OSM database.
psql -U tegola -d database-name -a -f postgis_index.sql
./tegola -config=tegola.toml
imported | source | table/layer | zoom |
---|---|---|---|
ne_110m_rivers_lake_centerlines | 0-2 | ||
ne_110m_lakes | 0-2 | ||
y | ne_110m_admin0_boundary_lines_land | admin_lines | 0-2 |
ne_50m_rivers_lake_centerlines | 3-4 | ||
ne_50m_lakes | 3-4 | ||
y | ne_50m_admin_0_boundary_lines_land and ne_10m_admin_0_boundary_lines_land | country_lines | 3-6 |
y | ne_50m_admin_0_boundary_lines_disputed_areas and ne_10m_admin_0_boundary_lines_disputed_areas | country_lines_disputed | 3-6 |
ne_10m_rivers_lake_centerlines | 5-6 | ||
ne_10m_lakes | 5-6 | ||
ne_10m_geography_regions_points | 5-6 | ||
ne_10m_lakes_north_america | 5-6 | ||
ne_10m_admin_1_states_provinces | 5-6 | ||
ne_50m_admin1_states_provinces_lines and ne_10m_admin_1_states_provinces_lines | state_lines | 3-20 | |
ne_10m_roads | 5-6 | ||
ne_10m_roads_north_america | 5-6 | ||
ne_10m_parks_and_protected_lands | 5-6 | ||
y | osm | land | 0-20 |
y | ne_10m_admin_0_countries and osm admin boundaries | country_polygons | 3-20 |
y | ne_10m_admin_0_label_points | country_label_points | 3-20 |
y | ne_10m_admin_1_label_points | state_label_points | 5-20 |
y | osm | landuse_areas | 3-20 |
y | osm | water_lines | 8-20 |
y | osm | water_areas | 3-20 |
y | osm | transport_points | 14-20 |
y | osm | transport_lines | 4-20 |
y | osm | transport_areas | 12-20 |
y | osm | amenity_points | 14-20 |
y | osm | amenity_areas | 14-20 |
y | osm | other_points | 14-20 |
y | osm | other_lines | 14-20 |
y | osm | other_areas | 6-20 |
y | osm | buildings | 14-20 |