ipeaGIT / r5r

https://ipeagit.github.io/r5r/
Other
178 stars 27 forks source link

Accesibility Result same for every mode and hour of the day #376

Closed JideDanalyst closed 6 months ago

JideDanalyst commented 6 months ago

Hello @rafapereirabr Thanks for the other time on the accessibility exercise. In calculating accessibility, I followed the steps you outlined, which included merging the accessibility data with the study area boundary file with geometry, and then plotting an isochrone map to display accessible jobs based on cutoff times. Specifically, I analyzed accessibility on a weekday at 9:00 AM using two different travel modes: walking and taking the bus.

Despite changing the mode of transportation and analyzing different time slots (9:00 AM and 6:00 PM), the accessibility calculations and resultant maps remain identical. Based on my understanding, and as suggested in your book, variations in mode and time should yield different results. Could you please shed some light on this issue? Is it possible that I have overlooked a crucial step, or is it expected that the results remain consistent despite these changes? Your expert insights would be precious to me. Thank you for your time and assistance.

Codes: library(r5r) library(tidyverse) library(sf) library(data.table) library(ggplot2) library(mapview) library(rJava)

options(java.parameters = "-Xmx16G") path = "C:\Users\JUMIA-4237\Desktop\U_clean" r5r_core <- setup_r5(data_path = path) od_zones1 <- st_read(file.path(path,"Zone_3.gpkg")) od_zones1 %>% mapview() od_zones <- st_read(file.path(path,"zone_re.gpkg")) od_zones %>% mapview() od_points_sf <- st_read(file.path(path,"od_points_5.gpkg")) od_points_sf %>% mapview(zcol="Jobs") names(od_points_sf) transit <- transit_network_to_sf(r5r_core) transit$routes %>% mapview(zcol = "mode") access_walk_df <- accessibility(r5r_core, origins = od_zones, destinations = od_points_sf, mode = c("BUS","transit"), opportunities_colname = "Jobs", departure_datetime = as.POSIXct("23-05-2023 09:00:00", format = "%d-%m-%Y %H:%M:%S"), cutoffs = c(15, 30, 60, 90), verbose = FALSE) image

rafapereirabr commented 6 months ago

Your map above only shows the result for walking. You're saying that the results for public transport look exactly the same. Correct?

This is likely related to question 6 in our FAQ.

on another point 1, you should run options(java.parameters = "-Xmx16G") before loading r5r with library(r5r)

on another point 2, your maps for 60 and 90 min. show a very clear discontinuity in accessibility levels, with a square shape. I supect that your OSM data does not cover the entire region of interest, which I assume includes all areas colored in blue

JideDanalyst commented 6 months ago

the result for walking and public transport looks thesame that's why I uploaded one.

for the OSM this: transit <- transit_network_to_sf(r5r_core) transit$routes %>% mapview(zcol = "mode"). pulls it out from the directory ? Can I download this from Overpass directly or from R. I need a clear approach on this one. Thanks. and how many files will this comprise?

I have chosen the date from the GTFS calenda_data. here is the image. image

rafapereirabr commented 6 months ago

ok, it seems you're setting the departure time within the GTFS calendar period.

I would suspect there might me some issues with the quality of the GTFS, but honestly, it could be other things. It is very hard to understand what could be going wrong without the data or a reproducible example. In any case, I'd recommend you run the GTFS validator to check for any issues / probrlems in the GTFS feed. You can do this using the {gtfstools} package.

JideDanalyst commented 6 months ago

Thanks. I will run and find out what is the issue. Just to ask.. I have downloaded the OSM_PBF file again from BBBike extract covering reasonable amount of area. This goes directly to my directory right ? while this code calls it in: transit <- transit_network_to_sf(r5r_core) transit$routes %>%. because it seems that codes calls in a certain network different from what I have in my directory

rafapereirabr commented 6 months ago

yes, you would need to replace the old OSM data in the directory with the new one, and you also need to delete the network.dat file as well to make sure r5r builds a new network with the new data.

the function transit_network_to_sf(r5r_core) will load the network stored in the r5r_core object. This network is saved locally in the network.dat file.

JideDanalyst commented 6 months ago

Okay..thanks a lot

On Thu, 7 Mar 2024, 2:15 pm Rafael H M Pereira, @.***> wrote:

yes, you would need to replace the old OSM data in the directory with the new one, and you also need to delete the network.dat file as well to make sure r5r builds a new network with the new data.

the function transit_network_to_sf(r5r_core) will load the network stored in the r5r_core object. This network is saved locally in the network.dat file.

— Reply to this email directly, view it on GitHub https://github.com/ipeaGIT/r5r/issues/376#issuecomment-1983593627, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFTQLWEUROW7EMCI7WH2S7DYXBY6PAVCNFSM6AAAAABEK4QNACVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBTGU4TGNRSG4 . You are receiving this because you authored the thread.Message ID: @.***>

JideDanalyst commented 6 months ago

Can I perform the validation on another platform other than R ?

rafapereirabr commented 6 months ago

probably yes, check the github of the original tool

JideDanalyst commented 6 months ago

image this is the result

JideDanalyst commented 6 months ago

Does this means I need download another file ?

rafapereirabr commented 6 months ago

it looks like your GTFS has some critical errors. you might need another GTFS or to fix these errors;

JideDanalyst commented 6 months ago

Thats the problem sir fixing is the issue. I am not familiar with that. And where do you suggest we download a good quality GTFS for London. Thanks

rafapereirabr commented 6 months ago

unfortunately, I don't have experience with GTFS feed in the UK. Perhaps Duncan or colleagues at CASA might be able to help.

JideDanalyst commented 6 months ago

Oh thank you sir. You have been helpful. This is clear now. Cheers!

JideDanalyst commented 6 months ago

Can I reach him on here ?

rafapereirabr commented 6 months ago

I'm sure you can find his email.

JideDanalyst commented 6 months ago

started getting this errors after downloading a new OSM: This is getting frustrating. what might this be sir. I have download the OSM from different source still same error and it doesn't show up before

r5r_core <- setup_r5(data_path = path)No raster .tif files found. Using elevation = 'NONE'.Using cached R5 version from C:/Users/JUMIA-4237/AppData/Local/R/win-library/4.3/r5r/jar/r5-v6.9-all.jar2024-03-08 01:11:27,745 [main] ERROR c.c.r.s.StreetLayer - Continuing to load but ignoring generalized costs due to exception: java.lang.RuntimeException: All ways are expected to have generalized cost tags. Missing: slope_1:forward2024-03-08 01:11:44,252 [main] ERROR c.c.r.s.StreetLayer - Invalid turn restriction 1314143, does not have from, to and via, skipping2024-03-08 01:11:44,357 [main] ERROR c.c.r.s.StreetLayer - Invalid turn restriction 2536520, does not have from, to and via, skipping2024-03-08 01:11:44,373 [main] ERROR c.c.r.s.StreetLayer - Invalid turn restriction 3329441, does not have from, to and via, skipping2024-03-08 01:11:44,387 [main] ERROR c.c.r.s.StreetLayer - Restriction 5713754 has no restriction tag, skipping2024-03-08 01:11:44,404 [main] ERROR c.c.r.s.StreetLayer - Invalid turn restriction 6932196, does not have from, to and via, skipping 2024-03-08 01:11:44,405 [main] ERROR c.c.r.s.StreetLayer - Did not find from/to edges for restriction 7309920, skipping 2024-03-08 01:11:44,405 [main] ERROR c.c.r.s.StreetLayer - Did not find from/to edges for restriction 7309924, skipping2024-03-08 01:11:44,441 [main] ERROR c.c.r.s.StreetLayer - Invalid turn restriction 9095150, does not have from, to and via, skipping2024-03-08 01:11:44,449 [main] ERROR c.c.r.s.StreetLayer - Invalid turn restriction 9408532, no way from from to to via via, skipping 2024-03-08 01:11:44,449 [main] ERROR c.c.r.s.StreetLayer - Invalid turn restriction 9408533, no way from from to to via via, skipping 2024-03-08 01:11:44,457 [main] ERROR c.c.r.s.StreetLayer - Restriction 9477032 has no restriction tag, skipping2024-03-08 01:11:44,465 [main] ERROR c.c.r.s.StreetLayer - Restriction 9668134 has no restriction tag, skipping 2024-03-08 01:11:44,465 [main] ERROR c.c.r.s.StreetLayer - Restriction 9727199 has no restriction tag, skipping 2024-03-08 01:11:44,465 [main] ERROR c.c.r.s.StreetLayer - Invalid turn restriction 9742849, does not have from, to and via, skipping 2024-03-08 01:11:44,475 [main] ERROR c.c.r.s.StreetLayer - Did not find from/to edges for restriction 10051880, skipping 2024-03-08 01:11:44,477 [main] ERROR c.c.r.s.StreetLayer - Did not find from/to edges for restriction 10051881, skipping2024-03-08 01:11:44,481 [main] ERROR c.c.r.s.StreetLayer - Did not find from/to edges for restriction 10294462, skipping 2024-03-08 01:11:44,481 [main] ERROR c.c.r.s.StreetLayer - Did not find from/to edges for restriction 10551996, skipping2024-03-08 01:11:44,515 [main] ERROR c.c.r.s.StreetLayer - Did not find from/to edges for restriction 11942530, skipping 2024-03-08 01:11:44,523 [main] ERROR c.c.r.s.StreetLayer - Restriction 12482213 has no restriction tag, skipping 2024-03-08 01:11:44,523 [main] ERROR c.c.r.s.StreetLayer - Invalid turn restriction 12579117, does not have from, to and via, skipping 2024-03-08 01:11:44,529 [main] ERROR c.c.r.s.StreetLayer - Turn restriction 12999442 has ambiguous via ways (multiple paths through via ways between from and to), skipping2024-03-08 01:11:44,529 [main] ERROR c.c.r.s.StreetLayer - Turn restriction 12999452 has ambiguous via ways (multiple paths through via ways between from and to), skipping 2024-03-08 01:11:44,529 [main] ERROR c.c.r.s.StreetLayer - Invalid turn restriction 13026472, does not have from, to and via, skipping 2024-03-08 01:11:44,529 [main] ERROR c.c.r.s.StreetLayer - Turn restriction 13048524 has ambiguous via ways (multiple paths through via ways between from and to), skipping 2024-03-08 01:11:44,534 [main] ERROR c.c.r.s.StreetLayer - Invalid turn restriction 13494007, does not have from, to and via, skipping 2024-03-08 01:11:44,534 [main] ERROR c.c.r.s.StreetLayer - Did not find from/to edges for restriction 13569989, skipping 2024-03-08 01:11:44,542 [main] ERROR c.c.r.s.StreetLayer - Restriction 13857737 has no restriction tag, skipping 2024-03-08 01:11:44,542 [main] ERROR c.c.r.s.StreetLayer - Restriction 14214130 has no restriction tag, skipping2024-03-08 01:11:44,550 [main] ERROR c.c.r.s.StreetLayer - Invalid turn restriction 14570121, does not have from, to and via, skipping 2024-03-08 01:11:44,550 [main] ERROR c.c.r.s.StreetLayer - Invalid turn restriction 14694168, does not have from, to and via, skipping 2024-03-08 01:11:44,550 [main] ERROR c.c.r.s.StreetLayer - Invalid turn restriction 14694255, does not have from, to and via, skipping 2024-03-08 01:11:44,550 [main] ERROR c.c.r.s.StreetLayer - Invalid turn restriction 14719417, does not have from, to and via, skipping 2024-03-08 01:11:44,550 [main] ERROR c.c.r.s.StreetLayer - Restriction 14733337 has no restriction tag, skipping 2024-03-08 01:11:44,558 [main] ERROR c.c.r.s.StreetLayer - Restriction 14906126 has no restriction tag, skipping 2024-03-08 01:11:44,558 [main] ERROR c.c.r.s.StreetLayer - Invalid turn restriction 15101833, does not have from, to and via, skipping 2024-03-08 01:11:44,558 [main] ERROR c.c.r.s.StreetLayer - Restriction 15342006 has no restriction tag, skipping 2024-03-08 01:11:44,558 [main] ERROR c.c.r.s.StreetLayer - Restriction 15342007 has no restriction tag, skipping2024-03-08 01:11:44,566 [main] ERROR c.c.r.s.StreetLayer - Invalid turn restriction 16350391, does not have from, to and via, skipping 2024-03-08 01:11:44,566 [main] ERROR c.c.r.s.StreetLayer - Restriction 16375115 has no restriction tag, skipping 2024-03-08 01:11:44,566 [main] ERROR c.c.r.s.StreetLayer - Restriction 16375116 has no restriction tag, skipping 2024-03-08 01:11:44,566 [main] ERROR c.c.r.s.StreetLayer - Restriction 16496142 has no restriction tag, skipping 2024-03-08 01:11:44,566 [main] ERROR c.c.r.s.StreetLayer - Restriction 16518321 has no restriction tag, skipping 2024-03-08 01:11:44,566 [main] ERROR c.c.r.s.StreetLayer - Restriction 16838014 has no restriction tag, skipping 2024-03-08 01:11:44,574 [main] ERROR c.c.r.s.StreetLayer - Invalid turn restriction 16946953, does not have from, to and via, skipping Finished building network.dat at C:\Users\JUMIA-4237\Desktop\Accessiblity File/network.dat> transit <- transit_network_to_sf(r5r_core)Error in scan(text = lst[[length(lst)]], quiet = TRUE) : scan() expected 'a real', got 'IllegalArgumentException:'Error in (function (msg) : IllegalArgumentException: point array must contain 0 or >1 elements

On Thu, Mar 7, 2024 at 6:10 PM Rafael H M Pereira @.***> wrote:

I'm sure you can find his email.

— Reply to this email directly, view it on GitHub https://github.com/ipeaGIT/r5r/issues/376#issuecomment-1984026592, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFTQLWDPLPWTSTD4XABI7ETYXCNP5AVCNFSM6AAAAABEK4QNACVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBUGAZDMNJZGI . You are receiving this because you authored the thread.Message ID: @.***>

rafapereirabr commented 6 months ago

a few comments:

  1. Since you're changing the files used to build the network, perhaps you might to set overwrite = TRUE, to make sure you build a new network instead of just loading the old network to memory: setup_r5(data_path = path, overwrite = TRUE)
  2. Most of these 'error' messages are internal messages from Java we cannot silence in R. They are not 'errors' per se. As you can see, r5r was able to build the network. See the message you get Finished building network.dat at C:\Users\JUMIA-4237\Desktop\Accessiblity File/network.dat>
  3. The real error you're getting is when you run transit_network_to_sf(r5r_core). I haven't seen this error before, and I suspect it is because of your GTFS feed. Have you fixed the errors in the GTFS feed?

Try running st <- street_network_to_sf(r5r_core) to see if it works,

JideDanalyst commented 6 months ago

The error in the GTFS field. I don't understand how to go about it I had to download another one. So many errors that am not familiar with. I used the code, however, it didn't give any error but when ever I tried to view the columns and network it shows NULL

On Fri, Mar 8, 2024 at 1:23 PM Rafael H M Pereira @.***> wrote:

a few comments:

  1. Since you're changing the files used to build the network, perhaps you might to set overwrite = TRUE, to make sure you build a new network instead of just loading the old network to memory: setup_r5(data_path = path, overwrite = TRUE)
  2. Most of these 'error' messages are internal messages from Java we cannot silence in R. They are not 'errors' per se. As you can see, r5r was able to build the network. See the message you get Finished building network.dat at C:\Users\JUMIA-4237\Desktop\Accessiblity File/network.dat>
  3. The real error you're getting is when you run transit_network_to_sf(r5r_core). I haven't seen this error before, and I suspect it is because of your GTFS feed. Have you fixed the errors in the GTFS feed?

Try running st <- street_network_to_sf(r5r_core) to see if it works,

— Reply to this email directly, view it on GitHub https://github.com/ipeaGIT/r5r/issues/376#issuecomment-1985602401, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFTQLWFM5I3FG22D4EPZUOTYXGUVTAVCNFSM6AAAAABEK4QNACVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBVGYYDENBQGE . You are receiving this because you authored the thread.Message ID: @.***>

rafapereirabr commented 6 months ago

So it really is an issue with the GTFS data, not with r5r. I'm sorry I cannot help you much further with that. I'd recommend you look at this paper, which points to where you can find GTFS for London and other cities in the UK.

I'm closing this issue for now since this is not an issue with r5r itself.