Skip to content

dw-innovation/kid2-osm2pgsql-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

OSM2PGSQL Docker Image

This Docker image is designed to simplify the process of importing OpenStreetMap data into a PostgreSQL database using the osm2pgsql tool.

Quick Start

  1. Build the Docker image: docker build -t osm2pgsql .
  2. Run the image: docker run osm2pgsql This will use the default values provided in the Dockerfile. To customize the execution, you can override the default environment variables and/or CMD.

Environment Variables

  • PBF_PATH: The path to the OSM .pbf data file inside the container. Default: /data/data.osm.pbf
  • LUA_SCRIPT_PATH: The path to a Lua script for custom processing. Default: /data/filter.lua
  • PGHOST: The host of the PostgreSQL server. Default: host.docker.internal
  • PGUSER: PostgreSQL user. Default: postgres
  • PGPASSWORD: PostgreSQL password. Default: password
  • PGDATABASE: The name of the PostgreSQL database. Default: osm_db

Custom Execution

To use custom OSM data and Lua script, use the following command:

docker run -v $(pwd)/data:/data osm2pgsql -H host.docker.internal -U postgres -d osmberlin -O flex -S /data/filter.lua /data/berlin-latest.osm.pbf

Ensure that both berlin-latest.osm.pbf and filter.lua are located in the data directory in your current path.

Notes

  • Ensure the PostgreSQL server is accessible from the Docker container. The default host host.docker.internal assumes a local PostgreSQL server when using Docker for Desktop.
  • Ensure you have initialized the PostgreSQL database with the PostGIS extension to handle spatial data.
  • Set the network host correctly if you're on linux: docker run --network="host" -v $(pwd)/data:/data osm2pgsql -H localhost -U postgres -d osmberlin -O flex -S /data/filter.lua /data/berlin-latest.osm.pbf

About

A docker image for OSM data import using osm2pgsql

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published