'How do you get all roads (including private and service roads) in osmnx?

I am using the follwing command in osmnx to downlaod roads from the OSM server:

osmnx.graph.graph_from_polygon(polygon, network_type='all_private', simplify=True, retain_all=False, truncate_by_edge=False, clean_periphery=True, custom_filter=None)

I was looking at the documentation for the network_type parameter and you can specify which subset of the road network you want to download using one of the following key terms:

'drive' - get drivable public streets (but not service roads)

'drive_service' - get drivable streets, including service roads

'walk' - get all streets and paths that pedestrians can use (this network type ignores one-way directionality)

'bike' - get all streets and paths that cyclists can use

'all' - download all non-private OSM streets and paths (this is the default network type unless you specify a different one)

'all_private' - download all OSM streets and paths, including private-access ones

I want to get all drivable roads, including both service AND private access roads but there is no option for that. Is there an easy way to do this? Or do I have to use the "all_private" value and then filter out the nodes/edges I don't want to include?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source