Skip to content

Commit ecda815

Browse files
committed
adapt documentation of osm2pgsql-replication
1 parent dbac88f commit ecda815

File tree

2 files changed

+80
-24
lines changed

2 files changed

+80
-24
lines changed

docs/osm2pgsql-replication.1

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,34 +41,69 @@ usage: osm2pgsql-replication init [-h] [-q] [-v] [-d DB] [-U NAME] [-H HOST]
4141
[-P PORT] [-p PREFIX]
4242
[--middle-schema MIDDLE_SCHEMA]
4343
[--osm-file FILE | --server URL]
44+
[--start-at TIME]
4445

4546
Initialise the replication process.
4647
.br
4748

4849
.br
49-
There are two ways to initialise the replication process: if you have imported
50+
This function sets the replication service to use and determines from
5051
.br
51-
from a file that contains replication source information, then the
52+
which date to apply updates. You must call this function at least once
5253
.br
53-
initialisation process can use this and set up replication from there.
54+
to set up the replication process. It can safely be called again later
5455
.br
55-
Use the command \(cqosm2pgsql-replication \-\-osm\-file <filename>\(cq for this.
56+
to change the replication servers or to roll back the update process and
57+
.br
58+
reapply updates.
5659
.br
5760

5861
.br
59-
If the file has no replication information or you don't have the initial
62+
There are different methods available for initialisation. When no
63+
.br
64+
additional parameters are given, the data is initialised from the data
6065
.br
61-
import file anymore then replication can be set up according to
66+
in the database. If the data was imported from a file with replication
6267
.br
63-
the data found in the database. It checks the planet_osm_way table for the
68+
information and the properties table is available (for osm2pgsql >= 1.9)
6469
.br
65-
newest way in the database and then queries the OSM API when the way was
70+
then the replication from the file is used. Otherwise the minutely
6671
.br
67-
created. The date is used as the start date for replication. In this mode
72+
update service from openstreetmap.org is used as the default replication
6873
.br
69-
the minutely diffs from the OSM servers are used as a source. You can change
74+
service. The start date is either taken from the database timestamp
75+
.br
76+
(for osm2pgsql >= 1.9) or determined from the newest way in the database
77+
.br
78+
by querying the OSM API about its creation date.
7079
.br
71-
this with the \(cq\-\-server\(cq parameter.
80+
81+
.br
82+
The replication service can be changed with the \(cq\-\-server\(cq parameter.
83+
.br
84+
To use a different start date, add \(cq\-\-start\-at\(cq with an absolute
85+
.br
86+
ISO timestamp (e.g. 2007\-08\-20T12:21:53Z). When the program determines the
87+
.br
88+
start date from the database timestamp or way creation date, then it
89+
.br
90+
subtracts another 3 hours by default to ensure that all new changes are
91+
.br
92+
available. To change this rollback period, use \(cq\-\-start\-at\(cq with the
93+
.br
94+
number of minutes to rollback. This rollback mode can also be used to
95+
.br
96+
force initialisation to use the database date and ignore the date
97+
.br
98+
from the replication information in the file.
99+
.br
100+
101+
.br
102+
The initialisation process can also use replication information from
103+
.br
104+
an OSM file directly and ignore all other date information.
105+
.br
106+
Use the command \(cqosm2pgsql-replication \-\-osm\-file <filename>\(cq for this.
72107

73108

74109

@@ -110,7 +145,11 @@ Get replication information from the given file.
110145

111146
.TP
112147
\fB\-\-server\fR URL
113-
Use replication server at the given URL (default: https://planet.openstreetmap.org/replication/minute)
148+
Use replication server at the given URL
149+
150+
.TP
151+
\fB\-\-start\-at\fR TIME
152+
Time when to start replication. When an absolute timestamp (in ISO format) is given, it will be used. If a number is given, then replication starts the number of minutes before the known date of the database.
114153

115154
.SH OPTIONS 'osm2pgsql-replication update'
116155
usage: osm2pgsql-replication update update [options] [-- param [param ...]]

scripts/osm2pgsql-replication

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -405,18 +405,35 @@ def init(props, args):
405405
"""\
406406
Initialise the replication process.
407407
408-
There are two ways to initialise the replication process: if you have imported
409-
from a file that contains replication source information, then the
410-
initialisation process can use this and set up replication from there.
408+
This function sets the replication service to use and determines from
409+
which date to apply updates. You must call this function at least once
410+
to set up the replication process. It can safely be called again later
411+
to change the replication servers or to roll back the update process and
412+
reapply updates.
413+
414+
There are different methods available for initialisation. When no
415+
additional parameters are given, the data is initialised from the data
416+
in the database. If the data was imported from a file with replication
417+
information and the properties table is available (for osm2pgsql >= 1.9)
418+
then the replication from the file is used. Otherwise the minutely
419+
update service from openstreetmap.org is used as the default replication
420+
service. The start date is either taken from the database timestamp
421+
(for osm2pgsql >= 1.9) or determined from the newest way in the database
422+
by querying the OSM API about its creation date.
423+
424+
The replication service can be changed with the `--server` parameter.
425+
To use a different start date, add `--start-at` with an absolute
426+
ISO timestamp (e.g. 2007-08-20T12:21:53Z). When the program determines the
427+
start date from the database timestamp or way creation date, then it
428+
subtracts another 3 hours by default to ensure that all new changes are
429+
available. To change this rollback period, use `--start-at` with the
430+
number of minutes to rollback. This rollback mode can also be used to
431+
force initialisation to use the database date and ignore the date
432+
from the replication information in the file.
433+
434+
The initialisation process can also use replication information from
435+
an OSM file directly and ignore all other date information.
411436
Use the command `%(prog)s --osm-file <filename>` for this.
412-
413-
If the file has no replication information or you don't have the initial
414-
import file anymore then replication can be set up according to
415-
the data found in the database. It checks the planet_osm_way table for the
416-
newest way in the database and then queries the OSM API when the way was
417-
created. The date is used as the start date for replication. In this mode
418-
the minutely diffs from the OSM servers are used as a source. You can change
419-
this with the `--server` parameter.
420437
"""
421438
if args.osm_file is None:
422439
base_url, seq, date = props.get_replication_base(args.server, args.start_at)
@@ -614,7 +631,7 @@ def get_parser():
614631
srcgrp.add_argument('--osm-file', metavar='FILE',
615632
help='Get replication information from the given file.')
616633
srcgrp.add_argument('--server', metavar='URL',
617-
help='Use replication server at the given URL (default: %(default)s)')
634+
help='Use replication server at the given URL')
618635
grp.add_argument('--start-at', metavar='TIME', type=start_point,
619636
help='Time when to start replication. When an absolute timestamp '
620637
'(in ISO format) is given, it will be used. If a number '

0 commit comments

Comments
 (0)