osmcode / osmium-tool

Command line tool for working with OpenStreetMap data based on the Osmium library.
https://osmcode.org/osmium-tool/
GNU General Public License v3.0
483 stars 104 forks source link

Can not parse timestamp #267

Closed alexanderzatko closed 10 months ago

alexanderzatko commented 1 year ago

What version of osmium-tool are you using?

osmium version 1.11.1 libosmium version 2.15.4

What operating system version are you using?

Ubuntu 20.04

Tell us something about your system

4GB RAM, 8 CPU cores, VPS

What did you do exactly?

I am attempting to merge a simple osm file - created by converting a gpx trace with gpsbabel - with a pbf file:

osmium merge ../slovakia.pbf conv.osm -o ./slovakiaapnd.pbf

What did you expect to happen?

I expected a file being created that combines the two input files

What did happen instead?

A stub of the slovakiaapnd.pbf file was created (~70 bytes) and an error message shown:

osmium merge ../slovakia.pbf conv.osm -o ./slovakiaapnd.pbf [======================================================================] 100% can not parse timestamp: '2023-04-29T11:06:22.029Z'

What did you do to try analyzing the problem?

Checked the input file and noticed that the application stops at the first node element where it encounters a timestamp - see a snippet below.

I also tried to run the cat command, but the same error message was shown. The resulting pbf file however is bigger than the original indicating the concatenation might actually have happened, regardless of the error message being shown

osmium cat ../slovakia.pbf conv.osm -o ./slovakiaapnd.pbf [======================================================================] 100% can not parse timestamp: '2023-04-29T11:06:22.029Z'

`<?xml version='1.0' encoding='UTF-8'?>

`
joto commented 1 year ago

"Real" OSM files never have sub-second resolution in the timestamps, so Osmium doesn't handle that. So the .029 in 2023-04-29T11:06:22.029Z is the problem for instance. Please open an issue with gpsbabel.

alexanderzatko commented 1 year ago

thank you, I will do that.

alexanderzatko commented 1 year ago

There was a comment in the mentioned gpsbabel issue. I guess due to the non-existence of an official OSM XML schema this issue might be left unresolved, but just knowing what causes it helps a lot. Thanks for the software and your continued care @joto.

tsteven4 commented 1 year ago

Thanks for the wiki update removing the offending example with subseconds.

joto commented 10 months ago

The newest releases of libosmium/osmium-tool now also support fractional seconds. Well, they just ignore them and cut off the fractional part.