Network
ultimodel.CreateNetwork.Edges(country, taz, taz_cn='country', taz_geo='geometry')
Create network edges from OSM
| Parameters: |
|
|---|
get_polygon(taz_id, proj_crs=3035, buffer=2500)
Define polygon(s) for network extraction; split islands and exclaves and apply buffer to include all streets near the border
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_edges(filter_highway, polygons)
Get network for selected highway types from OSM for specified country
| Parameters: |
|
|---|
set_attributes(taz_id, start_id=0)
Overlay self.edges with TAZ layer to split links at borders and assign TAZ-ID Set length, travel time, highway type and ID of self.edges GeoDataFrame
| Parameters: |
|
|---|
| Returns: |
|
|---|
set_nodes(nodes, order_col, nodeid_col='node_id', linkid_col='ultimo_id')
Set start and end node for each edge in self.edges based on node GDF
| Parameters: |
|
|---|
| Returns: |
|
|---|
connect_subgraphs(nodes, edges=None, node_id='node_id', node_geo='geometry', edge_id='ultimo_id', edge_from='from_node', edge_to='to_node')
Ensure that the road network is connected, i.e. each node is connected to each other. If there are multiple subgraphs, connect the larger subgraphs and remove singular edges.
| Parameters: |
|
|---|
| Returns: |
|
|---|
ultimodel.CreateNetwork.Nodes(edges)
Create nodes at the ends of edges
| Parameters: |
|
|---|
init_nodes()
init node GeoDataFrame
create_nodes(id_col, geom_col='geometry')
Create nodes at the ends of each LineString in edges !! only works with LineStrings, not with MultiLineString !! use gpd.GeoDataFrame.explode() to transform MultiLineString to LineString
| Parameters: |
|
|---|
remove_duplicates()
Remove duplicate nodes (i.e. at the same coordinates)
--> result: GeoDataFrame self.nodes.unique without duplicates
| Returns: |
|
|---|
set_node_id(id_col='node_id', start=0)
Set ID per unique node and assign this ID to all nodes
--> result: GeoDataFrame of self.nodes, self.nodes_unique with ID column
| Parameters: |
|
|---|
| Returns: |
|
|---|
ultimodel.CreateNetwork.Connectors()
Connect the TAZ to the road network: find possible connector locations and identify corresponding nodes
find_connector_locations(taz, pop, taz_id='nuts_id', taz_geom='geom', epsg_pop=4326)
Identify suitable connector locations per TAZ depending on population density
--> result is self.connectors as GeoDataFrame with connector locations; Point layer
| Parameters: |
|
|---|
| Returns: |
|
|---|
identify_connector_nodes(nodes, node_no='node_id', node_geom='geometry', zone='nuts_id', weight='weight', country_check=False)
Move connector locations to network nodes
| Parameters: |
|
|---|
| Returns: |
|
|---|
ultimodel.CreateNetwork.Ferries(taz, scope=None, taz_cn='cntr_code', taz_geo='geometry')
Create connections over water between islands and main land, using ferry routes and bridges as reference
| Parameters: |
|
|---|
find_ferry_routes(buffer_water=0.05)
Extract ferry routes from OSM for water body around region (defined by scope in init)
--> result: self.ferry and self.nodes include ferry routes and their end nodes
| Parameters: |
|
|---|
| Returns: |
|
|---|
ferry_national(region_id='id', ferry_buffer=0.01)
Create GeoDataFrames of ferry routes and nodes with a country; filter other relations out of self.ferry and self.nodes
| Parameters: |
|
|---|
| Returns: |
|
|---|
ferry_international(ferry_buffer=0.01)
Create GeoDataFrame of ferry routes and nodes between different countries, filter national relations out of self.ferry and self.nodes
| Parameters: |
|
|---|
| Returns: |
|
|---|
ferry_to_road(ferry_routes, ferry_nodes, network_roads, network_nodes, ferry_buffer_m=2500, speed_ferry=30, roads_id='ultimo_id', roads_fr='from_node', roads_to='to_node', node_id='node_id')
Connect ferry end nodes to road network and add as links (direct lines)
| Parameters: |
|
|---|
| Returns: |
|
|---|
ultimodel.CreateNetwork.CombineNetworks(taz, roads, taz_cn='cntr_code')
Merge road networks of multiple countries / regions to create a routable international network
| Parameters: |
|
|---|
find_borders(buffer=2500, taz_geo='geometry')
Create polygons with a defined buffer around the borders
--> result: self.border contains border polygons
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_border_roads(roads_cn='cn')
Find all roads within the border buffer
--> result: self.border_roads as GDF with all roads within border buffer
| Parameters: |
|
|---|
| Returns: |
|
|---|
connect_border_roads(nodes_int, id_st=900000000, roads_cn='cn', roads_type='type', filter_types=None, roads_id='ultimo_id', roads_fr='from_node', roads_to='to_node', node_id='node_id', node_geo='geometry')
Create new directed lines between the nearest end nodes of each country at the border
--> result: self.network_int as GDF with connected network, --> result: self.dict_borders as dictionary with number of connected roads
| Parameters: |
|
|---|
| Returns: |
|
|---|
ultimodel.CreateNetwork.ckdnearest(gdA, gdB, bcolA, bcolB, n)
Find n number of nearest nodes from gdA to gdB and calculate their distance
| Parameters: |
|
|---|
| Returns: |
|
|---|
ultimodel.CreateNetwork.graph_from_gdf(nodes, edges, node_id='node_id', node_geo='geometry', edge_id='edge_id', edge_from='from_node', edge_to='to_node')
Create a MultiDiGraph from nodes and edges in the GeoDataFrame format
| Parameters: |
|
|---|
| Returns: |
|
|---|
ultimodel.CreateNetwork.subordinate_road_length(taz_sub, sub_type='secondary')
Calculate the subordinate network length per TAZ for a selected category
| Parameters: |
|
|---|
| Returns: |
|
|---|