cartagen.eliminate_dead_ends#
- eliminate_dead_ends(roads, length=0, keep_longest=True)#
Eliminate dead-ends groups.
Eliminates roads section detected as dead-ends inside a road network if the length of their main component is below a given threshold.
- Parameters:
roads (
GeoDataFrameofLineString) – The road network with dead-ends properly characterized.length (
float, optional) – Length below which dead-ends are eliminated. If left to 0, shorter dead-ends are not eliminated.keep_longest (
bool, optional) – If set to True, in case of complex dead-end, keep only the main component (c.f. description). If False, eliminate the whole dead-end group. This concerns also dead-ends with a length above the provided threshold.
- Returns:
Warning
This function requires the detection of dead-ends beforehand.
See also
detect_dead_endsCharacterize dead-ends groups inside a road network.
Notes
The main component of a dead-end is defined as:
If the dead-end is simple (i.e. just one road), the main component is the road.
If the dead-end contains multiple ramification of roads, the main component represents the path between the entry and the longest ramification.
If the dead-end contains inner network faces (i.e. enclosed roads), the main component represents the longest of the shortest paths between the entry and all the vertex of the dead ends.