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

if (!requireNamespace("CRiSpData", quietly = TRUE)) {
  message("Install CRiSpData from GitHub to run this example.")
} else {
  edges <- dplyr::bind_rows(CRiSpData::bucharest_osm$streets,
                            CRiSpData::bucharest_osm$railways)
  network <- sfnetworks::as_sfnetwork(edges, directed = FALSE)
  flatten_network(network)
}
#> # A sfnetwork with 9318 nodes and 9640 edges
#> #
#> # CRS:  EPSG:32635 
#> #
#> # An undirected multigraph with 942 components with spatially explicit edges
#> #
#> # Node data: 9,318 × 1 (active)
#>             geometry
#>          <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,312 more rows
#> #
#> # Edge data: 9,640 × 4
#>    from    to type                                                      geometry
#>   <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,637 more rows