← 返回命令列表

Linux command

osm2pgsql 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

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]

说明

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.

参数

-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.

FAQ

What is the osm2pgsql command used for?

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.

How do I run a basic osm2pgsql example?

Run `osm2pgsql -d [database] [file.osm.pbf]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -d _database_ do in osm2pgsql?

Database name.