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
509 stars 107 forks source link

fileinfo: show PBF blob compression #205

Open simon04 opened 3 years ago

simon04 commented 3 years ago

Currently, osmium-tool reports no compression, not taking into account whether a PBF blob has been compressed using zlib or lzma:

$ osmium fileinfo austria-210101.osm.pbf
File:
  Name: austria-210101.osm.pbf
  Format: PBF
- Compression: none
+ Compression: zlib
  Size: 633228853
joto commented 3 years ago

That behaviour is correct. The compression reported is the outside compression on something like .osm.bz2. The man page says:

File  This  section  shows the information available without opening the file itself.  It contains the file name, the format deduced from the file name, the compression used and the size of the file in bytes.

The compression inside the PBF blobs is not reported. This is because different blocks could be compressed differently. (I don't expect any software to actually do that, but it is possible.)

simon04 commented 3 years ago

I see: the file section is not the correct section. The PBF compression could be included in the --extended output

...
Data:
  Bounding box: (8.8331793,46.2012502,18.994394,49.3061616)
  Timestamps:
    First: 2005-07-28T14:53:13Z
    Last: 2021-01-01T21:36:42Z
  ...
  All objects have following metadata attributes: version+timestamp
  Some objects have following metadata attributes: version+timestamp
+ All PBF data blocks use the compression: zlib
joto commented 3 years ago

While I agree that this could be useful, it would need quite a lot of changes to libosmium and osmium-tool. The information is only available deep in side the library and there is no easy way to get it to the application. So this is unlikely to get implemented soon. I'll leave the issue open for the time being.