R package to predict traffic on minor roads
itsleeds / minorroadtraffic Goto Github PK
View Code? Open in Web Editor NEWR package to predict traffic on minor roads
License: GNU Affero General Public License v3.0
R package to predict traffic on minor roads
License: GNU Affero General Public License v3.0
I have been exploring the results of the road_centrality
function and I found an issue when there are under or over passes. The first steps of the functions involve splitting the study area into sub-areas using the LINESTRINGS representing the major roads.
Then, sub-graphs are built within each section for producing a local betweenness centrality for the links within the polygon. However, there are some cases where two subnetworks of minor roads are connected through an underpass or overpass. Here, for example, is the network in Kirkliston (northwest of Edinburgh), which is not connected directly to the M9 nor the M90, but it is connected to the network of Scotstoun in the north.
An alternative approach I am testing is to produce a graph for all the minor roads, and calculate centrality of the resulting components.
The current version of the osm_fill_function
assigns the wrong values to some short links.
Here there is a small example from the network in Hull where the function assigns the ref A1033
to the links on the A1079
.
The problem seems to happen when the values in the highway
attribute are compared. In this particular case, the U-turn links have a different type than the main links of the A1079
, so the refs of the nearest links are skipped in this part of the function
for(k in 1:2){
for(i in 1:nrow(lines_major)){
if(is.na(lines_major$ref[i])){ #find the item whose ref equals to NA
for(j in 2:nearest_neighbour){ #starts from 2 because j=1 is the point itself
idx <- nn$nn.idx[i,j] # allocate the row number of the nearest centroid
if(lines_major$highway[idx] == lines_major$highway[i]){
if(!is.na(lines_major$ref[idx])){
lines_major$ref[i] <- lines_major$ref[idx]
break
}
}
}
}
}
}
As the nearest trunk
road is the A1033, it uses that ref to fill the missing value.
Nonetheless, it does not seem to affect the main links.
The current version of the function returns the same vector data that was extracted using osm_extract
. Later in the process, when traffic counts are assigned to the road links, some long links with multiple junctions are assigned the same flow value, or in some cases multiple counts are valid for sections of the same OSM link.
The following is an example in Hull, the link with osm_id = 83912501
covers a long section of Beverly Road and there are multiple counts.
An alternative solution would be producing a new network with dodgr_to_sf
after processing the OSM data within the extract_from_osm
function.
graph <- dodgr::weight_streetnet(network)
network <- dodgr::dodgr_to_sf(graph)
graph <- dodgr::dodgr_contract_graph(graph)
This would require an additional step when the counts are bi-directional as in the DfT dataset.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.