Comments (3)
Also, another problem is that fread
seems not to do well with tryCatch
. Check this:
gtfs <- read_gtfs("../msc-thesis/otp/graphs/rio/ola.zip")
#> Warning message:
#> In read_gtfs("../msc-thesis/otp/graphs/rio/ola.zip") :
#> Parsing failures while reading the following file(s): trips, stops
gtfs <- read_gtfs("../msc-thesis/otp/graphs/rio/ola.zip")
#> Error in utils::unzip(path, files = files_to_read, exdir = temp_dir, overwrite = TRUE) :
#> não foi possível abrir o arquivo 'C:/Users/Usuario/AppData/Local/Temp/RtmpqS6Xww/gtfsdir/stops.txt': Invalid argument
gtfs <- read_gtfs("../msc-thesis/otp/graphs/rio/ola.zip", "stop_times")
gtfs <- read_gtfs("../msc-thesis/otp/graphs/rio/ola.zip")
#> Warning message:
#> In read_gtfs("../msc-thesis/otp/graphs/rio/ola.zip") :
#> Parsing failures while reading the following file(s): trips, stops
I actually suppress a possible warning when reading the gtfs due to how the function is structured. If I remove these warning supression you can see that fread
does some cleaning after the "invalid argument" error.
gtfs <- read_gtfs("../msc-thesis/otp/graphs/rio/ola.zip")
#> Error in utils::unzip(path, files = files_to_read, exdir = temp_dir, overwrite = TRUE) :
#> não foi possível abrir o arquivo 'C:/Users/Usuario/AppData/Local/Temp/RtmpqS6Xww/gtfsdir/stops.txt': Invalid argument
gtfs <- read_gtfs("../msc-thesis/otp/graphs/rio/ola.zip", "stop_times")
#> Warning message:
#> In data.table::fread(file.path(temp_dir, file), nrows = 1) :
#> Previous fread() session was not cleaned up properly. Cleaned up ok at the beginning of this fread() call.
Related data.table issue: Rdatatable/data.table#2904
from gtfstools.
313e2ce changes read_gtfs
behaviour a bit. Parsing failures (actually, any warnings thrown by data.table::fread
, let's see how that scales up) now result in errors, instead of warnings, and read_gtfs
now consistently outputs a GTFS object, instead of eventual parsing failures messages.
I'll keep this issue open for a while still, let's see how this change ages.
from gtfstools.
This whole parsing-failure-detection ensemble is gonna get fixed in {gtfsio}
. Using withCallingHandlers()
instead of tryCatch()
does the trick.
from gtfstools.
Related Issues (20)
- Add `strategy` parameter to `frequencies_to_stop_times()` HOT 1
- Release gtfstools v1.1.0
- behavior of filter_by_sf with sf::st_crop HOT 2
- function to calculate `shape_dist_traveled` from shape geometry
- validate_gtfs() should also work with gtfs saved as directories
- write gtfs validation vignette
- new parameter `sort_sequence` to shape-related functions HOT 1
- error in `set_trip_speed()` HOT 10
- improving flexibility of filter_by_route_id HOT 1
- `filter_by_*` should take into account when `agency.txt` has only 1 agency and it's not listed in the other tables HOT 1
- Release gtfstools v1.2.0
- adapt `validate_gtfs()` and `merge_gtfs()` to start accepting other types of gtfs objects HOT 1
- New function stop_times_to_frequencies() HOT 4
- Extraction by route_type for extended route types HOT 6
- Foreign key violation after filter_by_sf() HOT 8
- Error when using get_trip_geometry() and get_trip_speed(): sfheaders - error indexing lines HOT 3
- After processing saves round shape_distances in exponential notation HOT 7
- function copy_gtfs_without_field HOT 1
- Deprecate `full_trips` in `filter_by_stop_id()` for v2.0.0
- Superseed `filter_by_sf()` with `filter_by_spatial_extent()` and create `crop_gtfs()` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gtfstools.