iduedu.unique_segments¶
- iduedu.unique_segments(urban_graph, *, precision=0.01)[source]¶
Return the straight segments the edge geometries are made of, each physical segment once.
Every pair of consecutive coordinates of an edge geometry is one segment. Segments are compared without direction and after rounding their end points to
precision, so the two directions of a two-way street, parallel edges drawn over the same points, and stretches that a there-and-back pair of edges shares only in part are all counted once. Separately mapped carriageways, which have their own points, stay separate. The sum oflengthis the length of the network on the ground.- Parameters:
urban_graph (
UrbanGraph) – Graph with line geometries in a projected (metric) CRS.precision (
float) – Grid, in CRS units, that end points are rounded to before comparing segments.
- Return type:
- Returns:
GeoDataFrame in the graph CRS with one two-point LineString per unique segment and columns
length,edge(label of the first edge inedges_gdfthat contains the segment) andedge_count(how many edge pieces share it). Zero-length segments are left out.- Raises:
ValueError – If
precisionis not positive or the graph CRS is geographic.