ITSLeeds / pct

Get and reproduce data from the Propensity to Cycle Tool (PCT)
https://itsleeds.github.io/pct/
19 stars 10 forks source link

Get_centroids_wpz and oa functions #92

Closed Robinlovelace closed 1 year ago

Robinlovelace commented 3 years ago

So we can create desire lines and 'od data frames' with lon and lat of start and endpoint using the od package and building on #90.

Robinlovelace commented 3 years ago

Starter for 10 that may help with this in reproducible example below. Just found a link to the data here: https://geoportal.statistics.gov.uk/datasets/176661b9403a4c84ae6aedf8bb4127cf_0

ukboundaries::duraz("https://opendata.arcgis.com/datasets/176661b9403a4c84ae6aedf8bb4127cf_0.zip?outSR=%7B%22latestWkid%22%3A27700%2C%22wkid%22%3A27700%7D")
#> Using default data cache directory ~/.ukboundaries/cache 
#> Use cache_dir() to change it.
#> Reading layer `Workplace_Zones__December_2011__Population_Weighted_Centroids' from data source `/tmp/RtmpbIhnVb/reprex2b7a260def73/Workplace_Zones__December_2011__Population_Weighted_Centroids.shp' using driver `ESRI Shapefile'
#> Simple feature collection with 53578 features and 2 fields
#> geometry type:  POINT
#> dimension:      XY
#> bbox:           xmin: 89488.81 ymin: 10532.2 xmax: 655350.2 ymax: 655053.4
#> projected CRS:  OSGB 1936 / British National Grid
#> Removing the following files: Workplace_Zones__December_2011__Population_Weighted_Centroids.dbf Workplace_Zones__December_2011__Population_Weighted_Centroids.prj Workplace_Zones__December_2011__Population_Weighted_Centroids.shp Workplace_Zones__December_2011__Population_Weighted_Centroids.shx
#> Simple feature collection with 53578 features and 2 fields
#> geometry type:  POINT
#> dimension:      XY
#> bbox:           xmin: 89488.81 ymin: 10532.2 xmax: 655350.2 ymax: 655053.4
#> projected CRS:  OSGB 1936 / British National Grid
#> First 10 features:
#>    objectid    wz11cd              geometry
#> 1         1 E33000383 POINT (444717 519287)
#> 2         2 E33000251 POINT (437281 558342)
#> 3         3 E33000799 POINT (424675 564423)
#> 4         4 E33000257 POINT (430064 556252)
#> 5         5 E33000079 POINT (424229 568563)
#> 6         6 E33000312 POINT (449600 520286)
#> 7         7 E33000580 POINT (416475 535643)
#> 8         8 E33000174 POINT (431463 569905)
#> 9         9 E33000329 POINT (458961 522179)
#> 10       10 E33000043 POINT (424763 560858)

Created on 2020-12-07 by the reprex package (v0.3.0)

Robinlovelace commented 3 years ago

May be worth adding this code to the PCT package to help with that: https://github.com/Robinlovelace/ukboundaries/blob/master/R/ukborders-package.R#L6-L51