openstreetmaposm.pbf

OpenStreetMap osm.pbf file, number of paths in federal states compared to the number of paths in a country


I would like to develop a small geocoder using OpenStreetMap. Now I downloaded the file germany-latest.osm.pbf and converted it with the tool pbf2json into a JSON stream. With this tool it is now possible to "pick" only JSON's with the planet type way. These contain the respective street, city, house number, postal code and the position, so everything I need for the geocoding.

But what I don't understand is that the file saarland-latest.osm.pbf which has the state Saarland (the smallest state in Germany) has about 658548 ways and the file germany-latest.osm.pbf has about 3792000 ways. Is there something wrong with the parser, or does "germany-latest.osm.pbf" only contain the "most important" roads in Germany, while the osm.pbf files of the different federal states contain all roads within the federal states?

So I have to download each state individually to get all streets of the whole country?


Solution

  • The .osm.pbf files from Geofabrik are complete extracts, you do not need the files for individual states in addition to the country extract.

    I can confirm your count of the number of ways in the Saarland file. However, I count 50566293 ways in "germany-latest.osm.pbf" when parsing it with a relatively low-level library (osm4j).

    So presumably, the issue is somewhere in your pipeline. Is it possible that the difference results from filtering based on the presence of certain tags, e.g. address information?