pyrosm.OSM.get_graph#
- OSM.get_graph(network_type='walking', graph_type='igraph', direction='oneway', force_bidirectional=False, retain_all=False, osmnx_compatible=True, pandana_weights=['length'], simplify=True, simplify_kwargs=None, extra_attributes=None, custom_filter=None, filter_type=None, tags_to_keep=None, timestamp=None)#
Read the street network of
network_typeas a routable graph: the graph ofOSM.to_graph(*osm.get_network(network_type, nodes=True), graph_type).With the out-of-core engine the simplified graph is built straight from the ways and nodes read from the file: the tables of every street segment and of every node that
get_network(nodes=True)returns are not built, so the read takes less memory. Withsimplify=False, the in-memory engine or a history read, the tables are read withget_networkand exported withto_graph.The read and the export show one progress as the
progressof this object says: a bar “Building the graph of <file>” from 0 to 100 % with the current step in its label, orprogress(done, 100)calls.- Parameters:
network_type – As in
get_network(). Withtags_to_keep, the tags the graph is built from are read too: those of its edges’ directions (onewayandjunction, andoneway:bicyclefor cycling) and, withsimplify, theedge_attrs_differtags (by defaultmaxspeedandhighway), so the graph is the same and only carries fewer attributes.extra_attributes – As in
get_network(). Withtags_to_keep, the tags the graph is built from are read too: those of its edges’ directions (onewayandjunction, andoneway:bicyclefor cycling) and, withsimplify, theedge_attrs_differtags (by defaultmaxspeedandhighway), so the graph is the same and only carries fewer attributes.custom_filter – As in
get_network(). Withtags_to_keep, the tags the graph is built from are read too: those of its edges’ directions (onewayandjunction, andoneway:bicyclefor cycling) and, withsimplify, theedge_attrs_differtags (by defaultmaxspeedandhighway), so the graph is the same and only carries fewer attributes.filter_type – As in
get_network(). Withtags_to_keep, the tags the graph is built from are read too: those of its edges’ directions (onewayandjunction, andoneway:bicyclefor cycling) and, withsimplify, theedge_attrs_differtags (by defaultmaxspeedandhighway), so the graph is the same and only carries fewer attributes.tags_to_keep – As in
get_network(). Withtags_to_keep, the tags the graph is built from are read too: those of its edges’ directions (onewayandjunction, andoneway:bicyclefor cycling) and, withsimplify, theedge_attrs_differtags (by defaultmaxspeedandhighway), so the graph is the same and only carries fewer attributes.timestamp – As in
get_network(). Withtags_to_keep, the tags the graph is built from are read too: those of its edges’ directions (onewayandjunction, andoneway:bicyclefor cycling) and, withsimplify, theedge_attrs_differtags (by defaultmaxspeedandhighway), so the graph is the same and only carries fewer attributes.graph_type – As in
to_graph().direction – As in
to_graph().force_bidirectional – As in
to_graph().retain_all – As in
to_graph().osmnx_compatible – As in
to_graph().pandana_weights – As in
to_graph().simplify – As in
to_graph().simplify_kwargs – As in
to_graph().
- Returns:
igraph.Graph, networkx.MultiDiGraph, pandarm.Network or pandana.Network, or
None when the network is empty.