aequilibrae.project.Network#
- class aequilibrae.project.Network(project)[source]#
Network class. Member of an AequilibraE Project
Methods
__init__
(project)build_graphs
([fields, modes])Builds graphs for all modes currently available in the model
Queries the model for the convex hull of the entire network
Returns the number of centroids in the model
Returns the number of links in the model
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 Open-Street Maps
export_to_gmns
(path)Exports AequilibraE network to csv files in GMNS format.
extent
()Queries the extent of the network included in the model
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
Returns a list of all fields that can be skimmed
Attributes
- netsignal = <aequilibrae.utils.python_signal.PythonSignal object>#
- req_link_flds = ['link_id', 'a_node', 'b_node', 'direction', 'distance', 'modes', 'link_type']#
- req_node_flds = ['node_id', 'is_centroid']#
- protected_fields = ['ogc_fid', 'geometry']#
- skimmable_fields()[source]#
Returns a list of all fields that can be skimmed
- Returns:
list
: List of all fields that can be skimmed
- list_modes()[source]#
Returns a list of all the modes in this model
- Returns:
list
: List of all modes
- 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 Open-Street Maps
- Arguments:
area (
Polygon
, Optional): Polygon for which the network will be downloaded. If not provided, a place name would be requiredplace_name (
str
, Optional): If not downloading with East-West-North-South boundingbox, this is requiredmodes (
tuple
, Optional): List of all modes to be downloaded. Defaults to the modes in the parameter fileclean (
bool
, Optional): Keeps only the links that intersects the model area polygon. Defaults toTrue
. Does not apply to networks downloaded with a place name
>>> from aequilibrae import Project >>> p = Project() >>> p.new("/tmp/new_project") # We now choose a different overpass endpoint (say a deployment in your local network) >>> par = Parameters() >>> par.parameters['osm']['overpass_endpoint'] = "http://192.168.1.234:5678/api" # Because we have our own server, we can set a bigger area for download (in M2) >>> par.parameters['osm']['max_query_area_size'] = 10000000000 # And have no pause between successive queries >>> par.parameters['osm']['sleeptime'] = 0 # Save the parameters to disk >>> par.write_back() # Now we can import the network for any place we want # p.network.create_from_osm(place_name="my_beautiful_hometown") >>> p.close()
- 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 formatnode_file_path (
str
): Path to a nodes csv file in GMNS formatuse_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 usesgeometry_path (
str
, Optional): Path to a csv file containing geometry information for a line object, if not specified in the link tablesrid (
int
, Optional): Spatial Reference ID in which the GMNS geometries were created
- export_to_gmns(path: str)[source]#
Exports AequilibraE network to csv files in GMNS format.
- Arguments:
path (
str
): Output folder path.
- build_graphs(fields: list | None = None, modes: list | 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 usemodes (
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
To use the fields parameter, a minimalistic option is the following
>>> from aequilibrae import Project >>> p = Project.from_path("/tmp/test_project") >>> fields = ['distance'] >>> p.network.build_graphs(fields, modes = ['c', 'w'])
- 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
- count_centroids() int [source]#
Returns the number of centroids in the model
- Returns:
int
: Number of centroids