quetzal.io.importer module
- quetzal.io.importer.from_lines(lines, node_index=0, add_return=True, to_keep=[])[source]
Import public transport lines to Quetzal format from geodataframe containing the pt lines (as one per row). Creates the dataframe links and nodes defined in the stepmodel class.
- Parameters
lines (geodataframe) – Name of DataFrame describing the alignements as LineSring in a geometry column.
node_index (int, optional, default 0) – number on which to start indexing nodes
add_return (bool, optional, default True) – if True, return lines are created. Use False if the two directions of the line are in the geodataframe.
to_keep (list, optional, default []) – columns of lines geodataframe to keep in links
- Returns
links – Links of the public transport system and pt routes caracteristics. Each line of the geodataframe correspond to a section of a PT route between two nodes
nodes – Public transport stations.
- quetzal.io.importer.from_lines_and_stations(lines, stations, buffer=0.001, og_geoms=True, **kwargs)[source]
Convert a set of alignement and station into a table of links.
- Parameters
lines (pd.DataFrame (or gpd.GeoDataFrame)) – DataFrame describing the alignements as LineSring in a geometry column.
stations (pd.DataFrame (or gpd.GeoDataFrame)) – DataFrame describing the stations as Point in a geometry column.
buffer (Float, optional) – Buffer for station detection near each alignement, by default 1e-3
og_geoms (bool, optional) – If True (by default), the original geometry will be split between stations. If False, returned geometry will be a simplified geometry (st1 -> st2)
- Returns
Table of links. As per,
from_lines()
output.- Return type
pd.DataFrame