ATFutures / geoplumber

Serve geographic data from R and consume with scalable front end.
https://atfutures.github.io/geoplumber/
59 stars 7 forks source link

Add traffic_casualties, traffic_volumes data for #45 #50

Closed Robinlovelace closed 5 years ago

Robinlovelace commented 5 years ago

I also updated the traffic dataset so it actually contains traffic data. Just a simple road network to add. @mpadge as the creator of the awesome osmdata are you up for giving that a shot? Suggest the name traffic_network for consistency (all these Southwark datasets now start with traffic).

Reprex illustrating the new datasets:

devtools::install_github("ATFutures/geoplumber", ref = "update-data")
#> Using GitHub PAT from envvar GITHUB_PAT
#> Skipping install of 'geoplumber' from a github remote, the SHA1 (9ca704c8) has not changed since last install.
#>   Use `force = TRUE` to force installation
library(geoplumber)
head(traffic)
#>         cp            road la_name                 rcat easting northing
#> 1   20MPH1 Kennington Road     LBS LBS 20MPH monitoring  531209   179142
#> 2  20MPH10     Brook Drive     LBS LBS 20MPH monitoring  531493   178946
#> 3 20MPH101   Sydenham Hill     LBS LBS 20MPH monitoring  533952   171621
#> 4 20MPH102   WESTWOOD HILL     LBS LBS 20MPH monitoring  533981   171429
#> 5 20MPH105     Ossory Road     LBS LBS 20MPH monitoring  534052   177980
#> 6 20MPH107      Barry Road     LBS LBS 20MPH monitoring  534142   174396
#>        total cycle_or_motorcycle av_speed year           geometry
#> 1 19991.0000          1599.85714   19.950 2015 -0.11124, 51.49595
#> 2  3445.0000           561.42857   15.100 2015 -0.10723, 51.49412
#> 3 14801.8571           269.42857   25.400 2015 -0.07460, 51.42772
#> 4 34337.1429           655.71429   18.950 2015 -0.07426, 51.42598
#> 5   676.2857            55.85714   14.300 2015 -0.07075, 51.48484
#> 6 16431.4286           515.00000   26.525 2014 -0.07082, 51.45261
head(traffic_volumes)
#>         ID            ROAD  EASTING NORTHING ORIGINAL_REF DIRECTION MONTH
#> 1   20MPH1 Kennington Road 531209.6 179142.9       ATC087         N   NOV
#> 2   20MPH1 Kennington Road 531209.6 179142.9       ATC087         S   NOV
#> 3  20MPH10     Brook Drive 531493.1 178946.9       ATC016         N   NOV
#> 4  20MPH10     Brook Drive 531493.1 178946.9       ATC016         S   NOV
#> 5 20MPH101   Sydenham Hill 533952.2 171622.0       ATC148         N   NOV
#> 6 20MPH101   Sydenham Hill 533952.2 171622.0       ATC148         S   NOV
#>   YEAR      MONITORING TYPE TOTAL FLOW ARX PEDAL-MOTORCYCLE   ARX CAR
#> 1 2015 LBS 20MPH monitoring   9203.857             639.2857 7702.7143
#> 2 2015 LBS 20MPH monitoring  10787.143             960.5714 8463.0000
#> 3 2015 LBS 20MPH monitoring   1148.571             290.8571  745.4286
#> 4 2015 LBS 20MPH monitoring   2296.429             270.5714 1635.8571
#> 5 2015 LBS 20MPH monitoring   7030.857             146.8571 6152.1429
#> 6 2015 LBS 20MPH monitoring   7771.000             122.5714 6868.7143
#>   ARX TRAILER_CARAVAN_VAN ARX 2AXLE_TRUCKorBUS ARX 3AXLE_TRUCKorBUS
#> 1               64.285714            567.28571            74.857143
#> 2               61.571429            855.28571           103.000000
#> 3                3.857143             91.28571             3.142857
#> 4               14.857143            356.57143             5.428571
#> 5               29.857143            638.57143            27.714286
#> 6               29.714286            664.42857            42.142857
#>   ARX 4AXLE_TRUCK    ARX LGV TOTAL LARGER THAN CAR AVERAGE_SPEED
#> 1       76.428571  79.000000              861.8571          17.9
#> 2      138.857143 204.857143             1363.5714          22.0
#> 3       10.571429   3.428571              112.2857          14.8
#> 4        8.857143   4.285714              390.0000          15.4
#> 5       20.142857  15.571429              731.8571          26.0
#> 6       25.428571  18.000000              779.7143          24.8
#>   _85TH_SPEED
#> 1        24.2
#> 2        26.4
#> 3        18.3
#> 4        18.6
#> 5        30.9
#> 6        29.8
head(traffic_casualties_2014)
#>   Accident_Severity       Date             geometry
#> 1            Slight 2014-05-18 -0.088153, 51.506886
#> 2            Slight 2014-09-15 -0.077685, 51.502218
#> 3            Slight 2014-09-27 -0.074294, 51.507468
#> 4            Slight 2014-09-06 -0.077541, 51.502216
#> 5            Slight 2014-11-23 -0.075374, 51.505778
#> 6            Slight 2014-09-22 -0.057094, 51.505296

Created on 2018-10-10 by the reprex package (v0.2.1)

codecov-io commented 5 years ago

Codecov Report

Merging #50 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #50   +/-   ##
=======================================
  Coverage   65.53%   65.53%           
=======================================
  Files          13       13           
  Lines         383      383           
=======================================
  Hits          251      251           
  Misses        132      132

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 7be13e8...9ca704c. Read the comment docs.

layik commented 5 years ago

Why are you not pushing @Robinlovelace? :)

mpadge commented 5 years ago

I'm not sure what this means - are these point counts of traffic data? And do you mean that we then need a corresponding road network? And does that in turn mean that dodgr could be used to generate flow estimates for the whole network using the point counts as sources? That would be cool!

Robinlovelace commented 5 years ago

The points were previously just points where data was collected. Now I've added actual travel data by mode, e.g.

#>   YEAR      MONITORING TYPE TOTAL FLOW ARX PEDAL-MOTORCYCLE   ARX CAR
#> 1 2015 LBS 20MPH monitoring   9203.857             639.2857 7702.7143
#> 2 2015 LBS 20MPH monitoring  10787.143             960.5714 8463.0000
#> 3 2015 LBS 20MPH monitoring   1148.571             290.8571  745.4286
#> 4 2015 LBS 20MPH monitoring   2296.429             270.5714 1635.8571
#> 5 2015 LBS 20MPH monitoring   7030.857             146.8571 6152.1429
#> 6 2015 LBS 20MPH monitoring   7771.000             122.5714 6868.7143

Yes I think it's a cool dataset. Many possibilities with it. 1st thought is that it could be useful for testing geoplumbers's ability to visualise multiple layers. Route network data should be added to the list in #45, if the network had flow estimates that would increase it's value I think as will be the kind of thing we'll want to visualise repeatedly in the (active transport) future.

Robinlovelace commented 5 years ago

I've only joined the pedal cycle flow data to the sf object traffic though to avoid 'data overload':

#>        total cycle_or_motorcycle av_speed year           geometry
#> 1 19991.0000          1599.85714   19.950 2015 -0.11124, 51.49595
#> 2  3445.0000           561.42857   15.100 2015 -0.10723, 51.49412
#> 3 14801.8571           269.42857   25.400 2015 -0.07460, 51.42772
#> 4 34337.1429           655.71429   18.950 2015 -0.07426, 51.42598
#> 5   676.2857            55.85714   14.300 2015 -0.07075, 51.48484
#> 6 16431.4286           515.00000   26.525 2014 -0.07082, 51.45261
Robinlovelace commented 5 years ago

Belated answer to your question @layik :

Because it's quite a lot of data: 500kb+

I think it's worth it though. Your package, your choice. + I like branches :deciduous_tree: !

layik commented 5 years ago

I am happy.

Robinlovelace commented 5 years ago

Great. Lots more pretty visualisations can result from this interesting dataset. Very interested to see the relationship between the traffic and crash datasets.