Using OSMnet

Creating a graph network from a OSM street network

Create a drive (e.g. automobile) or walk (e.g. pedestrian) graph network comprised of nodes and edges from OpenStreetMap (OSM) street network data via the OverpassAPI. Alternatively, custom highway way queries formatted for OverpassAPI can be written and passed to the custom_osm_filter parameter. Edges will be weighted by default by distance in units of meters. The resulting graph network is intended to be used with Pandana network accessibility queries and UrbanAccess to create an integrated transit and street graph network.

osmnet.load.network_from_bbox(lat_min=None, lng_min=None, lat_max=None, lng_max=None, bbox=None, network_type='walk', two_way=True, timeout=180, memory=None, max_query_area_size=2500000000, custom_osm_filter=None)

Make a graph network from a bounding lat/lon box composed of nodes and edges for use in Pandana street network accessibility calculations. You may either enter a lat/long box via the four lat_min, lng_min, lat_max, lng_max parameters or the bbox parameter as a tuple.

Parameters:
lat_minfloat

southern latitude of bounding box, if this parameter is used the bbox parameter should be None.

lng_minfloat

eastern longitude of bounding box, if this parameter is used the bbox parameter should be None.

lat_maxfloat

northern latitude of bounding box, if this parameter is used the bbox parameter should be None.

lng_maxfloat

western longitude of bounding box, if this parameter is used the bbox parameter should be None.

bboxtuple

Bounding box formatted as a 4 element tuple: (lng_max, lat_min, lng_min, lat_max) example: (-122.304611,37.798933,-122.263412,37.822802) a bbox can be extracted for an area using: the CSV format bbox from http://boundingbox.klokantech.com/. If this parameter is used the lat_min, lng_min, lat_max, lng_max parameters in this function should be None.

network_type{‘walk’, ‘drive’}, optional

Specify the network type where value of ‘walk’ includes roadways where pedestrians are allowed and pedestrian pathways and ‘drive’ includes driveable roadways. To use a custom definition see the custom_osm_filter parameter. Default is walk.

two_waybool, optional

Whether the routes are two-way. If True, node pairs will only occur once.

timeoutint, optional

the timeout interval for requests and to pass to Overpass API

memoryint, optional

server memory allocation size for the query, in bytes. If none, server will use its default allocation size

max_query_area_sizefloat, optional

max area for any part of the geometry, in the units the geometry is in: any polygon bigger will get divided up for multiple queries to Overpass API (default is 50,000 * 50,000 units (ie, 50km x 50km in area, if units are meters))

custom_osm_filterstring, optional

specify custom arguments for the way[“highway”] query to OSM. Must follow Overpass API schema. For example to request highway ways that are service roads use: ‘[“highway”=”service”]’

Returns:
nodesfinal, edgesfinalpandas.DataFrame