Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function that returns junction points #357

Open
Robinlovelace opened this issue Oct 24, 2019 · 1 comment
Open

Function that returns junction points #357

Robinlovelace opened this issue Oct 24, 2019 · 1 comment

Comments

@Robinlovelace
Copy link
Member

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)

@mpadge
Copy link
Member

mpadge commented Oct 24, 2019

That's a cool idea, and ... (my standard response by now) ... easy to do with dodgr. Just convert to a dodgr network, make frequency tables for from and to nodes, and select all those with frequencies >= 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants