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

Calc_network_catchment example issue #399

Open
edclay123 opened this issue May 3, 2020 · 0 comments
Open

Calc_network_catchment example issue #399

edclay123 opened this issue May 3, 2020 · 0 comments

Comments

@edclay123
Copy link

Hi guys thanks for your work on this package, it is very useful.

I was trying to reproduce the calc_network_catchment example included in the 'stplanr: A Package for Transport Planning' pdf but there seems to be an issue with overlapping buffers. This also affects the calculating the number of people in the catchment as it is larger under the calc_network_catchment function than calc_catchment, leading me to believe there is double counting.
image

I have included the code below so it is quicker to test/reproduce.

library(stplanr)
data_dir <- system.file("extdata", package = "stplanr")
unzip(file.path(data_dir, 'smallsa1.zip'))
unzip(file.path(data_dir, 'testcycleway.zip'))
sa1income <- rgdal::readOGR(".", "smallsa1")
testcycleway <- rgdal::readOGR(".", "testcycleway")
# Remove unzipped files
file.remove(list.files(pattern = "^(smallsa1|testcycleway).*"))
catch800m <- calc_catchment(
polygonlayer = sa1income,
targetlayer = testcycleway,
calccols = c('Total'),
distance = 800,
projection = 'austalbers',
dissolve = TRUE
)
plot(sa1income, col = "light grey")
plot(catch800m, col = rgb(1, 0, 0, 0.5), add = TRUE)
plot(testcycleway, col = "green", add = TRUE)
unzip(file.path(data_dir, 'sydroads.zip'))
sydroads <- rgdal::readOGR(".", "roads")
file.remove(list.files(pattern = "^(roads).*"))
sydnetwork <- SpatialLinesNetwork(sydroads)
netcatch800m <- calc_network_catchment(
sln = sydnetwork,
polygonlayer = sa1income,
targetlayer = testcycleway,
calccols = c('Total'),
maximpedance = 800,
distance = 100,
projection = 'austalbers'
)

plot(sa1income, col = "light grey")
plot(catch800m, col = rgb(1, 0, 0, 0.5), add = TRUE)
plot(netcatch800m, col = rgb(0, 0, 1, 0.5), add = TRUE)
plot(testcycleway, col = "green", add = TRUE)
sum(catch800m$Total)
sum(netcatch800m$Total)
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

1 participant