Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculate areas within network distance #313

Open
Robinlovelace opened this issue Jun 12, 2019 · 6 comments
Open

Calculate areas within network distance #313

Robinlovelace opened this issue Jun 12, 2019 · 6 comments

Comments

@Robinlovelace
Copy link
Member

This is a request I received to solve a common problem: identify all areas within some 'network distance' of points.

@Robinlovelace
Copy link
Member Author

Starting point in reprex below:

# Aim: calculate areas within network distance

unzip("~/repos/stplanr/Network_Hassall.zip")
list.files("Network_Hassall/")
#>  [1] "accesspoints.cpg"                             
#>  [2] "accesspoints.dbf"                             
#>  [3] "accesspoints.prj"                             
#>  [4] "accesspoints.sbn"                             
#>  [5] "accesspoints.sbx"                             
#>  [6] "accesspoints.shp"                             
#>  [7] "accesspoints.shp.MAN-NTW-38.6084.4152.sr.lock"
#>  [8] "accesspoints.shp.xml"                         
#>  [9] "accesspoints.shx"                             
#> [10] "BowlingPark3.CPG"                             
#> [11] "BowlingPark3.dbf"                             
#> [12] "BowlingPark3.prj"                             
#> [13] "BowlingPark3.sbn"                             
#> [14] "BowlingPark3.sbx"                             
#> [15] "BowlingPark3.shp"                             
#> [16] "BowlingPark3.shp.MAN-NTW-38.6084.4152.sr.lock"
#> [17] "BowlingPark3.shp.xml"                         
#> [18] "BowlingPark3.shx"                             
#> [19] "SE_Road.dbf"                                  
#> [20] "SE_Road.prj"                                  
#> [21] "SE_Road.sbn"                                  
#> [22] "SE_Road.sbx"                                  
#> [23] "SE_Road.shp"                                  
#> [24] "SE_Road.shp.ed.lock"                          
#> [25] "SE_Road.shp.MAN-NTW-38.6084.4152.sr.lock"     
#> [26] "SE_Road.shx"
roads = sf::read_sf("Network_Hassall/SE_Road.shp")
apnts = sf::read_sf("Network_Hassall/accesspoints.shp")
plot(apnts)

apnt1 = apnts[1, ]

sf::st_crs(apnts)
#> Coordinate Reference System:
#>   EPSG: 27700 
#>   proj4string: "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs"
sf::st_crs(roads)
#> Coordinate Reference System:
#>   EPSG: 27700 
#>   proj4string: "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs"

a_buff = sf::st_buffer(apnt1, 1000)
r_buff = sf::st_intersection(roads, a_buff)
#> Warning: attribute variables are assumed to be spatially constant
#> throughout all geometries

mapview::mapview(r_buff) + mapview::mapview(apnt1)

Created on 2019-06-12 by the reprex package (v0.3.0)

@mpadge
Copy link
Member

mpadge commented Jun 12, 2019

Depends what you mean by "areas"? The new dodgr function, dodgr_fundamental_cycles enables all areas enclosed by cycles of highways to be identified. Or do you mean something else?

@Robinlovelace
Copy link
Member Author

Hi @mpadge thanks for spotting this and the quick response. I was thinking that dodgr could be a suitable (and fast!) way to solve this. Thinking about it, I believe it would be sufficient to return the network geometries associated with each point, i.e. something like this:
image

@Robinlovelace
Copy link
Member Author

Then a buffer operation, with assumptions about feasible distance to walk to roads, could be used to convert the result into a polygon that can be overlaid on a residential zoning system to estimate the number of people within x km network distance to each point (in this case parks). Would dodgr_fundamental_cycles() be an appropriate tool for the job? The network, provided by @Katatrepsis, is quite large and there are many points.

I plan to upload the input data as it's all open access I believe. Good benchmark!

@Robinlovelace
Copy link
Member Author

Also hearing from @mem48 that the in-development https://github.com/ITSLeeds/opentripplanner has good any modal isochrones.

@mem48
Copy link
Collaborator

mem48 commented Jun 12, 2019

It might be better to get all nodes within a ditance with dodgr and do a concave hull on the points

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants