aequilibrae.project.Network#

class aequilibrae.project.Network(project)[source]#

Network class. Member of an AequilibraE Project

__init__(project) None[source]#

Methods

__init__(project)

build_graphs([fields, modes, limit_to_area])

Builds graphs for all modes currently available in the model

convex_hull()

Queries the model for the convex hull of the entire network

count_centroids()

Returns the number of centroids in the model

count_links()

Returns the number of links in the model

count_nodes()

Returns the number of nodes in the model

create_from_gmns(link_file_path, node_file_path)

Creates AequilibraE model from links and nodes in GMNS format.

create_from_osm([model_area, place_name, ...])

Downloads the network from OpenStreetMap (OSM)

export_to_gmns(path)

Exports AequilibraE network to csv files in GMNS format.

extent()

Queries the extent of the network included in the model

list_modes()

Returns a list of all the modes in this model

set_time_field(time_field)

Set the time field for all graphs built in the model

skimmable_fields()

Returns a list of all fields that can be skimmed

Attributes

build_graphs(fields: list | None = None, modes: list | None = None, limit_to_area: Polygon | None = None) None[source]#

Builds graphs for all modes currently available in the model

When called, it overwrites all graphs previously created and stored in the networks’ dictionary of graphs

Arguments:

fields (list, Optional): When working with very large graphs with large number of fields in the database, it may be useful to specify which fields to use

modes (list, Optional): When working with very large graphs with large number of fields in the database, it may be useful to generate only those we need

limit_to_area (Polygon, Optional): When working with a very large model area, you may want to filter your database to a small area for your computation, which you can do by providing a polygon. The search is limited to a spatial index search, so it is very fast but NOT PRECISE.

To use the ‘fields’ parameter, a minimalistic option is the following

>>> project = create_example(project_path)

>>> fields = ['distance']
>>> project.network.build_graphs(fields, modes = ['c', 'w'])
convex_hull() Polygon[source]#

Queries the model for the convex hull of the entire network

Returns:

model coverage (Polygon): Shapely (Multi)polygon of the model network.

count_centroids() int[source]#

Returns the number of centroids in the model

Returns:

int: Number of centroids

Returns the number of links in the model

Returns:

int: Number of links

count_nodes() int[source]#

Returns the number of nodes in the model

Returns:

int: Number of nodes

create_from_gmns(link_file_path: str, node_file_path: str, use_group_path: str | None = None, geometry_path: str | None = None, srid: int = 4326) None[source]#

Creates AequilibraE model from links and nodes in GMNS format.

Arguments:

link_file_path (str): Path to a links csv file in GMNS format

node_file_path (str): Path to a nodes csv file in GMNS format

use_group_path (str, Optional): Path to a csv table containing groupings of uses. This helps AequilibraE know when a GMNS use is actually a group of other GMNS uses

geometry_path (str, Optional): Path to a csv file containing geometry information for a line object, if not specified in the link table

srid (int, Optional): Spatial Reference ID in which the GMNS geometries were created

create_from_osm(model_area: Polygon | None = None, place_name: str | None = None, modes=('car', 'transit', 'bicycle', 'walk'), clean=True) None[source]#

Downloads the network from OpenStreetMap (OSM)

Arguments:

area (Polygon, Optional): Polygon for which the network will be downloaded. If not provided, a place name would be required

place_name (str, Optional): If not downloading with East-West-North-South boundingbox, this is required

modes (tuple, Optional): List of all modes to be downloaded. Defaults to the modes in the parameter file

clean (bool, Optional): Keeps only the links that intersects the model area polygon. Defaults to True. Does not apply to networks downloaded with a place name

>>> project = Project()
>>> project.new(project_path)

# Now we can import the network for any place we want
>>> project.network.create_from_osm(place_name="my_beautiful_hometown") 

>>> project.close()
export_to_gmns(path: str)[source]#

Exports AequilibraE network to csv files in GMNS format.

Arguments:

path (str): Output folder path.

extent()[source]#

Queries the extent of the network included in the model

Returns:

model extent (Polygon): Shapely polygon with the bounding box of the model network.

list_modes()[source]#

Returns a list of all the modes in this model

Returns:

list: List of all modes

set_time_field(time_field: str) None[source]#

Set the time field for all graphs built in the model

Arguments:

time_field (str): Network field with travel time information

skimmable_fields()[source]#

Returns a list of all fields that can be skimmed

Returns:

list: List of all fields that can be skimmed

protected_fields = ['ogc_fid', 'geometry']#
req_node_flds = ['node_id', 'is_centroid']#
signal = <aequilibrae.utils.python_signal.PythonSignal object>#