Code Monkey home page Code Monkey logo

minorroadtraffic's Introduction

MinorRoadTraffic

R package to predict traffic on minor roads

minorroadtraffic's People

Contributors

mem48 avatar juanfonsecals1 avatar robinlovelace avatar

Stargazers

Blaise Kelly avatar mark padgham avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

juanfonsecals1

minorroadtraffic's Issues

results from `road_centrality` for under|overpassess

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.
image

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.
image

An alternative approach I am testing is to produce a graph for all the minor roads, and calculate centrality of the resulting components.

function `osm_fill_ref` assigns wrong values

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.
image

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
            }
          }
        }
      }
    }
  }

image

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.

`extract_from_osm` returns the same OSM vector data

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.
image

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.