gtfstools v2.0.1
Bug fixes
- gtfstools functions now accept
dt_gtfsobjects whose tables were turned into tibbles, grouped data frames or plain data frames by other packages (e.g. afterdplyr::group_by()). Withby_reference = TRUE, an object with any such table now raises an informative error, since the edits can’t be made by reference on a converted copy: convert it first withas_dt_gtfs()(#130, reported by @baarthur, who also opened PR #132). - Several functions that involved estimating trip speed and duration would drop trips that cross midnight if GTFS input had times in 00:MM:SS, which disrespects the GTFS standard to report times as 24:MM:SS in such cases. This bug has been fixed. Now all functions that calculate or change durations and speeds now fix these times using a new function
fix_overnight_times()and return correct estimates for overnight trips. -
filter_by_weekday()now warns when the GTFS object has nocalendartable, instead of silently returning it unchanged. Its documentation now states that services defined only incalendar_datesare never related to a weekday (usefilter_by_date()to consider them). -
validate_gtfs()now raises an error whenn_threadsis not a whole number, as documented, instead of passing it to the validator.
New features
- New function
fix_overnight_times()rewrites the times of trips that run past midnight but are written as early morning times (e.g."00:30:00"instead of"24:30:00"), as required by the GTFS specification.fix_gtfs()now runs it before capping speeds and filling blank stop times, so these trips are no longer left with blank times. -
interpolate_stop_times()gainsoverwriteandkeep_dwell_times. Withoverwrite = TRUE, the times of every stop between the first and the last stop of each trip are replaced by interpolated ones, instead of only the blank ones. By default (keep_dwell_times = TRUE), these stops keep their original dwell times. -
fix_gtfs()gainsoverwrite_stop_times. Withoverwrite_stop_times = TRUE, the times of every stop between the first and the last stop of each trip are replaced by interpolated ones, keeping their dwell times, instead of only filling blank times (seeinterpolate_stop_times()). -
set_dwell_time()gainsstrategy. The default,"shift_trip_end", shifts the later times of the trips, as before."keep_total_duration"splits the change around each intermediate stop, keeping the trip durations.
gtfstools 2.0.0
CRAN release: 2026-10-28
Breaking changes
- With
prefix = FALSE, the default,merge_gtfs()now keeps rows that are identical in every column only once and raises an error when the GTFS objects share ids whose data differ (e.g. astop_idwith different coordinates, or atrip_idwith differentstop_times), which used to produce inconsistent feeds. Merging a feed with itself now works, but merging versions of the same feed, or feeds with simple ids (e.g. both with anagency_id"1"), usually raises the error: useprefix = TRUE. A characterprefixmust now have unique elements. -
filter_by_sf()and thefull_tripsargument offilter_by_stop_id(), deprecated in version 1.3.0, are now defunct. Usefilter_by_spatial_extent(), which takes the same arguments.filter_by_stop_id()now always keeps only thestop_timesentries at the given stops (by default, it used to keep entire trips): to keep entire trips, pass thetrip_ids that serve the stops tofilter_by_trip_id()(#75). -
get_trip_length()now measures each trip from its first to its last stop, instead of along its entire shape, so lengths are usually shorter, and the speeds ofget_trip_speed()andset_trip_speed()slightly lower. Likewise,get_trip_geometry()now returns, by default, the part of the shape between the first and last stops. These functions now require thestopstable (andget_trip_length()andget_trip_geometry()alsostop_times). Use the newget_shape_length()andget_shapes_geometry()for entire shapes. -
get_trip_geometry(),get_trip_length()andget_trip_speed()now return one result per trip, without theorigin_filecolumn. Their newmethodargument (andby, in the last two) comes right aftertrip_id, sounitandfilemust be passed by name.get_trip_speed()also returnsroute_idas its first column, and so requires thetripstable. - The
by_referenceargument ofset_trip_speed()must now be passed by name (#89).
Feature deprecation
-
convert_shapes_to_sf()andconvert_stops_to_sf()are deprecated in favour ofget_shapes_geometry()andget_stops_geometry(), which take the same arguments (exceptsort_sequence) and return the same results. - The
fileargument ofget_trip_geometry(),get_trip_length()andget_trip_speed()is deprecated in favour ofmethod(file = "stop_times"ismethod = "euclidean").
New features
- New functions to query feeds:
-
get_summary()summarises a feed (files, agencies, service calendar, totals including the vehicle-kilometres travelled, and the distributions of trip speeds, trip lengths and route headways), optionally restricted to some dates, routes, modes, agencies and a time of day, as a list ofdata.tables and an HTML report (requires ggplot2, knitr, rmarkdown and Pandoc).by_route_type = TRUEbreaks results down by transport mode (#127), andunit = "mph"reports miles and mph. -
get_vkt()andget_vmt()return the vehicle-kilometres (or vehicle-miles) travelled by each route, counting every departure (including those infrequencies) on every day its service runs, optionally restricted to some dates and a time of day. -
get_route_frequency()andget_stop_frequency()return the number of departures and the mean headway of each route and at each stop within a time of day (#53). -
get_route_speed()returns the minimum, mean, median, maximum and standard deviation of the trip speeds of each route. -
get_route_geometry()returns the distinct trip geometries of each route (e.g. each direction and short-turn service), with the number of trips that follow each. -
get_shape_length(),get_shapes_geometry()andget_stops_geometry()return the length of each shape and the shapes and stops assfobjects. -
get_stops()andget_stop_distances()return the stops visited by the given trips and/or routes and the great-circle distances between each pair of them. -
get_dates(),get_active_services()andget_start_and_end_times()return the dates with service, the services active on given dates, and the earliest departure and latest arrival times. -
get_stop_timetable()andget_route_timetable()return the timetables of stops and routes on given dates. -
get_dwell_time()returns how long vehicles stay at stops, optionally within a time of day. -
get_calendar_overlap()returns the number of trips each feed runs on each service day and whether all feeds have service on it (or, withresolution = "periods", the periods in which all of them do), to pick a date on which several feeds can be analysed together.plot = TRUEplots the result (requires ggplot2). See the new vignette “Checking the calendar overlap of GTFS feeds” (#85). Thanks @higgicd for the suggestion and the originalcheck_gtfs_overlap()code.
-
- New functions to edit feeds:
-
set_route_frequency()sets the headway of routes within a time of day, replacing their trips in it with a frequency-based template trip. Departures outside the time of day don’t change. -
set_route_speed()sets the average speed of all trips of the given routes, asset_trip_speed()does for trips. -
set_dwell_time(),set_min_dwell_time(),set_max_speed()andset_min_speed()set dwell times, raise dwell times at intermediate stops to a minimum, and cap or raise trip speeds to a maximum or minimum, shifting the later times of each trip accordingly. The dwell times can be set within a time of day, and speeds changed only between two stops or for trips departing within a time of day, as inset_trip_speed(). Likeset_trip_speed()andset_route_speed(), they andset_route_frequency()can be restricted to some transport modes withroute_type. -
interpolate_stop_times()fills blank arrival and departure times, assuming a constant speed between stops with known times. -
interpolate_shape_dist_traveled()(re)calculatesshape_dist_traveledinstop_timesandshapes, in meters. -
stop_times_to_frequencies(), the counterpart offrequencies_to_stop_times(), approximates scheduled trips by frequency-based ones (#69). -
convert_stops_to_shapes()creates straight-line shapes between consecutive stops for trips without a usable shape. -
combine_nearby_stops()combines the stops within a given distance of each other (after merging platforms into their stations), updating every file that refers to them. Entrances, generic nodes, boarding areas andpathwaysare removed. -
crop_gtfs()crops a feed to a spatial extent. Unlikefilter_by_spatial_extent(), which keeps entire trips, it cuts the trips that leave the extent (interpolating blank times at their new ends and shifting theirfrequencies) and, by default, trims their shapes (#44). Thanks @luukvdmeer for the proposal and discussion. -
remove_unused_ids()removes unused ids from all files (#55). -
fix_gtfs()cleans a feed in one call: it removes duplicated rows and unused ids, interpolates blank stop times, recalculatesshape_dist_traveledin feeds with shapes, and optionally caps trip speeds and sets a minimum dwell time.
-
- New function
build_graph(), which builds a frequency-based transit network from the trips departing within a time of day, as General Modeling Network Specification (GMNS) tables or as an igraph or tidygraph graph, with in-vehicle, boarding, alighting and walking transfer links. See the new vignette “Building transit network graphs”. - New functions
filter_by_date()andfilter_by_period(), which keep the services that run on given dates or in a period. By default (trim = TRUE),filter_by_period()trims the calendars to the period. - New function
convert_seconds_to_time(), the counterpart ofconvert_time_to_seconds(). - New function
list_validator_versions(). PR contribution by @baarthur. -
get_trip_length()andget_trip_speed()gain thebyargument, to calculate lengths and speeds between consecutive stops. They andget_trip_geometry()gain themethodargument, to measure along shapes or along straight lines between stops, and, without shapes, now fall back to straight lines with a warning instead of an error. -
set_trip_speed()gainsfirst_stop,last_stop,fromandto, to change speeds only between two stops and for trips departing within a time of day (#89), androute_type, sotrip_idis now optional. -
get_trip_speed()andset_trip_speed()acceptunit = "mph". -
get_trip_speed(),get_route_speed(),get_trip_duration(),get_trip_length()andget_trip_segment_duration()gainfromandto, as inget_dwell_time(), to include only the trips (or segments) that depart within a time of day. -
frequencies_to_stop_times()gainsstrategy, to shift departures by half the headway or by a random offset (#56). -
write_gtfs()gainscompression_level. Its default, 6 (previously always 9), makes writing about 2 to 3 times faster, with files of very similar size. - The
pathargument ofdownload_validator()now defaults totempdir(). - New vignettes “Editing GTFS feeds”, “Querying GTFS feeds” and “Mapping GTFS feeds”.
Bug fixes
-
merge_gtfs():- no longer prefixes ids with
"NA_"when the GTFS objects are passed with names (e.g.merge_gtfs(a = gtfs1, b = gtfs2, prefix = TRUE)); - no longer prefixes the
field_valueandrecord_sub_idcolumns oftranslations, no longer errors with character columns of unknown type, and keeps parent station ids. PR contributions by @gmatosferreira and @haneroglu.
- no longer prefixes ids with
-
merge_gtfs()andremove_duplicates()no longer corrupt elements that are not tables, such as thelocationsof GTFS-Flex feeds (merge_gtfs()leaves them out, with a warning). -
download_validator()andlist_validator_versions()now fail gracefully on network problems, as CRAN requires: they retry transient failures and then inform with a message (classgtfstools_validator_download_failure) and invisibly returnNULL, instead of raising an error (download_validator()used to raise a misleading “invalid URL” one). A version that doesn’t exist raises an error of classgtfstools_invalid_validator_version. -
download_validator()downloads the validator once instead of twice, doesn’t go online when an explicitversionis already inpath, and shows a progress bar withquiet = FALSE.list_validator_versions()returns its result visibly. -
get_trip_duration(),get_trip_segment_duration(),filter_by_time_of_day(),filter_by_stop_id()andfrequencies_to_stop_times()no longer add temporary columns to the tables of the given feed. - The
filter_by_*()functions no longer drop:- rows whose blank keys mean “applies to all”: zone
fare_ruleswithoutroute_id,transferswithoutfrom_stop_id/to_stop_idandattributionswithoutagency_id; - the
agencyof single-agency feeds whoseroutes.agency_idis blank or absent; - the station entrances, generic nodes and boarding areas of kept stations and platforms, with their pathways and levels;
- every
fare_attributesentry of feeds withoutfare_rules. In multi-agency feeds, they keep the fares of the agencies whose routes were kept, and those without an agency.
- rows whose blank keys mean “applies to all”: zone
-
filter_by_agency_id()now keeps thefare_attributeswithout anagency_id. -
filter_by_trip_id(),filter_by_service_id(),filter_by_shape_id()and the functions built on them no longer keepfare_attributes(and their agencies) whosefare_ruleswere all dropped by zone. -
filter_by_route_id()andfilter_by_route_type()filteredfare_rulesbylevel_idinstead ofroute_id. -
filter_by_time_of_day():- with
keep = TRUE, sets theend_timeoffrequenciesentries that crosstoto one second after it, sofrequencies_to_stop_times()no longer loses a departure atto; - keeps
frequenciesentries that start exactly atto(this also affectsget_summary()); - with
keep = FALSE, drops a departure atto, and removes entries left without departures; - updates the
start_timeoffrequenciesentries with a blankexact_times, and no longer returns frequency-based trips whose entries were all filtered out; - with
keep = FALSEandfull_trips = TRUE, no longer drops every trip with an untimed stop; - rejects
from/towith minutes or seconds of 60 or more; - no longer modifies the
frequenciestable of the given feed when all of its entries are selected.
- with
-
filter_by_spatial_extent()no longer errors when stops have missing coordinates, drops every selected trip withkeep = FALSE, no longer keeps unused shapes nor removes duplicated rows, and treats abboxas a rectangle in longitude and latitude, instead of a slightly larger polygon with curved edges. It no longer acceptssf::st_equals_exact()andsf::st_is_within_distance()asspatial_operation, since they always failed. -
frequencies_to_stop_times()treatsend_timeas exclusive, as the GTFS specification requires (from 08:00 to 09:00 every 30 minutes now yields 08:00 and 08:30 only), and sets arrivals that a dwell time at the first stop would put before 00:00:00 to 00:00:00, instead of raising an error. - Malformed times (e.g.
"5:30","12:60:00") and non-ASCII strings marked as"bytes"are converted toNAwith a warning, instead of wrong values or an error.convert_time_to_seconds()no longer skipsarrival_timeandend_timewhen only one column of a pair is present. -
get_stop_times_patterns()no longer ignores stop timing in the spatiotemporal patterns of trips with blank stop times, and no longer merges different stop sequences whosestop_ids contain;or|. -
set_trip_speed()identifies the first stop of each trip bystop_sequenceinstead of row position, keeps existing*_secscolumns in sync, and raises an error whenspeedis zero, negative or infinite, or when a trip is given different speeds. -
get_trip_duration()returnsNAwith a warning (also raised byget_trip_speed()) for trips without any arrival or departure time, instead of-Infor an error. - Functions that measure trips along shapes raise an informative error when a used shape has a blank
shape_id.get_trip_length(),get_trip_speed()andget_trip_geometry()ignorestop_timesentries with a missing or blanktrip_id, which used to shift the segments of other trips withby = "segment". -
get_children_stops()no longer returnsNArows for stops without aparent_station. -
read_gtfs()no longer keeps doubled quotes inside quoted text fields, andwrite_gtfs()always writes UTF-8, also for feeds read withencoding = "Latin-1". -
as_dt_gtfs()no longer turnsDatefields intoNA, and converts the date fields of lists toDate. - The documentation of
filter_by_stop_id()now says that it keeps (or drops) thestop_timesentries at the given stops, not entire trips. -
convert_shapes_to_sf(),get_trip_geometry(),get_trip_length(),get_trip_speed(),get_trip_segment_duration()andget_stop_times_patterns()now always ordershapesandstop_timesbyshape_pt_sequence/stop_sequence, which are therefore required. Results only change for feeds not ordered by these columns, which were previously wrong. Theirsort_sequenceargument is deprecated:TRUEraises a warning andFALSEan error (#94).
Notes
-
Many functions are faster. The table below shows how many times faster than in version 1.4.0 each function of that version is, on the example feeds
poaandspostacked twice withmerge_gtfs()(up to 46,000stop_timesrows), with the default number of threads. Values below 1 mean slower, and ~1 a difference under 1.2 times (measurement noise); functions not listed are ~1 on both feeds, exceptget_children_stops()andget_parent_station()(the feeds have noparent_station),validate_gtfs()anddownload_validator(), which were not measured.poahas nofrequencies. Functions marked with † now do different work (see “Breaking changes”):merge_gtfs()checks the ids shared by the GTFS objects (withprefix = TRUE, it is 1.2 to 1.8 times faster), andget_trip_geometry()cuts shapes at the trips’ first and last stops. On these small feeds, fixed costs dominate:as_dt_gtfs()now converts integer dates (about 1 to 2 milliseconds),filter_by_trip_id()andfilter_by_weekday()take about 7 milliseconds more, and the deprecatedconvert_shapes_to_sf()andconvert_stops_to_sf()raise a warning, while their replacements,get_shapes_geometry()andget_stops_geometry(), are about as fast as they were.function n times faster on poa n times faster on spo as_dt_gtfs()0.3 0.7 convert_sf_to_shapes()11 65 convert_shapes_to_sf()0.1 0.4 convert_stops_to_sf()0.2 0.4 convert_time_to_seconds()3.1 1.7 filter_by_agency_id()~1 1.3 filter_by_route_id()~1 3.3 filter_by_route_type()~1 2.5 filter_by_shape_id()0.7 1.3 filter_by_spatial_extent()2.5 3.1 filter_by_stop_id()3.6 3.0 filter_by_time_of_day()1.4 1.7 filter_by_trip_id()0.6 0.6 filter_by_weekday()0.7 0.7 frequencies_to_stop_times()– 12 get_stop_times_patterns()1.4 ~1 get_trip_duration()3.1 ~1 get_trip_geometry()†0.8 ~1 get_trip_length()†1.9 ~1 get_trip_segment_duration()64 7.9 get_trip_speed()†1.4 ~1 merge_gtfs()†0.1 0.1 read_gtfs()1.4 1.8 set_trip_speed()†1.4 ~1 write_gtfs()1.2 2.4 Most gains grow with feed size: on a feed with 900,000
stop_timesrows,convert_time_to_seconds()is about 20 times faster,filter_by_spatial_extent()25 times,filter_by_time_of_day()7 times, andget_trip_segment_duration()andget_trip_duration()(whenunitisn’t"s") 60 and 10 times.merge_gtfs()withprefixis about 2.3 times faster with 1.15 millionstop_timesrows,get_children_stops()about 250 times faster with 20,000 stops, andread_gtfs()is much faster on feeds with largecalendar_datestables. get_trip_length(),get_trip_geometry(),get_shape_length(),get_stop_distances()and the functions that use them run their C++ code in parallel, withdata.table::getDTthreads()threads (set withdata.table::setDTthreads()), or on a single thread where the compiler doesn’t support OpenMP. Results don’t depend on the number of threads.Trip lengths are always calculated on the s2 sphere, regardless of
sf::sf_use_s2().convert_sf_to_shapes()also calculates distances on that sphere: they match the previous ones within a micrometre withsf::sf_use_s2(TRUE)(the default), and differ by up to about 0.4% from the ellipsoidal ones previously calculated withsf::sf_use_s2(FALSE).gtfstools no longer depends on units (#84).
set_trip_speed()now converts speeds in m/s or mph with exact factors, so in rare borderline cases a new time may be one second earlier than in version 1.4.0.download_validator()detects the latest validator version automatically. PR contribution by @baarthur.Invalid dates (e.g.
20240230) are still converted toNA, but now with a warning.frequencies_to_stop_times()raises informative errors for invalidfrequenciesentries and trips without adeparture_time.The warnings about
route_ids,trip_ids andstop_ids not found in a feed (classesgtfstools_invalid_route_id,gtfstools_invalid_trip_idandgtfstools_invalid_stop_id) list each missing id once.The documentation website moved to https://ipea.github.io/gtfstools/ and the GitHub repository to https://github.com/ipea/gtfstools.
gtfstools 1.4.0
CRAN release: 2025-01-08
New features
-
download_validator()andvalidate_gtfs()now support using validator v5.0.0, v5.0.1 and v6.0.0.
Notes
- Removed the local copies of cpp11 functions, as the most recent releases fix the issues we were having.
gtfstools 1.3.0
CRAN release: 2024-10-07
New features
- New function
convert_sf_to_shapes(). - New generic function
as_dt_gtfs()with methods for a few different classes (tidygtfs,gtfsandlist). - gtfstools functions now accepts GTFS objects created by other packages, such as gtfsio and tidytransit.
-
filter_by_route_type()now accepts Google Transit’s extended route types. Thanks @Ge-Rag. -
convert_shapes_to_sf(),get_trip_geometry(),get_trip_length(),get_trip_speed(),get_trip_segment_duration()andget_stop_times_patterns()now take an additional argumentsort_sequence, used to indicate whether shapes/timetables should be ordered byshape_pt_sequence/stop_sequencewhen applying the functions’ procedures. -
download_validator()andvalidate_gtfs()now support using validator v4.1.0 and v4.2.0. - New parameters to
filter_by_stop_id():include_childrenandinclude_parents.
Bug fixes
- Fixed a bug in
convert_to_standard()in which the date fields fromfeed_infowould not be converted back to an integer in their standard format (YYYYMMDD). - Filtering functions now also filter the
transferstable based ontrip_idandroute_id. Previously they would filter it based only onstop_id. Thanks Daniel Langbein (@langbein-daniel). - Fixed a bug in
filter_by_route_id()in which feeds with only one agency that omittedagency_idinroutesandfare_attributeswould end up with an emptyagencytable. -
filter_by_sf()now correctly throws an error when an unsupported function is passed tospatial_operation.
Feature deprecation
- The
filter_by_stop_id()behavior of filtering by trips that contain the specified stops has been deprecated. For backwards compatibility reasons, this behavior is still the default as of the current version and is controlled by the parameterfull_trips. To actually filter by stop ids (the behavior that we now believe is the most appropriate), please usefull_trips = FALSE. This behavior will be the default from version 2.0.0 onward. To achieve the old behavior, manually subset the stop_times table bystop_idand specify thetrip_ids included in the output infilter_by_trip_id(). -
filter_by_sf()has been deprecated in favor offilter_by_spatial_extent(). For backwards compatibility reasons, usage offilter_by_sf()is still allowed as of the current version, but the function will be removed from the package in version 2.0.0.
Notes
-
validate_gtfs()now defaults to run sequentially. Previously it would default to run parallelly using all available cores. Heavily inspired by Henrik Bengtsson post “Please Avoid detectCores() in your R packages” (https://www.jottr.org/2022/12/05/avoid-detectcores/). - Improved performance of
seconds_to_string()and, consequently, any other functions that use it. - Improved performance and improved readability of most filtering functions.
gtfstools 1.2.0
CRAN release: 2022-11-24
New features
- New
validate_gtfs()behavior. Now used to run MobilityData Canonical GTFS validator with a feed. The old behavior was marked as deprecated since v1.0.0. - New function
download_validator(). - New vignette demonstrating how to validate feeds.
Bug fixes
- Fixed a bug in
write_gtfs()that preventedas_dir = TRUEto be used. - Fixed a bug in
set_trip_speed()that resulted in invalid stop_times tables whenmax(stop_sequence)was higher than the number of stops of a given trip. Thanks Alena Stern (@alenastern). - Fixed a bug in
set_trip_speed()that resulted in the speed of wrong trip_ids being updated because of the order that these ids would appear in the trips and stop_times tables. Thanks Alena Stern (@alenastern).
gtfstools 1.1.0
CRAN release: 2022-05-24
New features
- New function
convert_time_to_seconds(). - New function
filter_by_agency_id(). - New function
filter_by_service_id(). - New function
filter_by_time_of_day(). - New function
filter_by_weekday(). - New function
frequencies_to_stop_times(). - New function
get_children_stops(). - New function
get_stop_times_patterns(). - New function
get_trip_length(). - New parameter to
merge_gtfs():prefix. Thewarningsparameter was flagged as deprecated. - Functions
get_parent_station()andget_children_stopsnow acceptstop_id = NULLto analyze allstop_ids in thestopstable.
Bug fixes
- Fixed a bug in which
get_trip_segment_duration()would list wrong segment numbers, not necessarily starting from 1. Now segment numbers always range from 1 to N, where N is the total number of segments that compose each trip. - Fixed a bug in
filter_by_{route,service,shape,trip}_id()that resulted in theagencytable not getting filtered when the specified id wascharacter(0).
Notes
- Performance improvements to
get_trip_geometry(),get_trip_duration(),get_trip_segment_duration()andconvert_shapes_to_sf(). - Stopped ordering points by
shape_pt_sequence/stop_sequenceinget_trip_geometry()andconvert_shapes_to_sf(), since the GTFS reference says that thestop_timesandshapestables must be ordered by point/stop sequence anyway. - Removed lwgeom from dependencies (Suggests), now that it’s not required to run
get_trip_speed()andset_trip_speed()anymore. - Removed the
warningsparameter fromread_gtfs()andwrite_gtfs()and theoptionalandextraparameters fromwrite_gtfs(), flagged as deprecated on gtfstools v1.0.0. - Updated filtering vignette to demonstrate new functions.
gtfstools 1.0.0
CRAN release: 2021-11-16
New features
- New function
convert_stops_to_sf(). - New function
convert_shapes_to_sf(). - New function
filter_by_route_type(). - New function
filter_by_route_id(). - New function
filter_by_sf(). - New function
filter_by_shape_id(). - New function
filter_by_stop_id(). - New function
filter_by_trip_id(). - New function
get_parent_station(). - New function
remove_duplicates(). - New parameters to
read_gtfs():fields,skipandencoding. Thewarningsparameter was flagged as deprecated. - New parameters to
write_gtfs():files,standard_onlyandas_dir. They substitute the previously existentoptionalandextra, which were flagged as deprecated. Thewarningsparameter was flagged as deprecated too. - New vignette exploring the filtering functions.
Bug fixes
-
get_trip_speed()andset_trip_speed()examples and tests now only run if lwgeom is installed. lwgeom is an sf “soft” dependency required by these functions, and is listed inSuggests. However, package checks would fail not so gracefully if it wasn’t installed, which is now fixed. - Fixed a bug in which the
crspassed toget_trip_geometry()would be assigned to the result without actually reprojecting it. - Changed the behaviour of
get_trip_geometry()to not raise an error when the ‘file’ parameter is left untouched and the GTFS object doesn’t contain either the shapes or the stop_times table. Closes #29. - Fixed a bug that would cause
merge_gtfs()to create objects that inherited only fromdt_gtfs(ignoringgtfsandlist). - Fixed a bug in which
get_trip_speed()returnedNAspeeds if the specifiedtrip_idwas listed in trips, but not in stop_times. - Adjusted
set_trip_speed()to stop raising amax()-related warning when none of the specifiedtrip_ids exists.
Notes
- Some utility functions previously provided by
{gtfs2gps}will now be exported by gtfstools. Huge thanks to the whole gtfs2gps crew (Rafael Pereira @rafapereirabr, Pedro Andrade @pedro-andrade-inpe and João Bazzo @Joaobazzo)! - The package now imports gtfsio, and many functions now heavily rely on it, such as
read_gtfs()andwrite_gtfs(). - Internal function
string_to_seconds()now runs much faster thanks to Mark Padgham (@mpadge). -
get_trip_geometry()now runs much faster due todata.table-related optimizations.
Potentially breaking changes
- Functions no longer validate GTFS objects on usage.
validate_gtfs()will be flagged as deprecated as well, since I plan to heavily change its usability and outputs in future versions. -
write_gtfs()parameters went through major changes - theoptionalandextraparams were flagged as deprecated and substituted by the more generalfilesandstandard_only.
