ipeaGIT / r5r

https://ipeagit.github.io/r5r/
Other
181 stars 29 forks source link

Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, : java.util.concurrent.ExecutionException: java.lang.ArrayIndexOutOfBoundsException #385

Closed tripwright closed 5 months ago

tripwright commented 5 months ago

Hi there! I've been running travel time matrices for a number of U.S. cities and Boston is the only one to give me grief and this error. (Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, : java.util.concurrent.ExecutionException: java.lang.ArrayIndexOutOfBoundsException)

My code has been reproducible across several cities already, so I believe the issue lies in the GTFS file. I know the problem that mrosmann has had recently also dealt with Boston data...so maybe there's something going on there? I appreciate any guidance...TYIA!

Boston R5R CODE

Data: GTFS (from Boston MBTA): https://cdn.mbta.com/MBTA_GTFS.zip OSM (from BBBike): https://download.bbbike.org/osm/extract/planet_-71.497_42.109_c30a547a.osm.pbf BOS_neighborhoods.csv

options(java.parameters = '-Xmx10G')
library(r5r)

## after setting a path 
BOS_r5r_core <- setup_r5(data_path = BOS_r5r_path,
                   overwrite = F)

BOS_origins <- data.frame(id = BOS_neighborhoods$id, 
                      lon = BOS_neighborhoods$lon, 
                      lat = BOS_neighborhoods$lat)
BOS_destinations <- data.frame(id = BOS_neighborhoods$id, 
                           lon = BOS_neighborhoods$lon, 
                           lat = BOS_neighborhoods$lat)

BOS_results <- travel_time_matrix(BOS_r5r_core,
                              origins = BOS_origins,
                              destinations = BOS_destinations,
                              mode = "TRANSIT",
                              max_trip_duration = 300,
                              progress = T)

Situation report here

$r5r_package_version
[1] ‘2.0’

$r5_jar_version
[1] "7.1"

$java_version
[1] "21.0.2"

$set_memory
[1] "-Xmx10G"

$session_info
R version 4.3.2 (2023-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.2.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/New_York
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggplot2_3.5.0 r5r_2.0       rJava_1.0-11 

loaded via a namespace (and not attached):
 [1] backports_1.4.1   utf8_1.2.4        R6_2.5.1          tidyselect_1.2.1  magrittr_2.0.3   
 [6] gtable_0.3.4      glue_1.7.0        tibble_3.2.1      pkgconfig_2.0.3   generics_0.1.3   
[11] dplyr_1.1.4       lifecycle_1.0.4   cli_3.6.2         fansi_1.0.6       scales_1.3.0     
[16] grid_4.3.2        vctrs_0.6.5       withr_3.0.0       data.table_1.15.4 compiler_4.3.2   
[21] rstudioapi_0.16.0 tools_4.3.2       checkmate_2.3.1   munsell_0.5.1     pillar_1.9.0     
[26] colorspace_2.1-0  rlang_1.1.3    
rafapereirabr commented 5 months ago

Hi @tripwright . Could you please try building the network without the GTFS feeds in the data path, and then running the routing analysis with mode = "walk" ?

tripwright commented 5 months ago

Hi @rafapereirabr, thanks for getting back to me promptly. Yes, I was able to build the network again w/o the GTFS feeds and successfully run the routing analysis with mode = "walk".

rafapereirabr commented 5 months ago

Based on all this info, it is quite clear that the issue lies in your GTFS feed, and not on r5r, OSM data or on your code.

Your GTFS feed might not be valid because of various types os errors. I'd strongly recommend using the feed validator from the gtfstools package.

tripwright commented 5 months ago

Thank you. I'll be sure to check it out!