vissim2gmns.func_lib.create_lane_geometries
- vissim2gmns.func_lib.create_lane_geometries(link_geometry: str | list | LineString, num_lanes: int, lane_width: float | list[float])[source]
Create lane centerline geometries from a link geometry.
- Parameters:
link_geometry – A Shapely LineString or an iterable of (x, y) coordinate pairs.
num_lanes (int) – Number of lanes to generate.
lane_width (float | list[float]) – Lane width in meters. A single value is applied to every lane. A list must have the same length as
num_lanesand is interpreted from rightmost lane to leftmost lane.
Notes
- The lane geometries are generated by offsetting the link geometry.
The leftmost index starts from 1, and the lane index increases from leftmost to rightmost lane (VISSIM Lane ordering).
Example
>>> from shapely.geometry import LineString >>> link_geom = LineString([(0, 0), (100, 0)]) >>> lane_geoms = create_lane_geometries(link_geom, num_lanes=3, lane_width=3.5) >>> for idx, lane_geom in lane_geoms.items(): ... print(f"Lane {idx}: {lane_geom}") ... Lane 1: LINESTRING (0 3.5, 100 3.5) ... Lane 2: LINESTRING (0 0, 100 0) ... Lane 3: LINESTRING (0 -3.5, 100 -3.5)
- Returns:
Lane geometries ordered from rightmost to leftmost relative to the link direction.
- Return type:
list[LineString]