Open mpadge opened 6 years ago
I think distance is less important than where the buses etc actually go, even more than in cycling. I suggest using something like opentripplanner - which has a nascent R package partly instigated by Malcolm and I: https://github.com/marcusyoung/otp-tutorial
Which of course relies on open GTFS data which fortunately, like OSM data on walking and cycling infrastructure, is getting better and better in cities around the world.
The problem nevertheless remains that we need to transform locations of public transport infrastructure into relative estimates of densities emanating from those locations. I think, however, that I've got a nifty solution ... shall report back soon
ok, if you want the numbers from the JICA travel study, give me a shout, I can try to get them into a text format
@eyesofbambi here's a first go for Kathmandu, with densities estimated from local densities of "functional" - that is, non-residential - buildings. Do these look reasonable to you? These would represent estimated flows from bus stops to non-residential locations (that is, to locations for purposes of education, shopping, health, recreation, whatever).
[EDIT: Figure updated after fixing former error in density calculation]
The scales here are still confounded with residential densities, which I stiill need to account for. That will change the results somewhat.
That code now in full repro form in new flowlayers
package, which should work like this (if flowlayers
is in same master directory as who-data
):
library (flowlayers)
city <- "kathmandu"
graph <- get_street_network (city = city)
bus <- get_bus_data (city = city, graph = graph)
bldg <- get_buildings (city = city) %>%
get_building_areas (graph)
bus <- local_point_density (bus, bldg, data_col = "area", k = 5)
View results via mapview
:
bus$area_scale <- bus$area / max (bus$area)
bus$area_scale [bus$area_scale == 0] <-
min (bus$area_scale [bus$area_scale > 0])
indx <- ceiling (bus$area_scale * 30)
bus$cols <- rev (topo.colors (30)) [ceiling (bus$area_scale * 30)]
mapview::mapview (bus, cex = 20 * bus$area_scale,
col.regions = bus$cols, col = bus$cols)
This means that flow layers can be calculated with just a few lines of what should be entirely reproducible code, including realistically-scaled flows from public transport locations
sounds great, would be good if it could be reproducible like this indeed, will see if I can manage to verify against the numbers I found
Those are certainly really cool data, but more useful just for calculating typical lengths of journeys, right? There doesn't seem to be a way to map those data on to likely numbers/densities of people exiting at particular bus stops, which is what I've been trying to do here. Is that your understanding of the data as well?
true, there was something about trip purpose (work, education, shopping, etc.) and destination zones for those using public transport, which I was hoping might at least roughly correspond to what you've generated, plus some maps which looked like they might contain some similar info, but indeed not immediately comparable for the current purpose at the moment. was still hoping I'd find the raw data, which a number of people have referenced, since that might contain more specific information like this, but doesn't look like they've made them publicly available
That's cool - we're still at prototype stage at the moment. One day down the track it'll become important to benchmark this kind of approach against some real data, but for the moment it's probably sufficient to just move on anyway. Thanks for sleuthing around anyway!
I wish I could contribute. Still at learning stage here. Apologies @mpadge
Yeah right @layik , I'm the one learning from you, and I suspect @Robinlovelace is too. Now stop this work rubbish and do something productive with your evening
Following on from this issue in the
proto
repo arises the general problem:We have population densities for movement from residential locations, and we have building sizes to scale densities of movement from non-residential buildings. What we do not have is any way to estimate relative densities of movement from bus (or other public transport) stops. We really do need a way to do this, however crudely. My best guess at the moment would be something like:
Estimate an overall distance-decay function for lengths of bus journeys, and allocate densities from residential locations accordingly. I have one very large data set of bus trips which could be used to get a decay function, but doubt very much that such a thing would be universal. (Those data are from the USA.)
Other ideas desperately needed, please @layik @Robinlovelace @eyesofbambi ?