ipeaGIT/r5r

Recurring issue from issue #382: Isochrones in low-road density contexts

Closed this issue · 1 comments

I'm running into the same issue as issue #382 (dplyr::summarise error in isochrones function) and when I updated my version to the current development version with fixes from that same issue, I implemented polygon_output=F and got a dataframe with 0 rows and 14 columns.

Additionally, my data is based on census block geometries in Pittsburgh (which isn't a low-road density place). I've checked it for various points in my pgh_bcoord dataframe, but still getting the same issue with an empty dataframe.

Reproducible example

# get pittsburgh blocks and population density

# from tigris package
allg_blocks <- blocks(state="PA", county="Allegheny", year = 2020, class="sf") %>%
  st_transform(proj_crs) 

allg_blocks$indicator <- allg_blocks %>%
  st_within(pgh_buffer) %>% 
  lengths > 0

# filter for all blocks in PGH
pgh_blocks <- allg_blocks[allg_blocks$indicator,]

pgh_cent <- pgh_blocks %>% st_transform("epsg:4326") %>% st_centroid(.)

pgh_bcoord <- pgh_cent %>%
  st_coordinates() %>%
  st_drop_geometry() %>%
  as.data.frame() %>%
  mutate(id=as.character(row_number()), lon=X, lat=Y) %>%
  select(id, lon, lat)


iso_results <- isochrone(r5r_core, 
                     origins = pgh_bcoord, 
                     mode = c("CAR"), 
                     departure_datetime = datetime, 
                     cutoffs = seq(0, 20, 10),
                     polygon_output = F) 

image

  1. Briefly describe your problem and what output you expect. If you have a question, please don't use this form. Instead, ask on Stack Overflow https://stackoverflow.com/.

  2. Include a minimal reproducible example. If necessary, you can use one of the sample data sets that come within the r5r package. See example below.

  3. Run the r5r::r5r_sitrep() function to generate a situation report, and paste the output along with your issue. This will help us find eventual bugs.

$r5r_package_version
[1] ‘2.0.9999’

$r5_jar_version
[1] "7.1"

$java_version
[1] "21.0.3"

$set_memory
[1] "-Xmx2G"

$session_info
R version 4.3.2 (2023-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22631)

Matrix products: default


locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8    LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                           LC_TIME=English_United States.utf8    

time zone: America/Los_Angeles
tzcode source: internal

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

other attached packages:
 [1] tidygeocoder_1.0.5 jsonlite_1.8.8     httr2_1.0.1        arcpullr_0.2.9     SpatialAcc_0.1-5   tmap_3.3-4         tigris_2.1        
 [8] tidycensus_1.6.3   crsuggest_0.4      sf_1.0-16          lubridate_1.9.3    forcats_1.0.0      stringr_1.5.1      dplyr_1.1.4       
[15] purrr_1.0.2        readr_2.1.4        tidyr_1.3.0        tibble_3.2.1       ggplot2_3.4.4      tidyverse_2.0.0    spNetwork_0.4.3.8 
[22] r5r_2.0.09999      rJava_1.0-11      

loaded via a namespace (and not attached):
  [1] RColorBrewer_1.1-3 rstudioapi_0.15.0  wk_0.9.1           magrittr_2.0.3     farver_2.1.1       fs_1.6.3           vctrs_0.6.4       
  [8] memoise_2.0.1      base64enc_0.1-3    terra_1.7-71       htmltools_0.5.7    leafsync_0.1.0     usethis_2.2.3      curl_5.2.0        
 [15] raster_3.6-26      s2_1.1.6           KernSmooth_2.23-22 htmlwidgets_1.6.4  desc_1.4.3         stars_0.6-4        cachem_1.0.8      
 [22] uuid_1.2-0         igraph_1.6.0       mime_0.12          lifecycle_1.0.4    pkgconfig_2.0.3    R6_2.5.1           fastmap_1.1.1     
 [29] rbibutils_2.2.16   shiny_1.8.1.1      digest_0.6.34      colorspace_2.1-0   mapview_2.11.2     ps_1.7.6           leafem_0.2.3      
 [36] pkgload_1.3.4      crosstalk_1.2.1    lwgeom_0.2-14      fansi_1.0.5        timechange_0.2.0   httr_1.4.7         abind_1.4-5       
 [43] compiler_4.3.2     proxy_0.4-27       remotes_2.4.2.1    withr_3.0.0        backports_1.4.1    DBI_1.2.2          pkgbuild_1.4.3    
 [50] rappdirs_0.3.3     sessioninfo_1.2.2  tmaptools_3.1-1    leaflet_2.2.2      classInt_0.4-10    tools_4.3.2        units_0.8-5       
 [57] httpuv_1.6.15      glue_1.7.0         satellite_1.0.5    callr_3.7.5        promises_1.2.1     grid_4.3.2         checkmate_2.3.1   
 [64] generics_0.1.3     gtable_0.3.4       tzdb_0.4.0         class_7.3-22       data.table_1.15.0  hms_1.1.3          sp_2.1-3          
 [71] xml2_1.3.6         utf8_1.2.4         pillar_1.9.0       later_1.3.2        lattice_0.21-9     tidyselect_1.2.1   miniUI_0.1.1.1    
 [78] sfheaders_0.4.4    stats4_4.3.2       devtools_2.4.5     DT_0.32            stringi_1.8.2      codetools_0.2-19   cli_3.6.1         
 [85] xtable_1.8-4       Rdpack_2.6         munsell_0.5.0      processx_3.8.3     dichromat_2.0-0.1  Rcpp_1.0.12        png_0.1-8         
 [92] XML_3.99-0.16.1    parallel_4.3.2     ellipsis_0.3.2     cubature_2.1.0     profvis_0.3.8      urlchecker_1.0.1   viridisLite_0.4.2 
 [99] scales_1.3.0       e1071_1.7-14       crayon_1.5.2       rlang_1.1.3        rvest_1.0.4   

Nevermind, I see that I was implementing it wrong and should have pointed the data_path to my own network. In any case that may be a useful warning to have if points are very far off from the network!