Skip to contents

All crossing edges are identified, and the points of intersections are injected within the edge geometries. Note that the injected points are not converted to network nodes (this can be achieved via sfnetworks' sfnetworks::to_spatial_subdivision(), which is part of the tasks that are included in clean_network().

Usage

flatten_network(network)

Arguments

network

A network object

Value

A network object with additional points at intersections

Details

The functionality is similar to sfnetworks' sfnetworks::st_network_blend(), but in that case an external point is only injected to the closest edge.

Examples

bucharest_osm <- get_osm_example_data()
edges <- dplyr::bind_rows(bucharest_osm$streets,
                          bucharest_osm$railways)
network <- sfnetworks::as_sfnetwork(edges, directed = FALSE)
flatten_network(network)
#> # A sfnetwork with 9350 nodes and 9684 edges
#> #
#> # CRS:  WGS 84 / UTM zone 35N 
#> #
#> # An undirected multigraph with 937 components with spatially explicit edges
#> #
#> # Node data: 9,350 × 1 (active)
#>                 geom
#>          <POINT [m]>
#> 1 (427899.3 4924401)
#> 2 (428081.7 4924019)
#> 3 (427853.8 4924451)
#> 4 (427667.9 4924312)
#> 5 (427348.7 4924016)
#> 6 (427390.9 4923984)
#> # ℹ 9,344 more rows
#> #
#> # Edge data: 9,684 × 4
#>    from    to type                                                          geom
#>   <int> <int> <chr>                                             <LINESTRING [m]>
#> 1     1     2 tertiary (427899.3 4924401, 427901.6 4924397, 427911.8 4924379, 4…
#> 2     3     4 tertiary (427853.8 4924451, 427842.3 4924442, 427797.7 4924408, 4…
#> 3     5     6 primary  (427348.7 4924016, 427360 4924008, 427382.4 4923991, 427…
#> # ℹ 9,681 more rows