forked from osm2pgsql-dev/osm2pgsql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
osm2pgsql.1
421 lines (421 loc) · 11.9 KB
/
osm2pgsql.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
.TH "OSM2PGSQL" "1" "1.3.0" "" ""
.SH NAME
.PP
osm2pgsql \- Openstreetmap data to PostgreSQL converter
.SH SYNOPSIS
.PP
\f[B]osm2pgsql\f[] [\f[I]OPTIONS\f[]] OSM\-FILE
.SH DESCRIPTION
.PP
\f[B]osm2pgsql\f[] imports OpenStreetMap data into a PostgreSQL/PostGIS
database.
It is an essential part of many rendering toolchains, the Nominatim
geocoder and other applications processing OSM data.
.PP
OSM planet snapshots can be downloaded from
https://planet.openstreetmap.org/.
Data extracts for various countries or other areas are also available,
see https://wiki.openstreetmap.org/wiki/Planet.osm.
.PP
When operating in \[lq]slim\[rq] mode (and on a database created in
\[lq]slim\[rq] mode!), \f[B]osm2pgsql\f[] can also process OSM change
files (osc files), thereby bringing an existing database up to date.
.PP
See the manual (https://osm2pgsql.org/doc/manual.html) for more
information.
.SH OPTIONS
.PP
This program follows the usual GNU command line syntax, with long
options starting with two dashes (\f[C]\-\-\f[]).
.PP
Mandatory arguments to long options are mandatory for short options too.
.SH MAIN OPTIONS
.TP
.B \-a, \-\-append
Run in append mode.
Adds the OSM change file into the database without removing existing
data.
.RS
.RE
.TP
.B \-c, \-\-create
Run in create mode.
This is the default if \f[B]\-a, \-\-append\f[] is not specified.
Removes existing data from the database tables!
.RS
.RE
.SH HELP/VERSION OPTIONS
.TP
.B \-h, \-\-help
Print help.
Add \f[B]\-v, \-\-verbose\f[] to display more verbose help.
.RS
.RE
.TP
.B \-V, \-\-version
Print osm2pgsql version.
.RS
.RE
.SH DATABASE OPTIONS
.TP
.B \-d, \-\-database=NAME
The name of the PostgreSQL database to connect to.
If this parameter contains an \f[C]=\f[] sign or starts with a valid URI
prefix (\f[C]postgresql://\f[] or \f[C]postgres://\f[]), it is treated
as a conninfo string.
See the PostgreSQL manual for details.
.RS
.RE
.TP
.B \-U, \-\-username=NAME
Postgresql user name.
.RS
.RE
.TP
.B \-W, \-\-password
Force password prompt.
.RS
.RE
.TP
.B \-H, \-\-host=HOSTNAME
Database server hostname or unix domain socket location.
.RS
.RE
.TP
.B \-P, \-\-port=PORT
Database server port.
.RS
.RE
.SH INPUT OPTIONS
.TP
.B \-r, \-\-input\-reader=FORMAT
Select format of the input file.
Available choices are \f[B]auto\f[] (default) for autodetecting the
format, \f[B]xml\f[] for OSM XML format files, \f[B]o5m\f[] for o5m
formatted files and \f[B]pbf\f[] for OSM PBF binary format.
.RS
.RE
.TP
.B \-b, \-\-bbox=MINLON,MINLAT,MAXLON,MAXLAT
Apply a bounding box filter on the imported data.
Example: \f[B]\-\-bbox\f[] \f[B]\-0.5,51.25,0.5,51.75\f[]
.RS
.RE
.SH MIDDLE OPTIONS
.TP
.B \-i, \-\-tablespace\-index=TABLESPC
Store all indexes in a separate PostgreSQL tablespace named by this
parameter.
This allows one to e.g.\ store the indexes on faster storage like SSDs.
.RS
.RE
.TP
.B \-\-tablespace\-slim\-data=TABLESPC
Store the slim mode tables in the given tablespace.
.RS
.RE
.TP
.B \-\-tablespace\-slim\-index=TABLESPC
Store the indexes of the slim mode tables in the given tablespace.
.RS
.RE
.TP
.B \-p, \-\-prefix=PREFIX
Prefix for table names (default: \f[C]planet_osm\f[]).
.RS
.RE
.TP
.B \-s, \-\-slim
Store temporary data in the database.
Without this mode, all temporary data is stored in RAM and if you do not
have enough the import will not work successfully.
With slim mode, you should be able to import the data even on a system
with limited RAM, although if you do not have enough RAM to cache at
least all of the nodes, the time to import the data will likely be
greatly increased.
.RS
.RE
.TP
.B \-\-drop
Drop the slim mode tables from the database once the import is complete.
This can greatly reduce the size of the database, as the slim mode
tables typically are the same size, if not slightly bigger than the main
tables.
It does not, however, reduce the maximum spike of disk usage during
import.
It can furthermore increase the import speed, as no indexes need to be
created for the slim mode tables, which (depending on hardware) can
nearly halve import time.
Slim mode tables however have to be persistent if you want to be able to
update your database, as these tables are needed for diff processing.
.RS
.RE
.TP
.B \-C, \-\-cache=NUM
Only for slim mode: Use up to \f[B]NUM\f[] MB of RAM for caching nodes.
Giving osm2pgsql sufficient cache to store all imported nodes typically
greatly increases the speed of the import.
Each cached node requires 8 bytes of cache, plus about 10% \- 30%
overhead.
As a rule of thumb, give a bit more than the size of the import file in
PBF format.
If the RAM is not big enough, use about 75% of memory.
Make sure to leave enough RAM for PostgreSQL.
It needs at least the amount of \f[C]shared_buffers\f[] given in its
configuration.
Defaults to 800.
.RS
.RE
.TP
.B \-\-cache\-strategy=STRATEGY
There are a number of different modes in which osm2pgsql can organize
its node cache in RAM.
These are optimized for different assumptions of the data and the
hardware resources available.
Currently available strategies are \f[B]dense\f[], \f[B]chunked\f[],
\f[B]sparse\f[] and \f[B]optimized\f[].
\f[B]dense\f[] assumes that the node id numbers are densely packed,
i.e.\ only a few IDs in the range are missing / deleted.
For planet extracts this is usually not the case, making the cache very
inefficient and wasteful of RAM.
\f[B]sparse\f[] assumes node IDs in the data are not densely packed,
greatly increasing caching efficiency in these cases.
If node IDs are densely packed, like in the full planet, this strategy
has a higher overhead for indexing the cache.
\f[B]optimized\f[] uses both dense and sparse strategies for different
ranges of the ID space.
On a block by block basis it tries to determine if it is more effective
to store the block of IDs in sparse or dense mode.
This is the default and should be typically used.
.RS
.RE
.TP
.B \-x, \-\-extra\-attributes
Include attributes for each object in the database.
This includes the username, userid, timestamp and version.
Note: this option also requires additional entries in your style file.
.RS
.RE
.TP
.B \-\-flat\-nodes=FILENAME
The flat\-nodes mode is a separate method to store slim mode node
information on disk.
Instead of storing this information in the main PostgreSQL database,
this mode creates its own separate custom database to store the
information.
As this custom database has application level knowledge about the data
to store and is not general purpose, it can store the data much more
efficiently.
Storing the node information for the full planet requires more than
300GB in PostgreSQL, the same data is stored in \[lq]only\[rq] 50GB
using the flat\-nodes mode.
This can also increase the speed of applying diff files.
This option activates the flat\-nodes mode and specifies the location of
the database file.
It is a single large file.
This mode is only recommended for full planet imports as it doesn't work
well with small imports.
The default is disabled.
.RS
.RE
.TP
.B \-\-middle\-schema=SCHEMA
Use PostgreSQL schema SCHEMA for all tables, indexes, and functions in
the middle (default is no schema, i.e.\ the \f[C]public\f[] schema is
used).
.RS
.RE
.TP
.B \-\-middle\-way\-node\-index\-id\-shift=SHIFT
Set ID shift for way node bucket index in middle.
Experts only.
See documentation for details.
.RS
.RE
.SH OUTPUT OPTIONS
.TP
.B \-O, \-\-output=OUTPUT
Specifies the output back\-end to use.
Currently osm2pgsql supports \f[B]pgsql\f[], \f[B]flex\f[],
\f[B]gazetteer\f[] and \f[B]null\f[].
\f[B]pgsql\f[] is the default output back\-end and is optimized for
rendering with Mapnik.
\f[B]gazetteer\f[] is intended for geocoding with Nominatim.
The experimental \f[B]flex\f[] backend allows more flexible
configuration.
\f[B]null\f[] does not write any output and is only useful for testing
or with \f[B]\-\-slim\f[] for creating slim tables.
There is also a \f[B]multi\f[] backend.
This is now deprecated and will be removed in future versions of
osm2pgsql.
.RS
.RE
.TP
.B \-S, \-\-style=FILE
The style file.
This specifies how the data is imported into the database, its format
depends on the output.
(For the \f[B]pgsql\f[] output, the default is
\f[C]/usr/share/osm2pgsql/default.style\f[], for other outputs there is
no default.)
.RS
.RE
.SH PGSQL OUTPUT OPTIONS
.TP
.B \-i, \-\-tablespace\-index=TABLESPACENAME
Store all indexes in a separate PostgreSQL tablespace named by this
parameter.
This allows one to e.g.\ store the indexes on faster storage like SSDs.
.RS
.RE
.TP
.B \-\-tablespace\-main\-data=TABLESPACENAME
Store the data tables (non slim) in the given tablespace.
.RS
.RE
.TP
.B \-\-tablespace\-main\-index=TABLESPACENAME
Store the indexes of the main tables (non slim) in the given tablespace.
.RS
.RE
.TP
.B \-\-latlong
Store data in degrees of latitude & longitude.
.RS
.RE
.TP
.B \-m, \-\-merc
Store data in Spherical Mercator (Web Mercator, EPSG:3857) (the
default).
.RS
.RE
.TP
.B \-E, \-\-proj=SRID
Use projection EPSG:SRID.
.RS
.RE
.TP
.B \-p, \-\-prefix=PREFIX
Prefix for table names (default: \f[C]planet_osm\f[]).
This option affects the middle as well as the pgsql output table names.
.RS
.RE
.TP
.B \-\-tag\-transform\-script=SCRIPT
Specify a lua script to handle tag filtering and normalisation.
The script contains callback functions for nodes, ways and relations,
which each take a set of tags and returns a transformed, filtered set of
tags which are then written to the database.
.RS
.RE
.TP
.B \-x, \-\-extra\-attributes
Include attributes for each object in the database.
This includes the username, userid, timestamp and version.
Note: this option also requires additional entries in your style file.
.RS
.RE
.TP
.B \-k, \-\-hstore
Add tags without column to an additional hstore (key/value) column to
database tables.
.RS
.RE
.TP
.B \-j, \-\-hstore\-all
Add all tags to an additional hstore (key/value) column in database
tables.
.RS
.RE
.TP
.B \-z, \-\-hstore\-column=KEY_PREFIX
Add an additional hstore (key/value) column containing all tags that
start with the specified string, eg \-\-hstore\-column \[lq]name:\[rq]
will produce an extra hstore column that contains all \f[C]name:xx\f[]
tags.
.RS
.RE
.TP
.B \-\-hstore\-match\-only
Only keep objects that have a value in at least one of the non\-hstore
columns.
.RS
.RE
.TP
.B \-\-hstore\-add\-index
Create indexes for all hstore columns after import.
.RS
.RE
.TP
.B \-G, \-\-multi\-geometry
Normally osm2pgsql splits multi\-part geometries into separate database
rows per part.
A single OSM id can therefore have several rows.
With this option, osm2pgsql instead generates multi\-geometry features
in the PostgreSQL tables.
.RS
.RE
.TP
.B \-K, \-\-keep\-coastlines
Keep coastline data rather than filtering it out.
By default objects tagged \f[C]natural=coastline\f[] will be discarded
based on the assumption that Shapefiles generated by OSMCoastline
(https://osmdata.openstreetmap.de/) will be used for the coastline data.
.RS
.RE
.TP
.B \-\-reproject\-area
Compute area column using spherical mercator coordinates.
.RS
.RE
.TP
.B \-\-output\-pgsql\-schema=SCHEMA
Use PostgreSQL schema SCHEMA for all tables, indexes, and functions in
the pgsql and multi outputs (default is no schema, i.e.\ the
\f[C]public\f[] schema is used).
.RS
.RE
.SH EXPIRE OPTIONS
.TP
.B \-e, \-\-expire\-tiles=[MIN_ZOOM\-]MAX\-ZOOM
Create a tile expiry list.
.RS
.RE
.TP
.B \-o, \-\-expire\-output=FILENAME
Output file name for expired tiles list.
.RS
.RE
.TP
.B \-\-expire\-bbox\-size=SIZE
Max size for a polygon to expire the whole polygon, not just the
boundary.
.RS
.RE
.SH ADVANCED OPTIONS
.TP
.B \-I, \-\-disable\-parallel\-indexing
Disable parallel clustering and index building on all tables, build one
index after the other.
.RS
.RE
.TP
.B \-\-number\-processes=THREADS
Specifies the number of parallel threads used for certain operations.
.RS
.RE
.TP
.B \-\-with\-forward\-dependencies=BOOL
Propagate changes from nodes to ways and node/way members to relations
(Default: \f[C]true\f[]).
.RS
.RE
.SH SEE ALSO
.IP \[bu] 2
osm2pgsql website (https://osm2pgsql.org)
.IP \[bu] 2
osm2pgsql manual (https://osm2pgsql.org/doc/manual.html)
.IP \[bu] 2
\f[B]postgres\f[](1)
.IP \[bu] 2
\f[B]osmcoastline\f[](1)