I have downloaded the israël's osm.pbf file from geofabrik. I want to extract the road network's country, which means a list of edges between two nodes ids. For a such tiny country, this list should be quite small. However when I run the python code below, it took hours and hours to perform this little task.

from pyrosm.pyrosm import OSM
filename = "israel-and-palestine-latest.osm.pbf"
obj = OSM(filepath=filename)
nodes,edges = obj.get_network(network_type="driving",nodes=True)

Do you know any alternative to speed up the task? I do not need the geometry of each node, maybe it can help

1 Answer 1


You could use osmosis:

osmosis  --read-pbf israel-and-palestine-latest.osm.pbf  \
 --tf accept-ways highway=* --used-node  \
 --write-pbf israel-and-palestine-latest-highways.osm.pbf

The documentation is e.g. here

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.