NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I downloaded the latest pbf file(dated 27-Aug-2020 23:37) from a mirror and read its header using a python wrapper to osmium (v3.0.1)

import osmium

f = osmium.io.Reader("path/to/pbf_file.osm.pbf")
header = f.header()
seqnum = header.get("osmosis_replication_sequence_number", "")
timestamp = header.get("osmosis_replication_timestamp", "")
print(f'{seqnum!r},{timestamp!r}')
# output: '', '2020-08-23T23:59:50Z'

The sequence number was missing. Is this expected behaviour?

In the documentation, all the replication fields in OSMHeader seem to be set as optional. What pbf files are expected to have these values set?

asked 04 Sep '20, 09:37

M_T_'s gravatar image

M_T_
16113
accept rate: 0%

edited 04 Sep '20, 10:26


The sequence field in the headers are currently set only on extracts from Geofabrik. pyosmium-up-to-date also sets them when you update a PBF file.

There is a good reason that the sequence number is not set on the official planet file: there is no exact sequence number that corresponds to the state of a planet file. Planet files are created independently of the change files. So the content of the planet might correspond to something like sequence number "4164164 3/4".

When you want to use updates with a downloaded planet file, the usual way is to look at the creation time and find a change sequence number that is far enough in the past that you get all new changes that are not yet contained in the planet. You don't have to do the math yourself, pyosmium-get-changes, which is included in the python osmium package, can do that for you. Just run

pyosmium-get-changes -O planet-latest.osm.pbf

and it prints a single number. This is the recommended sequence number where you should start with the updates.

See the section on updating OSM data in the pyosmium manual for more information.

permanent link

answered 05 Sep '20, 20:25

lonvia's gravatar image

lonvia
6.2k25789
accept rate: 40%

AFAIU the sequence number you get from a call to pyosmium-get-changes is the minutely sequence number. How would you translate this to a daily or hourly sequence number? It seems that some minute updates have been skipped, so one can't do a simple multiplication to translate between the two

(07 Sep '20, 10:15) M_T_
1

You can't directly translate to hourly/daily sequence ID. You need to compute the appropriate ID in the same way as for the minutely replication. Use the parameter --server with pyosmium-get-changes to choose a different replication source. For example, to get the sequence ID for daily updates run pyosmium-get-changes --server https://planet.osm.org/replication/day/ -O planet-latest.osm.pbf.

(12 Sep '20, 15:35) lonvia

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×78
×60
×38
×2

question asked: 04 Sep '20, 09:37

question was seen: 1,830 times

last updated: 12 Sep '20, 15:35

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum