|  c6e0cdade2 | ||
|---|---|---|
| .. | ||
| imposm3 | ||
| postgis | ||
| README.md | ||
		
			
				
				README.md
			
		
		
			
			
		
	
	OSM Import into PostGIS
Infrastructure to create a docker based OSM Postgis database to create vector tiles from.
The database is separated from the import process. You can switch out the database container with a existing database.
Import
Run the PostGIS container
Mount the folder where the database data should be stored in and start the database container.
On first startup the container will automatically create a OSM database from the modified PostGIS template containing the additional hstore extension and the postgis-vt-util functions from Mapbox.
docker run --name postgis \
    -v /data/pgdata:/var/lib/postgresql/data \
    -e POSTGRES_USER=postgres \
    -e POSTGRES_PASSWORD=postgres \
    -e OSM_DB=osm \
    -e OSM_USER=osm \
    -e OSM_PASSWORD=osm \
    -d osm2vectortiles/postgis
Customize OSM database
You can configure the database settings via environment variables.
| Env | Default | Description | 
|---|---|---|
| OSM_DB | osm | Database name | 
| OSM_USER | osm | Database owner | 
| OSM_PASSWORD | osm | Database owner password | 
More configuration options are supported through the official Postgres Docker image and the mdillon/postgis image.
| Env | Default | Description | 
|---|---|---|
| POSTGRES_USER | osm | Database admin | 
| POSTGRES_PASSWORD | osm | Database admin password | 
| PGDATA | osm | Location of database files | 
Run the Imposm Import
Mount the import data directory containing the PBF files to import and the imposm cache directory to speed up multiple runs.
You also need to link our previously created postgis database container
as db.
The container will use a custom mapping.json to import the data into
the db database container.
docker run --rm --name imposm \
    -v /data/import:/data/import \
    -v /data/imposm-cache:/data/imposm \
    -t osm2vectortiles/imposm \
    --link postgis:db \
    osm2vectortiles/imposm3
This will take a long time depending on the data you want to import.