Giter VIP home page Giter VIP logo

Comments (4)

AlexandraKapp avatar AlexandraKapp commented on July 30, 2024 2

I double checked and now it works for me as well 🤷
might not have pulled the current version properly before. Sorry for that!

from gtfsrouter.

mpadge avatar mpadge commented on July 30, 2024

Whoops, closed the wrong issue with the commit which actually fixed this one. Anyway, thanks so much for uncovering what was actually a pretty huge 🐛, which the above commit should have fixed. Another instance of passing R stuff which uses 1-based indices (x[1] as first element) to C++ which uses 0-based indices (x[0] = first), without appropriately converting the indices.

from gtfsrouter.

AlexandraKapp avatar AlexandraKapp commented on July 30, 2024

I get the same result as you for this query: (#36 (comment)):

start_time <- 12 * 3600 + 1200 
end_time <- start_time + 1200 
ic <- gtfs_isochrone (gtfs, 
                      from = "Schönlein", 
                      start_time = start_time, 
                      end_time = end_time) 

ic$midpoints # returns 679

I get the error not for every query, but only for specific ones (I suppose the ones, that never find a starttime )
https://github.com/ATFutures/gtfs-router/blob/44f8e43df3dd85c7488e66e33e789967e021dcf6/src/csa-isochrone.cpp#L107

So e.g. for this query:

ic <- gtfs_isochrone(gtfs,  from = "Boxhagener Platz", start_time = 8*3600 + 5*60, end_time = 8*3600 + 10*60)

from gtfsrouter.

mpadge avatar mpadge commented on July 30, 2024

I see no errors:

library(gtfsrouter
gtfs <- extract_gtfs ("./VBB_gtfs.zip")
#> ▶ Unzipping GTFS archive
#> ✔ Unzipped GTFS archive
#> ▶ Extracting GTFS feed✔ Extracted GTFS feed 
#> ▶ Converting stop times to seconds✔ Converted stop times to seconds 
#> ▶ Converting transfer times to seconds✔ Converted transfer times to seconds
gtfs_cp <- data.table::copy (gtfs) # copy used below
gtfs <- gtfs_timetable (gtfs, day = 3)

start_time <- 8*3600 + 5*60
end_time <- 8*3600 + 10*60
from <- "Boxhagener Platz"
ic <- gtfs_isochrone (gtfs, 
                      from = from,
                      start_time = start_time, 
                      end_time = end_time) 
#> Loading required namespace: geodist
#> Loading required namespace: lwgeom
#> Registered S3 method overwritten by 'spatstat':
#>   method     from
#>   print.boxx cli 
#> Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1
ic$start_point
#> Simple feature collection with 1 feature and 2 fields
#> geometry type:  POINT
#> dimension:      XY
#> bbox:           xmin: 13.46097 ymin: 52.51104 xmax: 13.46097 ymax: 52.51104
#> geographic CRS: WGS 84
#>                  stop_name      stop_id                  geometry
#> 1 Berlin, Boxhagener Platz 070101006383 POINT (13.46097 52.51104)
nrow (ic$mid_points)
#> [1] 6
ic$mid_points
#> Simple feature collection with 6 features and 3 fields
#> geometry type:  POINT
#> dimension:      XY
#> bbox:           xmin: 13.44568 ymin: 52.50641 xmax: 13.46976 ymax: 52.51271
#> geographic CRS: WGS 84
#>                                 stop_name      stop_id earliest_arrival
#> 1                 Berlin, Simon-Dach-Str. 070101006384            29640
#> 2 Berlin, Grünberger Str./Warschauer Str. 070101005197            29760
#> 3                    Berlin, Wedekindstr. 070101005982            29820
#> 4                     Berlin, Wismarplatz 070101006472            29700
#> 5      Berlin, Boxhagener Str./Holteistr. 070101006247            29760
#> 6                Berlin, Neue Bahnhofstr. 070101006248            29820
#>                    geometry
#> 1 POINT (13.45677 52.51175)
#> 2  POINT (13.4524 52.51241)
#> 3 POINT (13.44568 52.51271)
#> 4  POINT (13.46368 52.5106)
#> 5  POINT (13.4663 52.50861)
#> 6 POINT (13.46976 52.50641)

# Then same thing using custom transfer table:
gtfs <- data.table::copy (gtfs_cp)
#transfers <- gtfs_transfer_table (gtfs, network_times = FALSE)
#saveRDS (transfers, "transfers.Rds")
transfers <- readRDS ("transfers.Rds")
gtfs$transfers <- transfers
gtfs <- gtfs_timetable (gtfs, day = 3)

ic <- gtfs_isochrone (gtfs, 
                      from = from,
                      start_time = start_time, 
                      end_time = end_time) 
nrow (ic$mid_points)
#> [1] 9
ic$mid_points
#> Simple feature collection with 9 features and 3 fields
#> geometry type:  POINT
#> dimension:      XY
#> bbox:           xmin: 13.44568 ymin: 52.50641 xmax: 13.46976 ymax: 52.51271
#> geographic CRS: WGS 84
#>                                 stop_name      stop_id earliest_arrival
#> 1                 Berlin, Simon-Dach-Str. 070101006384            29640
#> 2 Berlin, Grünberger Str./Warschauer Str. 070101005197            29760
#> 3 Berlin, Grünberger Str./Warschauer Str. 070301009072            29760
#> 4                 Berlin, Simon-Dach-Str. 070101006384            29640
#> 5 Berlin, Grünberger Str./Warschauer Str. 070101005197            29760
#> 6                    Berlin, Wedekindstr. 070101005982            29820
#> 7                     Berlin, Wismarplatz 070101006472            29700
#> 8      Berlin, Boxhagener Str./Holteistr. 070101006247            29760
#> 9                Berlin, Neue Bahnhofstr. 070101006248            29820
#>                    geometry
#> 1 POINT (13.45677 52.51175)
#> 2  POINT (13.4524 52.51241)
#> 3  POINT (13.4524 52.51241)
#> 4 POINT (13.45677 52.51175)
#> 5  POINT (13.4524 52.51241)
#> 6 POINT (13.44568 52.51271)
#> 7  POINT (13.46368 52.5106)
#> 8  POINT (13.4663 52.50861)
#> 9 POINT (13.46976 52.50641)

Created on 2020-08-17 by the reprex package (v0.3.0)

Back to where we were - could you please either paste exact reproducible code, or privately send me the feed and code if its too large? Thanks! (And that reprex uses the feed you previously sent me.)

from gtfsrouter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.