Skip to content

Function that returns junction points #357

@Robinlovelace

Description

@Robinlovelace

This will be very useful for road safety research using a variety of spatial network data sources, including OSM (which has a junction column, but which may not always be marked as such).

The beginnings of a solution are shown below. Note that the main problem with this solution is that it also returns start points of lines (cul de sac):

library(stplanr)
# roads_key = readRDS(url("https://github.com/ropensci/stats19/releases/download/1.1.0/roads_key.Rds"))
roads_key = stplanr::osm_net_example
junctions_maybe = line2points(roads_key)
length(unique(junctions_maybe$geometry))
#> [1] 110
mapview::mapview(junctions_maybe)

roads_key$value = 1
roads_key_rnet = overline2(roads_key, attrib = "value")
#> 2019-10-24 12:44:22 constructing segments
#> 2019-10-24 12:44:22 building geometry
#> 2019-10-24 12:44:22 simplifying geometry
#> 2019-10-24 12:44:22 aggregating flows
#> 2019-10-24 12:44:22 rejoining segments into linestrings
junctions_maybe2 = line2points(roads_key_rnet)
length(unique(junctions_maybe2$geometry))
#> [1] 104
mapview::mapview(junctions_maybe2)

Created on 2019-10-24 by the reprex package (v0.3.0)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions