osm2pgsql
TLDR
Import OSM data
$ osm2pgsql -d [database] [file.osm.pbf]
Import with slim mode$ osm2pgsql -d [database] -s [file.osm.pbf]
Import with custom style$ osm2pgsql -d [database] -S [style.lua] [file.osm.pbf]
Append new data$ osm2pgsql -d [database] -a [updates.osc]
Set number of processes$ osm2pgsql -d [database] -j [4] [file.osm.pbf]
SYNOPSIS
osm2pgsql [options] file...
DESCRIPTION
osm2pgsql imports OpenStreetMap data into a PostgreSQL/PostGIS database. It's commonly used to create databases for rendering map tiles with Mapnik.
The tool can handle full planet imports and incremental updates.
PARAMETERS
-d database
Database name.-s, --slim
Store temp data in database.-S file
Style file.-a, --append
Append mode.-c, --create
Create tables (default).-j num
Number of processes.-C MB
Cache size.-H host
Database host.-U user
Database user.
TYPICAL WORKFLOW
$ # Create database
createdb gis
psql -d gis -c "CREATE EXTENSION postgis;"
# Import data
osm2pgsql -d gis -s -C 2000 planet.osm.pbf
createdb gis
psql -d gis -c "CREATE EXTENSION postgis;"
# Import data
osm2pgsql -d gis -s -C 2000 planet.osm.pbf
CAVEATS
Requires PostGIS. Planet imports need substantial resources. Use slim mode for updates.
HISTORY
osm2pgsql was developed for the OpenStreetMap project to enable map rendering from OSM data using PostgreSQL.
SEE ALSO
imposm(1), osmosis(1), postgresql(1), postgis(1)


