Skip to content

MultiLineString in routed triangulation #201

Description

@marianamirandapessoa

In the case of Turin, there is one routed edge of the triangulation that is represented by a MultiLineString.


Steps to verify the existance of a MultiLineString:

  1. Add a checkpoint in the middle of growbikenet.growbikenet.growbiknet()
def growbikenet():

    (...)

    grown_bikenet_edges = create_gdf_with_geoms(grown_bikenet_edges_abstract, edges)
    progress_bar.update(1)

    grown_bikenet_edges_checkpoint = grown_bikenet_edges.copy()

    (...)

    return edges_ranked, grown_bikenet_edges_checkpoint
  1. Run growbikenet() for Turin
from growbikenet import growbikenet

edges_ranked, grown_bikenet_edges_checkpoint  = growbikenet(
    city_name = "Turin",
    export_data = False
)
  1. Check the geometry types of grown_bikenet_edges_checkpoint
>>> grown_bikenet_edges_checkpoint['geometry'].geom_type.value_counts()
LineString         319
MultiLineString      1
Name: count, dtype: int64

Supposedly, all routed edges of the triangulation should be represented by a LineString geometry, as pointed out in growbikenet.functions.create_gdf_with_geoms()

def create_gdf_with_geoms(df, edges):
    
    (...)

    # Merge multilinestring into linestring where possible (should be possible everywhere)
    gdf["geometry"] = gdf.line_merge()
    return gdf

For Turin, there seems to be an edge in the triangulation where the routed version has a loop, and therefore, the geometry is kept as a MultiLineString, with 3 LineStrings.

Image Image

This bug was found in the context of building the function growbikenet.functions.add_point_data_to_net()

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions