This project provides a PowerShell script to import OpenStreetMap (OSM) PBF files into a PostGIS-enabled PostgreSQL database.
- Imports OSM .pbf files into a PostGIS database
- Generic and configurable for different OSM extracts and database setups
- Automates the import process using command-line tools
- Windows PowerShell
- PostgreSQL with PostGIS extension
osm2pgsqlinstalled and available in your PATH- OSM .pbf file(s) to import
-
Edit the script:
- Open
import_osm_generic.ps1in a text editor. - Set the database connection parameters and file paths as needed.
- Open
-
Run the script:
- Open PowerShell in the script directory.
- Execute:
.\import_osm_generic.ps1
-
Follow prompts:
- The script may prompt for additional information or confirmation.
- Update variables in the script for your database host, port, user, password, database name, and the path to your OSM .pbf file.
- Ensure
osm2pgsqlis installed and accessible from the command line.
# Example usage in PowerShell
.\import_osm_generic.ps1- Make sure your PostgreSQL server is running and accessible.
- The script may overwrite existing tables in the database.
- For large OSM files, ensure you have enough disk space and memory.
MIT License