About size difference in osrm-extract results with osmium filtered and unfiltered .osm.pbf files

Hi all,

My spec : osmium version 1.16.0
Debian 12

I have a question regarding the size difference when processing OSM data with osrm-extract.

Here is the scenario:

I start with an OSM PBF file: bourgogne-latest.osm.pbf (size: ~182 MB).
Using osmium, I filter the file to keep only certain highways for a “foot” profile:

osmium tags-filter bourgogne-latest.osm.pbf w/highway=primary,primary_link,secondary,secondary_link,tertiary,tertiary_link,unclassified,residential,road,living_street,service,track,path,steps,pedestrian,footway,pier --remove-tags w/access=no,agricultural,forestry,private,delivery -o filtered-foot.osm.pbf

The resulting file filtered-foot.osm.pbf is significantly smaller (~35 MB), which makes sense.

ls -lsH

total 211724 car :

177784 -rw-r--r-- 1 root root 182047239 Jan 13 07:13 bourgogne-latest.osm.pbf
 33940 -rw-r--r-- 1 root root  34750516 Jan 13 09:46 filtered-foot.osm.pbf

I then run osrm-extract with the foot.lua profile, first on the original file (bourgogne-latest.osm.pbf) and then on the filtered file (filtered-foot.osm.pbf). After each operation, I calculate the total size of the .osrm files generated:

Using bourgogne-latest.osm.pbf

osrm-extract -p /usr/local/bin/profiles/foot.lua bourgogne-latest.osm.pbf

Total size of the resulting .osrm files: ~390 MB.

Using filtered-foot.osm.pbf

osrm-extract -p /usr/local/bin/profiles/foot.lua filtered-foot.osm.pbf

Total size of the resulting *.osrm* files: ~375 MB.

There is a ~15 MB size difference between the two outputs (390 MB vs 375 MB), even though the filtered file is specifically tailored for the foot.lua profile.

What could explain this size difference in the .osrm files generated from the original vs filtered .osm.pbf files?

Not sure if it still works, but I would try to run this script on both files:

1 Like