mappymatch.maps.nx.readers.osm_readers#

Functions

compress(g)

a hacky way to delete unnecessary data on the networkx graph

nx_graph_from_osmnx(geofence, network_type)

Build a networkx graph from OSM data

parse_osmnx_graph(graph, network_type[, xy])

Parse the raw osmnx graph into a graph that we can use with our NxMap

Classes

NetworkType(value[, names, module, ...])

Enumerator for Network Types supported by osmnx.

class mappymatch.maps.nx.readers.osm_readers.NetworkType(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Enumerator for Network Types supported by osmnx.

ALL_PRIVATE = 'all_private'#
ALL = 'all'#
BIKE = 'bike'#
DRIVE = 'drive'#
DRIVE_SERVICE = 'drive_service'#
WALK = 'walk'#
mappymatch.maps.nx.readers.osm_readers.nx_graph_from_osmnx(geofence, network_type, xy=True, custom_filter=None)[source]#

Build a networkx graph from OSM data

Return type:

MultiDiGraph

Parameters:
Args:

geofence: the geofence to clip the graph to network_type: the network type to use for the graph xy: whether to use xy coordinates or lat/lon custom_filter: a custom filter to pass to osmnx

Returns:

a networkx graph of the OSM network

mappymatch.maps.nx.readers.osm_readers.parse_osmnx_graph(graph, network_type, xy=True)[source]#

Parse the raw osmnx graph into a graph that we can use with our NxMap

Return type:

MultiDiGraph

Parameters:
  • graph (MultiDiGraph)

  • network_type (NetworkType)

  • xy (bool)

Args:

geofence: the geofence to clip the graph to xy: whether to use xy coordinates or lat/lon network_type: the network type to use for the graph

Returns:

a cleaned networkx graph of the OSM network

mappymatch.maps.nx.readers.osm_readers.compress(g)[source]#

a hacky way to delete unnecessary data on the networkx graph

Return type:

MultiDiGraph

Parameters:

g (MultiDiGraph)

Args:

g: the networkx graph to compress

Returns:

the compressed networkx graph