Microsoft acquired Revolution Analytics in January 2016
Opportunities for development of open source technologies for sustainable planning
14 July 2016. Slides made with RStudio. Reproducible code: https://github.com/npct/pct-rail-test
Microsoft acquired Revolution Analytics in January 2016
Opportunities for development of open source technologies for sustainable planning
What is the PCT?
An open source, publicly accessible web-based tool for assessing the geographical distribution and potential benefits of cycling potential nationwide
Best illustrated in a demo: http://pct.bike/
Version 1 - nationwide (V1 launch: June 2016)
Version 2 - local deployment
pkgs = c( "stplanr", # transport data handling "sp", # package for spatial data "tmap", # package for mapping "deldir", # voronoi polygons "readr", # fast read/write "rgeos", # gis functions "dplyr" # data analysis ) lapply(pkgs, library, character.only = T)
## [[1]] ## [1] "stplanr" "sp" "knitr" "stats" "graphics" ## [6] "grDevices" "utils" "datasets" "methods" "base" ## ## [[2]] ## [1] "stplanr" "sp" "knitr" "stats" "graphics" ## [6] "grDevices" "utils" "datasets" "methods" "base" ## ## [[3]] ## [1] "tmap" "stplanr" "sp" "knitr" "stats" ## [6] "graphics" "grDevices" "utils" "datasets" "methods" ## [11] "base" ## ## [[4]] ## [1] "deldir" "tmap" "stplanr" "sp" "knitr" ## [6] "stats" "graphics" "grDevices" "utils" "datasets" ## [11] "methods" "base" ## ## [[5]] ## [1] "readr" "deldir" "tmap" "stplanr" "sp" ## [6] "knitr" "stats" "graphics" "grDevices" "utils" ## [11] "datasets" "methods" "base" ## ## [[6]] ## [1] "rgeos" "readr" "deldir" "tmap" "stplanr" ## [6] "sp" "knitr" "stats" "graphics" "grDevices" ## [11] "utils" "datasets" "methods" "base" ## ## [[7]] ## [1] "dplyr" "rgeos" "readr" "deldir" "tmap" ## [6] "stplanr" "sp" "knitr" "stats" "graphics" ## [11] "grDevices" "utils" "datasets" "methods" "base"
u = "http://www.dft.gov.uk/NaPTAN/snapshot/NaPTANcsv.zip" zf = file.path(tempdir(), "NaPTANcsv.zip") download.file(url = u, destfile = zf) unzip(zf, exdir = tempdir()) stations = read_csv(file = file.path(tempdir(), "stops.csv")) rail = filter(stations, StopType == "RSE") saveRDS(rail, "data/rail.Rds")
# A tibble: 6 x 43
ATCOCode NaptanCode PlateCode CleardownCode CommonName CommonNameLang ShortCommonName ShortCommonNameLang Landmark
<chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
1 0100BRP90087 bstgtaw Brunswick Street en
2 0100BRP90088 bstgtjp Brigstocke Road en
3 0100BRP90089 bstgtpj Brigstocke Road en
4 0100BRP90090 bstgwgm Denbigh Street en
5 0100BRP90091 bstgwta Denbigh Street en
6 0100CLFDOWN0 Clifton Down Rail Station en
# ... with 34 more variables: LandmarkLang <chr>, Street <chr>, StreetLang <chr>, Crossing <chr>, CrossingLang <chr>, Indicator <chr>,
# IndicatorLang <chr>, Bearing <chr>, NptgLocalityCode <chr>, LocalityName <chr>, ParentLocalityName <chr>,
# GrandParentLocalityName <chr>, Town <chr>, TownLang <chr>, Suburb <chr>, SuburbLang <chr>, LocalityCentre <int>, GridType <chr>,
# Easting <int>, Northing <int>, Longitude <dbl>, Latitude <dbl>, StopType <chr>, BusStopType <chr>, TimingStatus <chr>,
# DefaultWaitTime <chr>, Notes <chr>, NotesLang <chr>, AdministrativeAreaCode <chr>, CreationDateTime <time>,
# ModificationDateTime <time>, RevisionNumber <int>, Modification <chr>, Status <chr>
rail = readRDS("data/rail.Rds")
coordinates(rail) = ~Longitude+Latitude
plot(rail)
For more info: see this infographic on usage stats.
z = readRDS("../pct-data/cambridgeshire/z.Rds")
qtm(z) +
qtm(rail, bubble.size = 0.3)
rail_cam = readRDS("data/rail_cam.Rds")
voronai = deldir(rail_cam$Easting, rail_cam$Northing)
plot(voronai)
for(i in 1:nrow(cents)){
o = cents[i,]
d = rail_cam[mat[i],]
od = sbind(SpatialPoints(o), SpatialPoints(d))
if(i == 1)
L = SpatialLines(list(Lines(list(Line(coordinates(od))),"X"))) else
L = sbind(L, SpatialLines(list(Lines(list(Line(coordinates(od))),"X"))))
}
ld = SpatialLinesDataFrame(L, cents@data["rail"], match.ID = F)
Using @robinlovelace tool (stplanr, modified) to review @cyclestreets journeys from their API, with @qgis. pic.twitter.com/t17LebZFJu
— Matt Turner (@MattTurnerSheff) January 31, 2016