aequilibrae.utils.geo_index#

Classes

GeoIndex()

Implements a generic GeoIndex class that uses the QGIS index when using the GUI and RTree otherwise

class aequilibrae.utils.geo_index.GeoIndex[source]#

Implements a generic GeoIndex class that uses the QGIS index when using the GUI and RTree otherwise

build_from_layer(layer) dict[source]#
delete(feature_id, geometry: Point | Polygon | LineString | MultiPoint | MultiPolygon)[source]#
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

Returns:

neighbors (List[int]): List of IDs of the closest neighbors in the index

reset()[source]#