aequilibrae.utils package#
Submodules#
aequilibrae.utils.create_delaunay_network module#
- class aequilibrae.utils.create_delaunay_network.DelaunayAnalysis(project)[source]#
Bases:
object
- create_network(source='zones', overwrite=False)[source]#
Creates a delaunay network based on the existing model
- Arguments:
source (
str
, optional): Source of the centroids/zones. Eitherzones
ornetwork
. Defaultzones
overwrite path (
bool
, optional): Whether to should overwrite an existing Delaunay Network. DefaultFalse
- assign_matrix(matrix: AequilibraeMatrix, result_name: str)[source]#
aequilibrae.utils.create_example module#
- aequilibrae.utils.create_example.create_example(path: str, from_model='sioux_falls') Project [source]#
Copies an example model to a new project project and returns the project handle
- Arguments:
path (
str
): Path where to create a new model. must be a non-existing folder/directory. from_model (str
, Optional): Example to create from sioux_falls, nauru or coquimbo. Defaults to sioux_falls- Returns:
project (
Project
): Aequilibrae Project handle (open)
aequilibrae.utils.db_utils module#
- class aequilibrae.utils.db_utils.commit_and_close(db: str | Path | Connection, commit: bool = True, missing_ok: bool = False)[source]#
Bases:
object
A context manager for sqlite connections which closes and commits.
- aequilibrae.utils.db_utils.read_and_close(filepath)[source]#
A context manager for sqlite connections (alias for commit_and_close(db,commit=False)).
- class aequilibrae.utils.db_utils.ColumnDef(idx: int, name: str, type: str, not_null: bool, default: str, is_pk: bool)[source]#
Bases:
object
- idx: int#
- name: str#
- type: str#
- not_null: bool#
- default: str#
- is_pk: bool#
aequilibrae.utils.geo_index module#
- class aequilibrae.utils.geo_index.GeoIndex[source]#
Bases:
object
Implements a generic GeoIndex class that uses the QGIS index when using the GUI and RTree otherwise
- insert(feature_id: int, geometry: Point | Polygon | LineString | MultiPoint | MultiPolygon | MultiLineString) None [source]#
Inserts a valid shapely geometry in the index
- Arguments:
feature_id (
int
): ID of the geometry being inserted geo (Shapely.geometry
): Any valid shapely geometry
- nearest(geo: Point | Polygon | LineString | MultiPoint | MultiPolygon, num_results) List[int] [source]#
Finds nearest neighbor for a given geometry
- Arguments:
geo (
Shapely geometry
): Any valid shapely geometry num_results (int
): A positive integer for the number of neighbors to return- Return:
neighbors (
List[int]
): List of IDs of the closest neighbors in the index
aequilibrae.utils.geo_utils module#
Convenience functions for working with geospatial data.
aequilibrae.utils.get_table module#
aequilibrae.utils.list_tables_in_db module#
aequilibrae.utils.qgis_utils module#
aequilibrae.utils.spatialite_utils module#
- aequilibrae.utils.spatialite_utils.connect_spatialite(path_to_file: PathLike, missing_ok: bool = False) Connection [source]#
aequilibrae.utils.worker_thread module#
Original Author: UNKNOWN. COPIED FROM STACKOVERFLOW BUT CAN’T REMEMBER EXACTLY WHERE