OpenStreetMap PBF Perfomance Tricks(paulkernfeld.com)
paulkernfeld.com
OpenStreetMap PBF Perfomance Tricks
https://paulkernfeld.com/2019/08/05/osm-pbf-performance-tricks.html
5 comments
Yeah, fair. I'm only working with Boston-area data so I can pretty easily load a Massachusetts OSM file from memory. However, memory would definitely be an issue for processing the entire world.
Are nodes in first fileblocks in "planet dumps"? And then fileblocks mostly with ways? With this dump configuration fileblocks are mostly useless.
Blocks are useful, because you can distribute the workload onto several workers. Most encoders nowadays write first blocks with just nodes, then blocks with just ways and then just relations.
My favorite OpenStreetMap data science tool is "osmium"
* https://osmcode.org/osmium-tool/manual.html
And you can convert osm.pbf to osm.opl - and can reprocess with unix tools (grep,awk,cut,tr,...):
* https://osmcode.org/opl-file-format/#usage-examples
* https://osmcode.org/osmium-tool/manual.html
And you can convert osm.pbf to osm.opl - and can reprocess with unix tools (grep,awk,cut,tr,...):
* https://osmcode.org/opl-file-format/#usage-examples
So unless you are doing meta-analysis of the raw OSM data, without assembling geometries, hand-rolling an OSMPBF reader is viable, otherwise I would suggest either using something pre-processed (extracts in real geodata formats), an established parser like osmium or rather import the data into e.g. postgres and do some querying there.