2022-04-24 10:27:36 [INFO]: Initialised updates for service 'https://planet.openstreetmap.org/replication/minute'.
2022-04-24 10:27:36 [INFO]: Starting at sequence 5029284 (2022-04-24 07:04:37+00:00).
Where the “starting at sequence and date” seems to be “some variable time in the past”. What determines the starting sequence number and date, and how do I change it (without just editing the resulting values in the database after the “–init”).
The actual timestamp is calculated using the most recent way id found in your database (btw: is it expected that your database already contains some data?):
Did you import some fake/non-existing OSM data into your database? I think osm2pgsql-replication wasn’t designed to deal with such data. Maybe you can take a look at the compute_database_date function in osm2pgsql/osm2pgsql-replication at master · openstreetmap/osm2pgsql · GitHub and adjust it to your needs.
Alternative option would be to provide the replication state using the --osm-file command line parameter. Maybe take a look at the osm2pgsql-replication manual page for more details.
Yes - it was the way that I linked to above from the legend that’s loaded into the database after any OSM data.
Ideally you’d be able to specify where to apply updates from and when to when to apply updates from separately (just like you can with osmosis, which this presumably is designed to replace).
I’m looking at how best to change openstreetmap-replication currently …
Edit:
The problem is that there’s no try/catch (or python equivalent) around:
with urlrequest.urlopen(urlrequest.Request(url, headers=headers)) as response:
data = json.loads(response.read().decode('utf-8'))
so it never gets to:
if not data.get('elements') or not 'timestamp' in data['elements'][0]:
LOG.fatal("The way data downloaded from the API does not contain valid data.\n"
"URL used: %s", url)
return None
osm2pgsql-replication is meant as a simple tool for setting up updates in the very generic case that you import the planet/from extracts and want to keep them up to date without thinking about such things as time of update.
If you have special requirements, you should use pyosmium-get-changes. This is part of the pyosmium and meant to be the direct the replacement for osmosis (without the inconvenience of having to compute sequence IDs yourself).