Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the most efficient way to open osm.pbf' with lowest memory consumption?

Here's what I did

from pyrosm import OSM
# Initialize the OSM parser object
osm = OSM('/DATA/user/nabih/indonesia-latest.osm.pbf')

# Read all drivable roads
drive_net = osm.get_network(network_type="driving")

But it is memory error

like image 718
Nabih Bawazir Avatar asked Sep 01 '25 11:09

Nabih Bawazir


1 Answers

https://osmcode.org/pyosmium/ provides a library to parse a osm.pbf. From what I remember, they keep the memory consumption to the minimum and provide different modes of parsing.

Checkout their documentation for basic usage tutorial and references.

The README of their GitHubprovides installation instructions.

like image 87
emely_pi Avatar answered Sep 02 '25 23:09

emely_pi