osm2pgsql
--append オプションと --create オプション
--append オプションと --create オプションがある。
-a | --append : Add the OSM file into the database without removing existing data.
-c | --create : Remove existing data from the database. This is the default if --append is not specified.
DB 作成後の最初のデータ投入では --create オプションを使わないと以下のエラーが出る。 (バージョン 0.96.0 で確認。)
code:error
$ osm2pgsql --host $POSTGRES_HOST --username $POSTGRES_MAP_USER -d $POSTGRES_MAP_DB \
--append --slim -G --hstore --tag-transform-script /openstreetmap-carto/openstreetmap-carto.lua \
-C 2500 --number-processes 4 -S /openstreetmap-carto/openstreetmap-carto.style \
/map_data/azerbaijan-latest.osm.pbf
Using lua based tag processing pipeline with script /openstreetmap-carto/openstreetmap-carto.lua
Using projection SRS 3857 (Spherical Mercator)
Setting up table: planet_osm_point
Osm2pgsql failed due to ERROR: SELECT * FROM planet_osm_point LIMIT 0 failed: ERROR: relation "planet_osm_point" does not exist
LINE 1: SELECT * FROM planet_osm_point LIMIT 0
オプション
--slim (-s) : 一時データを DB に保存する。 メモリ使用量が減るが時間がかかるようになる。 あとで --append を使って更新する場合は必須
--cache (-C) : node のキャッシュのために使用できる最大メモリ量 (MB)。 デフォルト値は 800
--number-processes : Specifies the number of parallel processes used for certain operations (default is 1).
--multi-geometry (-G) : Generate multi-geometry features in postgresql tables.
--flat-nodes : 全世界のインポート時にのみ推奨される