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

Viewed 223

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

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.

Related