4

I need to split a PBF file into multiple PBF files.

Is this possible with any tool using Python?

I looked at osmosis for example, but from what I understand from the documentation it is only possible to split the file based on bounding boxes/polygons. I would need to split it into relatively equal parts without knowing any underlying geography. The multiple files should all be valid.

The destination of the data should be other PBF files. The initial PBF can be any geographic area (mostly continents or world). The separate PBF files would then be processed in parallel on different machines. As such I am not really bothered about geographic boundaries and it would be nice not to worry about them. I just need to generate a bunch of valid PBF files. Valid should also means that there should be no information lost from the original file.

2
  • There could be a number of approaches to this depending on what output requirements you have. Can you edit your question to state the destination of the data (database, PBF, shapefile, etc) and the approximate geographic area chunks (e.g. continents, specific countries or smaller units). Apr 11, 2015 at 8:19
  • The destination of the data should be other PBF files - see edit.
    – Iulian
    Apr 11, 2015 at 19:38

2 Answers 2

3

According to this thread in OSM forum you can try (next to osmosis) further tools like osmconvert or OSM History splitter

The documentation about osmconvert tells that you can use bbopx data or polygon files (maybe as square polygons?) to get single files.

In case of doubt, tell us more about your special aim of splitting boundaries or number of output files.

0

GDAL OGR2OGR can also be used so you can convert to other formats or clip and filter with SQL. OGR will read the binary protocol buffer format .PBF and XML based .OSM. It's slow and not the best but does work. http://www.gdal.org/drv_osm.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.