diff --git a/404.html b/404.html index 57814bbc..a7d64947 100644 --- a/404.html +++ b/404.html @@ -6,13 +6,7 @@ Page not found (404) • gtfstools - - - - - - - + @@ -25,7 +19,7 @@ - +
@@ -54,7 +48,7 @@
- +
@@ -113,16 +107,16 @@

Page not found (404)

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/LICENSE-text.html b/LICENSE-text.html index 47c8022d..6fd3dd0f 100644 --- a/LICENSE-text.html +++ b/LICENSE-text.html @@ -1,9 +1,9 @@ -License • gtfstoolsLicense • gtfstools - +
@@ -31,7 +31,7 @@
- +
@@ -62,7 +62,7 @@

License

-
YEAR: 2021
+
YEAR: 2023
 COPYRIGHT HOLDER: Ipea
 
@@ -81,15 +81,15 @@

License

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/apple-touch-icon-120x120.png b/apple-touch-icon-120x120.png deleted file mode 100644 index 847ef305..00000000 Binary files a/apple-touch-icon-120x120.png and /dev/null differ diff --git a/apple-touch-icon-152x152.png b/apple-touch-icon-152x152.png deleted file mode 100644 index 7c26a7e1..00000000 Binary files a/apple-touch-icon-152x152.png and /dev/null differ diff --git a/apple-touch-icon-180x180.png b/apple-touch-icon-180x180.png deleted file mode 100644 index 3d0383a8..00000000 Binary files a/apple-touch-icon-180x180.png and /dev/null differ diff --git a/apple-touch-icon-60x60.png b/apple-touch-icon-60x60.png deleted file mode 100644 index a7569a0a..00000000 Binary files a/apple-touch-icon-60x60.png and /dev/null differ diff --git a/apple-touch-icon-76x76.png b/apple-touch-icon-76x76.png deleted file mode 100644 index bbaf752d..00000000 Binary files a/apple-touch-icon-76x76.png and /dev/null differ diff --git a/apple-touch-icon.png b/apple-touch-icon.png deleted file mode 100644 index f99e98ca..00000000 Binary files a/apple-touch-icon.png and /dev/null differ diff --git a/articles/filtering.html b/articles/filtering.html index c76b876f..b3e77e2d 100644 --- a/articles/filtering.html +++ b/articles/filtering.html @@ -6,27 +6,19 @@ Filtering GTFS feeds • gtfstools - - - - - - - + - - - +
@@ -55,7 +47,7 @@
- -
+ +
-

GTFS feeds are often used to describe very large and complex public transport networks. These large files can become quite cumbersome to use, manipulate and move around, and it’s not unfrequent that one wants to analyze a specific subset of the data.

-

gtfstools includes a few functions to filter GTFS feeds, thus allowing for faster and more convenient data processing. The filtering functions currently available are:

+

GTFS feeds are often used to describe very large and complex public +transport networks. These large files can become quite cumbersome to +use, manipulate and move around, and it’s not unfrequent that one wants +to analyze a specific subset of the data.

+

gtfstools includes a few functions to filter GTFS +feeds, thus allowing for faster and more convenient data processing. The +filtering functions currently available are:

-

This vignette will introduce you to these functions and will cover their usage in detail.

-

We will start by loading the packages required by this demonstration into the current R session:

+

This vignette will introduce you to these functions and will cover +their usage in detail.

+

We will start by loading the packages required by this demonstration +into the current R session:

-

Filtering by agency_id, route_id, service_id, shape_id, stop_id, trip_id or route_type: +

Filtering by agency_id, route_id, +service_id, shape_id, stop_id, +trip_id or route_type:

-

The first six work in a very similar fashion. You specify a vector of identifiers, and the function keeps (or drops, as we’ll see soon) all the entries that are in any way related to this id. Let’s see how that works using filter_by_trip_id():

+

The first six work in a very similar fashion. You specify a vector of +identifiers, and the function keeps (or drops, as we’ll see soon) all +the entries that are in any way related to this id. Let’s see how that +works using filter_by_trip_id():

 path <- system.file("extdata/spo_gtfs.zip", package = "gtfstools")
 gtfs <- read_gtfs(path)
@@ -153,8 +157,17 @@ 

unique(smaller_gtfs$shapes$shape_id) #> [1] "17846" "17847"

-

We can see from the code snippet above that the function not only filters the trips table, but all other tables that contain a key that can be identified via its relation to trip_id. For example, since the trips CPTM L07-0 and CPTM L07-1 are described by the shapes 17846 and 17847, respectively, these are the only shapes kept in smaller_gtfs.

-

The function also supports the opposite behaviour: instead of keeping the entries related to the specified identifiers, you can drop them. To do that, set the keep argument to FALSE:

+

We can see from the code snippet above that the function not only +filters the trips table, but all other tables that contain +a key that can be identified via its relation to trip_id. +For example, since the trips CPTM L07-0 and +CPTM L07-1 are described by the shapes 17846 +and 17847, respectively, these are the only shapes kept in +smaller_gtfs.

+

The function also supports the opposite behaviour: instead of keeping +the entries related to the specified identifiers, you can drop +them. To do that, set the keep argument to +FALSE:

 # dropping trips CPTM L07-0 and CPTM L07-1
 smaller_gtfs <- filter_by_trip_id(
@@ -177,14 +190,26 @@ 

head(unique(smaller_gtfs$shapes$shape_id)) #> [1] "17848" "17849" "17850" "17851" "17852" "17853"

-

And the specified trips (and their respective shapes as well) are nowhere to be seen. Please note that, since we are keeping many more entries in the second case, the resulting GTFS object, though smaller than the original, is much larger than in the first case.

-

The same logic demonstrated with filter_by_trip_id() applies to the functions that filter feeds by agency_id, route_id, service_id, shape_id, stop_id and route_type.

+

And the specified trips (and their respective shapes as well) are +nowhere to be seen. Please note that, since we are keeping many more +entries in the second case, the resulting GTFS object, though smaller +than the original, is much larger than in the first case.

+

The same logic demonstrated with filter_by_trip_id() +applies to the functions that filter feeds by agency_id, +route_id, service_id, shape_id, +stop_id and route_type.

Filtering by day of the week or time of the day:

-

Frequently enough one wants to analyze service levels on certain days of the week or during different times of the day. The functions filter_by_weekday() and filter_by_time_of_day() can be used to this purpose.

-

The first one takes the days of the week you want to keep/drop and also includes a combine argument that controls how multi-day filters work. Let’s see how that works with a few examples:

+

Frequently enough one wants to analyze service levels on certain days +of the week or during different times of the day. The functions +filter_by_weekday() and +filter_by_time_of_day() can be used to this purpose.

+

The first one takes the days of the week you want to keep/drop and +also includes a combine argument that controls how +multi-day filters work. Let’s see how that works with a few +examples:

 # keeping entries related to services than run on saturdays AND sundays
 smaller_gtfs <- filter_by_weekday(
@@ -252,7 +277,18 @@ 

Filtering by day of the #> <char> <int> <int> #> 1: U__ 0 0 #> 2: U__ 0 0

-

Meanwhile, filter_by_time_of_day() takes the beginning and the end of a time block (the from and to arguments, respectively) and keeps the entries related to trips that run within the specified block. Please note that the function works a bit differently depending on whether a trip’s behaviour is described using the frequencies and the stop_times tables together or using the stop_times table alone: the stop_times entries of trips described in frequencies should not be filtered, because they are just “templates” that describe how long it takes from one stop to another (i.e. the departure and arrival times listed there should not be considered “as is”). Let’s see what that means with an example:

+

Meanwhile, filter_by_time_of_day() takes the beginning +and the end of a time block (the from and to +arguments, respectively) and keeps the entries related to trips that run +within the specified block. Please note that the function works a bit +differently depending on whether a trip’s behaviour is described using +the frequencies and the stop_times tables +together or using the stop_times table alone: the +stop_times entries of trips described in +frequencies should not be filtered, because they are just +“templates” that describe how long it takes from one stop to another +(i.e. the departure and arrival times listed there should not be +considered “as is”). Let’s see what that means with an example:

 smaller_gtfs <- filter_by_time_of_day(gtfs, from = "05:00:00", to = "06:00:00")
 
@@ -293,7 +329,11 @@ 

Filtering by day of the #> 4: CPTM L07-0 05:28:00 05:28:00 #> 5: CPTM L07-0 05:36:00 05:36:00 #> 6: CPTM L07-0 05:44:00 05:44:00

-

When filtering the stop_times table, we have two options. We either keep entire trips that cross the specified time block, or we keep only the trip segments within this block (default behaviour). To control this behaviour you can use the full_trips parameter:

+

When filtering the stop_times table, we have two +options. We either keep entire trips that cross the specified time +block, or we keep only the trip segments within this block (default +behaviour). To control this behaviour you can use the +full_trips parameter:

 smaller_gtfs <- filter_by_time_of_day(
     gtfs,
@@ -332,12 +372,26 @@ 

Filtering by day of the #> 4: CPTM L09-0 04:09:00 04:09:00 #> 5: CPTM L09-0 04:12:00 04:12:00 #> 6: CPTM L09-0 04:15:00 04:15:00

-

filter_by_time_of_day() also includes a update_frequencies argument, used to control whether the frequencies table should have its start_time and end_time fields updated to fit inside/outside the specified time of day. Please read the function documentation to understand how this argument interacts with the exact_times field.

+

filter_by_time_of_day() also includes a +update_frequencies argument, used to control whether the +frequencies table should have its start_time +and end_time fields updated to fit inside/outside the +specified time of day. Please read the function documentation to +understand how this argument interacts with the exact_times +field.

Filtering using a spatial extent

-

It’s not uncommon that one wants to analyze only the transit services of a smaller region contained inside a feed. The filter_by_sf() function allows you to filter GTFS data using a given spatial extent. This functions takes a spatial sf/sfc object (or its bounding box) and keeps/drops the entries related to shapes and trips selected via a specified spatial operation. It may sound a bit complicated, but it’s fairly easy to understand when shown. Let’s create an auxiliary function to save us some typing:

+

It’s not uncommon that one wants to analyze only the transit services +of a smaller region contained inside a feed. The +filter_by_sf() function allows you to filter GTFS data +using a given spatial extent. This functions takes a spatial +sf/sfc object (or its bounding box) and +keeps/drops the entries related to shapes and trips selected via a +specified spatial operation. It may sound a bit complicated, but it’s +fairly easy to understand when shown. Let’s create an auxiliary function +to save us some typing:

 plotter <- function(gtfs,
                     geom,
@@ -359,43 +413,78 @@ 

Filtering using a spatial extent}

This function:

-

Also, please note that our plotter() function takes the same arguments of filter_by_sf() (with the exception of do_filter, which is used to show the unfiltered data), as well as the same defaults.

-

Let’s say that we want to filter GTFS data using the bounding box of the shape 68962. Here’s how the unfiltered data looks like, with the bounding box placed on top of it.

+

Also, please note that our plotter() function takes the +same arguments of filter_by_sf() (with the exception of +do_filter, which is used to show the unfiltered data), as +well as the same defaults.

+

Let’s say that we want to filter GTFS data using the bounding box of +the shape 68962. Here’s how the unfiltered data looks like, +with the bounding box placed on top of it.

 bbox <- sf::st_bbox(convert_shapes_to_sf(gtfs, shape_id = "68962"))
 
 plotter(gtfs, bbox, do_filter = FALSE)

-

By default filter_by_sf() (and plotter(), consequently) keeps all the data related to the trips and shapes that intersect the given geometry. Here’s how it looks like:

+

By default filter_by_sf() (and plotter(), +consequently) keeps all the data related to the trips and shapes that +intersect the given geometry. Here’s how it looks like:

-plotter(gtfs, bbox)
+plotter(gtfs, bbox) +#> Warning: `filter_by_sf()` was deprecated in gtfstools 1.3.0. +#> Please use `filter_by_spatial_extent()` instead. +#> For backwards compatibility reasons, usage of `filter_by_sf()` is still +#> allowed as of the current version, but the function will be removed from the +#> package in version 2.0.0.

Alternatively you can also drop such data:

-plotter(gtfs, bbox, keep = FALSE)
+plotter(gtfs, bbox, keep = FALSE) +#> Warning: `filter_by_sf()` was deprecated in gtfstools 1.3.0. +#> Please use `filter_by_spatial_extent()` instead. +#> For backwards compatibility reasons, usage of `filter_by_sf()` is still +#> allowed as of the current version, but the function will be removed from the +#> package in version 2.0.0.

-

You can also control which spatial operation you want to use to filter the data. This is how you’d keep the data that is contained inside the given geometry:

+

You can also control which spatial operation you want to use to +filter the data. This is how you’d keep the data that is contained +inside the given geometry:

-plotter(gtfs, bbox, spatial_operation = sf::st_contains)
+plotter(gtfs, bbox, spatial_operation = sf::st_contains) +#> Warning: `filter_by_sf()` was deprecated in gtfstools 1.3.0. +#> Please use `filter_by_spatial_extent()` instead. +#> For backwards compatibility reasons, usage of `filter_by_sf()` is still +#> allowed as of the current version, but the function will be removed from the +#> package in version 2.0.0.

-

And, simultaneously using spatial_operation and keep, this is how you’d drop the data contained inside the geometry:

+

And, simultaneously using spatial_operation and +keep, this is how you’d drop the data contained inside the +geometry:

-plotter(gtfs, bbox, spatial_operation = sf::st_contains, keep = FALSE)
+plotter(gtfs, bbox, spatial_operation = sf::st_contains, keep = FALSE) +#> Warning: `filter_by_sf()` was deprecated in gtfstools 1.3.0. +#> Please use `filter_by_spatial_extent()` instead. +#> For backwards compatibility reasons, usage of `filter_by_sf()` is still +#> allowed as of the current version, but the function will be removed from the +#> package in version 2.0.0.

-

All filtering functions return a GTFS object readily available to be manipulated and analyzed using the rest of gtfstools’ toolkit. For more information on how to use other functions made available by the package, please see the introductory vignette.

+

All filtering functions return a GTFS object readily available to be +manipulated and analyzed using the rest of gtfstools’ +toolkit. For more information on how to use other functions made +available by the package, please see the introductory vignette.

+ @@ -408,16 +497,16 @@

Filtering using a spatial extent

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/articles/filtering_files/accessible-code-block-0.0.1/empty-anchor.js b/articles/filtering_files/accessible-code-block-0.0.1/empty-anchor.js deleted file mode 100644 index ca349fd6..00000000 --- a/articles/filtering_files/accessible-code-block-0.0.1/empty-anchor.js +++ /dev/null @@ -1,15 +0,0 @@ -// Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> -// v0.0.1 -// Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. - -document.addEventListener('DOMContentLoaded', function() { - const codeList = document.getElementsByClassName("sourceCode"); - for (var i = 0; i < codeList.length; i++) { - var linkList = codeList[i].getElementsByTagName('a'); - for (var j = 0; j < linkList.length; j++) { - if (linkList[j].innerHTML === "") { - linkList[j].setAttribute('aria-hidden', 'true'); - } - } - } -}); diff --git a/articles/filtering_files/figure-html/unnamed-chunk-10-1.png b/articles/filtering_files/figure-html/unnamed-chunk-10-1.png index e4c4b512..f5ea673a 100644 Binary files a/articles/filtering_files/figure-html/unnamed-chunk-10-1.png and b/articles/filtering_files/figure-html/unnamed-chunk-10-1.png differ diff --git a/articles/filtering_files/figure-html/unnamed-chunk-11-1.png b/articles/filtering_files/figure-html/unnamed-chunk-11-1.png index 655babb3..dbc8ca32 100644 Binary files a/articles/filtering_files/figure-html/unnamed-chunk-11-1.png and b/articles/filtering_files/figure-html/unnamed-chunk-11-1.png differ diff --git a/articles/filtering_files/figure-html/unnamed-chunk-12-1.png b/articles/filtering_files/figure-html/unnamed-chunk-12-1.png index e40da20b..a7fed2a3 100644 Binary files a/articles/filtering_files/figure-html/unnamed-chunk-12-1.png and b/articles/filtering_files/figure-html/unnamed-chunk-12-1.png differ diff --git a/articles/filtering_files/figure-html/unnamed-chunk-13-1.png b/articles/filtering_files/figure-html/unnamed-chunk-13-1.png index 631599e5..ae2f06f8 100644 Binary files a/articles/filtering_files/figure-html/unnamed-chunk-13-1.png and b/articles/filtering_files/figure-html/unnamed-chunk-13-1.png differ diff --git a/articles/filtering_files/figure-html/unnamed-chunk-9-1.png b/articles/filtering_files/figure-html/unnamed-chunk-9-1.png index b594f490..8a5014b5 100644 Binary files a/articles/filtering_files/figure-html/unnamed-chunk-9-1.png and b/articles/filtering_files/figure-html/unnamed-chunk-9-1.png differ diff --git a/articles/gtfstools.html b/articles/gtfstools.html index 4522ad3f..816e89f6 100644 --- a/articles/gtfstools.html +++ b/articles/gtfstools.html @@ -6,27 +6,19 @@ Introduction to gtfstools • gtfstools - - - - - - - + - - - +
@@ -55,7 +47,7 @@
- -
+ +
-

The General Transit Feed Specification (GTFS) data format defines a common scheme for describing transit systems, and is widely used by transit agencies around the world and consumed by many software applications. The gtfstools package makes handling GTFS data in R very easy and fast, offering many utility functions to read, manipulate, analyze and write transit feeds in such format.

+

The General Transit Feed Specification (GTFS) data format defines a +common scheme for describing transit systems, and is widely used by +transit agencies around the world and consumed by many software +applications. The gtfstools package makes handling GTFS +data in R very easy and fast, offering many utility +functions to read, manipulate, analyze and write transit feeds in such +format.

GTFS feeds

-

GTFS feeds exist in two main different forms: the GTFS static and the GTFS realtime. This package allows you to manipulate GTFS static feeds, the most common variation. These feeds are the collection of many csv-like files (with a .txt extension) contained in a single .zip file. A GTFS .zip file is composed by at least five required files, but may also contain a few other conditionally required and optional files:

+

GTFS feeds exist in two main different forms: the GTFS +static and the GTFS realtime. This package allows you +to manipulate GTFS static feeds, the most common variation. +These feeds are the collection of many csv-like files (with +a .txt extension) contained in a single .zip +file. A GTFS .zip file is composed by at least five +required files, but may also contain a few other conditionally required +and optional files:

    -
  • Required: agency.txt, stops.txt, routes.txt, trips.txt, stop_times.txt +
  • Required: agency.txt, stops.txt, +routes.txt, trips.txt, +stop_times.txt
  • -
  • Conditionally required: calendar.txt, calendar_dates.txt, feed_info.txt +
  • Conditionally required: calendar.txt, +calendar_dates.txt, feed_info.txt
  • -
  • Optional: fare_attributes.txt, fare_rules.txt, shapes.txt, frequencies.txt, transfers.txt, pathways.txt, levels.txt, translations.txt, attributions.txt +
  • Optional: fare_attributes.txt, +fare_rules.txt, shapes.txt, +frequencies.txt, transfers.txt, +pathways.txt, levels.txt, +translations.txt, attributions.txt
-

Please check the official GTFS reference for more details on the specification.

+

Please check the official GTFS +reference for more details on the specification.

Basic usage

-

Before using gtfstools please make sure that you have it installed in your computer. You can download either the most stable version from CRAN…

+

Before using gtfstools please make sure that you +have it installed in your computer. You can download either the most +stable version from CRAN…

 install.packages("gtfstools")

…or the development version from GitHub.

@@ -128,7 +143,7 @@

Basic usage# or # install.packages("remotes") -remotes::install_github("ipeaGIT/gtfstools")

+remotes::install_github("ipeaGIT/gtfstools")

Then attach it to the current R session:

@@ -139,20 +154,36 @@

Basic usage#> [1] "ber_gtfs.zip" "ggl_gtfs.zip" "poa_gtfs.zip" "spo_gtfs.zip"

-

Throughout this demonstration we will be using São Paulo’s and Google’s feeds.

+

Throughout this demonstration we will be using São Paulo’s and +Google’s feeds.

Read feeds

-

gtfstools reads feeds as a list of data.tables, a high-performance version of base R’s data.frames. Thus, reading, writing and manipulating GTFS objects created by gtfstools is very easy and fast even if some of your tables contain a few million rows.

-

To read a feed use the read_gtfs() function. By default the function reads all .txt files contained in the main .zip file. It may be useful, however, to read only a couple of specific files, specially if you’re dealing with some big data sets. To do so, specify which file you want to read in the files argument (without the .txt extension):

+

gtfstools reads feeds as a list of +data.tables, a high-performance version of base +R’s data.frames. Thus, reading, writing +and manipulating GTFS objects created by gtfstools is +very easy and fast even if some of your tables contain a few million +rows.

+

To read a feed use the read_gtfs() function. By default +the function reads all .txt files contained in the main +.zip file. It may be useful, however, to read only a couple +of specific files, specially if you’re dealing with some big data sets. +To do so, specify which file you want to read in the files +argument (without the .txt extension):

 spo_path <- file.path(data_path, "spo_gtfs.zip")
 
@@ -166,13 +197,30 @@ 

Read feedsspo_shapes <- read_gtfs(spo_path, files = c("shapes", "trips")) names(spo_shapes) #> [1] "shapes" "trips"

-

Please note that date fields are read as columns of class Date, instead of being kept as integers (as specified in the official reference), allowing for easier data manipulation. These columns are converted back to integers when writing the GTFS objects to a .zip file, so GTFS files generated by the package always conform to the specification.

+

Please note that date fields are read as columns of class +Date, instead of being kept as integers (as specified in +the official +reference), allowing for easier data manipulation. These columns are +converted back to integers when writing the GTFS +objects to a .zip file, so GTFS files generated by the +package always conform to the specification.

Analyse feeds

-

gtfstools also includes a few functions to prevent you from getting stuck with repetitive tasks:

-

get_trip_geometry() returns the geometry of each trip in a GTFS object as an sf object (please check {sf} webpage for more details). GTFS data allows you to generate geometries using two different methods: either converting the shapes described in the shapes.txt file to an sf, or linking the subsequent stops of each trip as described in the stop_times.txt along a straight line. While the former tends to yield more reliable and higher resolution geometries, it may be useful to compare the results of both methods to check if the trips described in stop_times actually resemble their actual shape:

+

gtfstools also includes a few functions to prevent +you from getting stuck with repetitive tasks:

+

get_trip_geometry() returns the geometry of each trip in +a GTFS object as an sf object (please check {sf} webpage for +more details). GTFS data allows you to generate geometries using two +different methods: either converting the shapes described in the +shapes.txt file to an sf, or linking the +subsequent stops of each trip as described in the +stop_times.txt along a straight line. While the former +tends to yield more reliable and higher resolution geometries, it may be +useful to compare the results of both methods to check if the trips +described in stop_times actually resemble their actual +shape:

 trip_geom <- get_trip_geometry(spo_gtfs, file = "shapes")
 plot(trip_geom$geometry)
@@ -186,7 +234,10 @@

Analyse feedsboth_geom <- get_trip_geometry(spo_gtfs, trip_id = single_trip) plot(both_geom["origin_file"])

-

get_trip_duration() returns the duration of each trip in a GTFS object, as specified in the stop_times file, in the temporal unit of your desire (either seconds, minutes, hours or days):

+

get_trip_duration() returns the duration of each trip in +a GTFS object, as specified in the stop_times file, in the +temporal unit of your desire (either seconds, minutes, hours or +days):

 trip_durtn <- get_trip_duration(spo_gtfs, unit = "s")
 head(trip_durtn)
@@ -207,7 +258,10 @@ 

Analyse feeds#> trip_id duration #> <char> <num> #> 1: CPTM L07-0 136

-

get_trip_segment_duration() is a similar function, that even takes the same arguments, but returns the duration of each trip segment (i.e. the time interval between two consecutive stops).

+

get_trip_segment_duration() is a similar function, that +even takes the same arguments, but returns the duration of each trip +segment (i.e. the time interval between two consecutive +stops).

 trip_seg_durtn <- get_trip_segment_duration(spo_gtfs, unit = "s")
 head(trip_seg_durtn)
@@ -230,8 +284,13 @@ 

Analyse feeds#> 4: CPTM L07-0 4 8 #> 5: CPTM L07-0 5 8 #> 6: CPTM L07-0 6 8

-

The quick example above shows how this function may help you diagnosing some problems in your GTFS data: apparently every single trip in spo_gtfs is composed by several equally long segments, which looks unreasonable.

-

Finally, get_trip_speed() is a helper around get_trip_geometry() and get_trip_duration() that returns the average speed of each trip in a GTFS object:

+

The quick example above shows how this function may help you +diagnosing some problems in your GTFS data: apparently every single trip +in spo_gtfs is composed by several equally long segments, +which looks unreasonable.

+

Finally, get_trip_speed() is a helper around +get_trip_geometry() and get_trip_duration() +that returns the average speed of each trip in a GTFS object:

 trip_speed <- get_trip_speed(spo_gtfs, unit = "m/s")
 head(trip_speed)
@@ -254,8 +313,17 @@ 

Analyse feeds

Manipulate feeds

-

Each table inside a GTFS object can be easily manipulated using the usual data.table syntax. data.table provides many useful features, such as updating columns by reference, fast binary search, efficient data aggregation, and many others, allowing you to deal with large data sets very efficiently. Please check its official website for more details on syntax and usage.

-

Just remember that, since every GTFS object is a list of data.tables, you must refer to each table using the $ operator. For example, this is how you’d remove the headway_secs column from the frequencies file and add it again afterwards:

+

Each table inside a GTFS object can be easily manipulated using the +usual data.table syntax. data.table provides +many useful features, such as updating columns by reference, fast binary +search, efficient data aggregation, and many others, allowing you to +deal with large data sets very efficiently. Please check its official +website for more details on syntax and usage.

+

Just remember that, since every GTFS object is a +list of data.tables, you must refer +to each table using the $ operator. For example, this is +how you’d remove the headway_secs column from the +frequencies file and add it again afterwards:

 old_headway_secs <- spo_gtfs$frequencies$headway_secs
 
@@ -280,7 +348,11 @@ 

Manipulate feeds#> 4: CPTM L07-0 07:00:00 07:59:00 360 #> 5: CPTM L07-0 08:00:00 08:59:00 360 #> 6: CPTM L07-0 09:00:00 09:59:00 480

-

gtfstools also provides some functions that help you getting over some common tasks. merge_gtfs() takes many GTFS objects and combines them row-wise. By default the function binds every table inside the objects, but you can specify which tables you want to merge with the files argument:

+

gtfstools also provides some functions that help you +getting over some common tasks. merge_gtfs() takes many +GTFS objects and combines them row-wise. By default the function binds +every table inside the objects, but you can specify which tables you +want to merge with the files argument:

 ggl_path <- file.path(data_path, "ggl_gtfs.zip")
 ggl_gtfs <- read_gtfs(ggl_path)
@@ -307,7 +379,17 @@ 

Manipulate feedsmerged_files <- merge_gtfs(spo_gtfs, ggl_gtfs, files = c("shapes", "trips")) names(merged_files) #> [1] "shapes" "trips"

-

set_trip_speed() sets the average speed of specified trips by adjusting the arrival_time and departure_time columns in the stop_times table. Average speed is calculated as the difference between the arrival time at the last stop minus the departure time at the first top, divided by the trip’s length. Please note that arrival and departure times at intermediate stops are set as "". Some transport routing software, such as OpenTripPlanner and R5, support specifying stop times like so, in which case they interpolate arrival/departure times at intermediate stops based on the trip’s average speed and the euclidean distance between stops.

+

set_trip_speed() sets the average speed of specified +trips by adjusting the arrival_time and +departure_time columns in the stop_times +table. Average speed is calculated as the difference between the arrival +time at the last stop minus the departure time at the first top, divided +by the trip’s length. Please note that arrival and departure times at +intermediate stops are set as "". Some transport routing +software, such as OpenTripPlanner and R5, support specifying stop +times like so, in which case they interpolate arrival/departure times at +intermediate stops based on the trip’s average speed and the euclidean +distance between stops.

 selected_trips <- c("2002-10-0", "CPTM L07-0")
 
@@ -337,7 +419,10 @@ 

Manipulate feeds Write feeds

-

Finally, write_gtfs() allows you to save your GTFS objects to disk. It defaults to writing every single table inside the object as a .txt file, but you can conditionally exclude files if you so wish:

+

Finally, write_gtfs() allows you to save your GTFS +objects to disk. It defaults to writing every single table inside the +object as a .txt file, but you can conditionally exclude +files if you so wish:

 temp_dir <- file.path(tempdir(), "gttools_vig")
 dir.create(temp_dir)
@@ -349,23 +434,23 @@ 

write_gtfs(spo_gtfs, filename) list.files(temp_dir) #> [1] "spo_gtfs.zip" -zip::zip_list(filename)$filename +zip::zip_list(filename)$filename #> [1] "agency.txt" "calendar.txt" "frequencies.txt" "routes.txt" #> [5] "shapes.txt" "stop_times.txt" "stops.txt" "trips.txt" write_gtfs(spo_gtfs, filename, files = c("stop_times", "trips", "calendar")) -zip::zip_list(filename)$filename +zip::zip_list(filename)$filename #> [1] "stop_times.txt" "trips.txt" "calendar.txt"

-

write_gtfs() also converts Date columns back to integer, producing GTFS files that conform to the official specification.

+

write_gtfs() also converts Date columns +back to integer, producing GTFS files that conform to the official +specification.

+ @@ -378,16 +463,16 @@

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/articles/gtfstools_files/accessible-code-block-0.0.1/empty-anchor.js b/articles/gtfstools_files/accessible-code-block-0.0.1/empty-anchor.js deleted file mode 100644 index ca349fd6..00000000 --- a/articles/gtfstools_files/accessible-code-block-0.0.1/empty-anchor.js +++ /dev/null @@ -1,15 +0,0 @@ -// Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> -// v0.0.1 -// Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. - -document.addEventListener('DOMContentLoaded', function() { - const codeList = document.getElementsByClassName("sourceCode"); - for (var i = 0; i < codeList.length; i++) { - var linkList = codeList[i].getElementsByTagName('a'); - for (var j = 0; j < linkList.length; j++) { - if (linkList[j].innerHTML === "") { - linkList[j].setAttribute('aria-hidden', 'true'); - } - } - } -}); diff --git a/articles/gtfstools_files/figure-html/unnamed-chunk-7-2.png b/articles/gtfstools_files/figure-html/unnamed-chunk-7-2.png index f6895a19..6d50b036 100644 Binary files a/articles/gtfstools_files/figure-html/unnamed-chunk-7-2.png and b/articles/gtfstools_files/figure-html/unnamed-chunk-7-2.png differ diff --git a/articles/index.html b/articles/index.html index be704cba..a042ab3b 100644 --- a/articles/index.html +++ b/articles/index.html @@ -1,9 +1,9 @@ -Articles • gtfstoolsArticles • gtfstools - +
@@ -31,7 +31,7 @@
- +
@@ -82,15 +82,15 @@

All vignettes

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/articles/validating.html b/articles/validating.html index 1b85c92e..8a6e810d 100644 --- a/articles/validating.html +++ b/articles/validating.html @@ -6,27 +6,19 @@ Validating GTFS feeds • gtfstools - - - - - - - + - - - +
@@ -55,7 +47,7 @@
- -
+ +
-

Transport planners and researchers very frequently want to assess the quality of the GTFS feeds they have produced and consumed. Are the feeds structured according to the best practices agreed by members of the larger GTFS community? Are tables and fields adequately formatted? Is the information described in the feed reasonable (vehicle speeds, stop locations, etc.)? These are some of the questions that may arise when dealing with GTFS data.

-

In order to answer these puzzling questions, gtfstools includes validate_gtfs(), a function that wraps the Canonical GTFS Validator developed by MobilityData. The validator requires Java 11 or higher to run - you can check the version you have currently installed with the command java -version on a terminal session or with the command system("java -version") from your R session. If need be, you can download Java 11 from https://jdk.java.net/java-se-ri/11.

-

Using validate_gtfs() is very simple and requires no more than a few function calls. First we need to download the validator command-line tool. We can do it manually from MobilityData releases, or we can use download_validator(). This function takes a path to a directory where the validator should be saved to and a validator version, which defaults to the latest release, and returns the path to the downloaded validator. Please note that manually downloaded validators should be saved with the same filename convention used by the function (i.e. gtfs-validator-vX.Y.Z.jar). This is important to make sure that our validation function can correctly parse the command-line tool version, which controls some of its behavior.

+

Transport planners and researchers very frequently want to assess the +quality of the GTFS feeds they have produced and consumed. Are the feeds +structured according to the best +practices agreed by members of the larger GTFS community? Are tables +and fields adequately formatted? Is the information described in the +feed reasonable (vehicle speeds, stop locations, etc.)? These are some +of the questions that may arise when dealing with GTFS data.

+

In order to answer these puzzling questions, +gtfstools includes validate_gtfs(), a +function that wraps the Canonical GTFS +Validator developed by MobilityData. The validator requires Java 11 +or higher to run - you can check the version you have currently +installed with the command java -version on a terminal +session or with the command system("java -version") from +your R session. If need be, you can download Java 11 from https://jdk.java.net/java-se-ri/11.

+

Using validate_gtfs() is very simple and requires no +more than a few function calls. First we need to download the validator +command-line tool. We can do it manually from MobilityData releases, or +we can use download_validator(). This function takes a path +to a directory where the validator should be saved to and a validator +version, which defaults to the latest release, and returns the path to +the downloaded validator. Please note that manually downloaded +validators should be saved with the same filename convention used by the +function (i.e. gtfs-validator-vX.Y.Z.jar). This is +important to make sure that our validation function can correctly parse +the command-line tool version, which controls some of its behavior.

 library(gtfstools)
 
 latest_validator <- download_validator(tempdir())
 latest_validator
-#> [1] "/tmp/RtmpSl5olg/gtfs-validator-v4.0.0.jar"
-

The second (and final) step is actually running validate_gtfs(). To do that we need some GTFS data, which the function accepts in varying formats: it can be a GTFS object, as created with read_gtfs(), a path to local GTFS file, an URL to a feed or a path to a local directory containing the GTFS data. It also takes a path to the directory where the validator output should be saved to and the path to the validator, previously generated with download_validator(). Let’s see how it works, using the same GTFS data in three different formats:

+#> [1] "/tmp/RtmpCj6P0O/gtfs-validator-v4.2.0.jar"
+

The second (and final) step is actually running +validate_gtfs(). To do that we need some GTFS data, which +the function accepts in varying formats: it can be a GTFS object, as +created with read_gtfs(), a path to local GTFS file, an URL +to a feed or a path to a local directory containing the GTFS data. It +also takes a path to the directory where the validator output should be +saved to and the path to the validator, previously generated with +download_validator(). Let’s see how it works, using the +same GTFS data in three different formats:

 data_path <- system.file("extdata/spo_gtfs.zip", package = "gtfstools")
 
@@ -122,17 +145,30 @@ 

Validating GTFS feeds

As we can see, the validation generates a few output files:

  • -report.html, shown below, summarizes the validation results in a nicely formatted HTML page (only available when using validator v3.1.0 or higher);
  • +report.html, shown below, summarizes the validation +results in a nicely formatted HTML page (only available when using +validator v3.1.0 or higher);
  • -report.json summarizes the exact same information, but in JSON format, which can be used to easily parse and process the results;
  • +report.json summarizes the exact same information, but +in JSON format, which can be used to easily parse and process the +results;
  • -system_errors.json summarizes eventual system erros that may have happened during the validation and may compromise the results;
  • +system_errors.json summarizes eventual system erros +that may have happened during the validation and may compromise the +results;
  • -validation_stderr.txt lists the informative messages sent by the command-line tool to the standard error output stream, which includes the list of validators in use, eventual error messages, etc;
  • -
  • had the command-line tool printed anything to the standard output stream, the content would have been saved in validation_stdout.txt1.
  • +validation_stderr.txt lists the informative messages +sent by the command-line tool to the standard error output stream, which +includes the list of validators in use, eventual error messages, +etc; +
  • had the command-line tool printed anything to the standard output +stream, the content would have been saved in +validation_stdout.txt1.

-

Had we run the validator using the same GTFS data in different formats (an URL or a GTFS object, for example) the results would be exactly the same:

+

Had we run the validator using the same GTFS data in different +formats (an URL or a GTFS object, for example) the results would be +exactly the same:

 gtfs_url <- "https://github.com/ipeaGIT/gtfstools/raw/master/inst/extdata/spo_gtfs.zip"
 gtfs <- read_gtfs(data_path)
@@ -154,14 +190,20 @@ 

Validating GTFS feeds

object_output_content <- validation_content(object_output_dir) identical(path_output_content, url_output_content) -#> [1] TRUE +#> [1] FALSE identical(path_output_content, object_output_content) -#> [1] TRUE
-

Once again, it’s important to acknowledge that validate_gtfs() only exists thanks to the hard-work of folks at MobilityData/gtfs-validator. A huge shoutout to them!

-
+#> [1] FALSE
+

Once again, it’s important to acknowledge that +validate_gtfs() only exists thanks to the hard-work of +folks at MobilityData/gtfs-validator. +A huge shoutout to them!

+

    -
  1. Please note that the content of validation_stdout.txt and validation_stderr.txt may slightly vary depending on the version of the validator.↩︎

  2. +
  3. Please note that the content of +validation_stdout.txt and +validation_stderr.txt may slightly vary depending on the +version of the validator.↩︎

@@ -181,16 +223,16 @@

Validating GTFS feeds

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/articles/validating_files/accessible-code-block-0.0.1/empty-anchor.js b/articles/validating_files/accessible-code-block-0.0.1/empty-anchor.js deleted file mode 100644 index ca349fd6..00000000 --- a/articles/validating_files/accessible-code-block-0.0.1/empty-anchor.js +++ /dev/null @@ -1,15 +0,0 @@ -// Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> -// v0.0.1 -// Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. - -document.addEventListener('DOMContentLoaded', function() { - const codeList = document.getElementsByClassName("sourceCode"); - for (var i = 0; i < codeList.length; i++) { - var linkList = codeList[i].getElementsByTagName('a'); - for (var j = 0; j < linkList.length; j++) { - if (linkList[j].innerHTML === "") { - linkList[j].setAttribute('aria-hidden', 'true'); - } - } - } -}); diff --git a/authors.html b/authors.html index 9145714b..043557f0 100644 --- a/authors.html +++ b/authors.html @@ -1,9 +1,9 @@ -Authors and Citation • gtfstoolsAuthors and Citation • gtfstools - +
@@ -31,7 +31,7 @@
- +
- +
  • Daniel Herszenhut. Author, maintainer.

    @@ -81,7 +81,7 @@

    Authors

  • -

    Mark Padgham. Contributor. +

    Mark Padgham. Contributor.

  • @@ -89,31 +89,29 @@

    Authors

  • -

    Ipea - Institute for Applied Economic Research. Copyright holder, funder. +

    Ipea - Institute for Applied Economic Research. Copyright holder, funder.

Citation

- Source: DESCRIPTION + Source: DESCRIPTION

Herszenhut D, Pereira R, Andrade P, Bazzo J (2024). -gtfstools: General Transit Feed Specification (GTFS) Editing and Analysing -Tools. -R package version 1.2.0, -https://github.com/ipeaGIT/gtfstools, https://ipeagit.github.io/gtfstools/. +gtfstools: General Transit Feed Specification (GTFS) Editing and Analysing Tools. +R package version 1.2.1, +https://github.com/ipeaGIT/gtfstools, https://ipeagit.github.io/gtfstools/.

@Manual{,
-  title = {gtfstools: General Transit Feed Specification (GTFS) Editing and Analysing
-Tools},
+  title = {gtfstools: General Transit Feed Specification (GTFS) Editing and Analysing Tools},
   author = {Daniel Herszenhut and Rafael H. M. Pereira and Pedro R. Andrade and Joao Bazzo},
   year = {2024},
-  note = {R package version 1.2.0, 
-https://github.com/ipeaGIT/gtfstools},
+  note = {R package version 1.2.1,
+    https://github.com/ipeaGIT/gtfstools},
   url = {https://ipeagit.github.io/gtfstools/},
 }
@@ -128,15 +126,15 @@

Citation

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/bootstrap-toc.css b/bootstrap-toc.css old mode 100755 new mode 100644 diff --git a/bootstrap-toc.js b/bootstrap-toc.js old mode 100755 new mode 100644 diff --git a/docsearch.css b/docsearch.css old mode 100755 new mode 100644 diff --git a/docsearch.js b/docsearch.js old mode 100755 new mode 100644 diff --git a/favicon-16x16.png b/favicon-16x16.png deleted file mode 100644 index 7458efde..00000000 Binary files a/favicon-16x16.png and /dev/null differ diff --git a/favicon-32x32.png b/favicon-32x32.png deleted file mode 100644 index 4e5b2c58..00000000 Binary files a/favicon-32x32.png and /dev/null differ diff --git a/favicon.ico b/favicon.ico deleted file mode 100644 index eb0c077e..00000000 Binary files a/favicon.ico and /dev/null differ diff --git a/index.html b/index.html index 294219dc..adff1166 100644 --- a/index.html +++ b/index.html @@ -5,24 +5,14 @@ -General Transit Feed Specification (GTFS) Editing and Analysing - Tools • gtfstools - - - - - - - +General Transit Feed Specification (GTFS) Editing and Analysing Tools • gtfstools + - - + + - +
@@ -59,7 +49,7 @@
- +
-

CRAN status gtfstools status badge B status Codecov test coverage Lifecycle: experimental CRAN/METACRAN Total downloads

+

CRAN status gtfstools status badge B status Codecov test coverage Lifecycle: experimental CRAN/METACRAN Total downloads

gtfstools offers a set of convenient tools for editing and analysing transit feeds in GTFS format. Feeds are read as a list of data.tables, allowing for easy and fast data manipulation. Many of this package’s features are based on functions from other packages, especially {tidytransit} and {gtfs2gps}.

Installation @@ -112,7 +102,7 @@

Installation# or # install.packages("remotes") -remotes::install_github("ipeaGIT/gtfstools")

+remotes::install_github("ipeaGIT/gtfstools")

This package requires a working installation of {sf}. Please check this link for more information on how to install it.

@@ -131,7 +121,7 @@
@@ -195,16 +185,16 @@

Developers

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/link.svg b/link.svg old mode 100755 new mode 100644 diff --git a/news/index.html b/news/index.html index ee86775e..593f8449 100644 --- a/news/index.html +++ b/news/index.html @@ -1,9 +1,9 @@ -Changelog • gtfstoolsChangelog • gtfstools - +
@@ -31,7 +31,7 @@
- +
+
+ +
+

New features

+
+
+

Bug fixes

+
  • Fixed a bug in convert_to_standard() in which the date fields from feed_info would not be converted back to an integer in their standard format (YYYYMMDD).
  • +
  • Filtering functions now also filter the transfers table based on trip_id and route_id. Previously they would filter it based only on stop_id. Thanks Daniel Langbein (@langbein-daniel).
  • +
  • Fixed a bug in filter_by_route_id() in which feeds with only one agency that omitted agency_id in routes and fare_attributes would end up with an empty agency table.
  • +
  • +filter_by_sf() now correctly throws an error when an unsupported function is passed to spatial_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 parameter full_trips. To actually filter by stop ids (the behavior that we now believe is the most appropriate), please use full_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 by stop_id and specify the trip_ids included in the output in filter_by_trip_id().
  • +
  • +filter_by_sf() has been deprecated in favor of filter_by_spatial_extent(). For backwards compatibility reasons, usage of filter_by_sf() is still allowed as of the curent 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.
  • +
+
@@ -103,7 +141,7 @@

Bug fixesNotes

@@ -129,7 +167,7 @@

New features

Bug fixes

  • -get_trip_speed() and set_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 in Suggests. However, package checks would fail not so gracefully if it wasn’t installed, which is now fixed.
  • +get_trip_speed() and set_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 in Suggests. However, package checks would fail not so gracefully if it wasn’t installed, which is now fixed.
  • Fixed a bug in which the crs passed to get_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 from dt_gtfs (ignoring gtfs and list).
  • @@ -138,7 +176,7 @@

    Bug fixes

    Notes

    -

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/pkgdown.css b/pkgdown.css old mode 100755 new mode 100644 diff --git a/pkgdown.js b/pkgdown.js old mode 100755 new mode 100644 diff --git a/pkgdown.yml b/pkgdown.yml index 900004ea..99f67492 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -1,9 +1,8 @@ -pandoc: 2.9.2.1 -pkgdown: 2.0.7 +pandoc: 3.1.11 +pkgdown: 2.1.1 pkgdown_sha: ~ articles: filtering: filtering.html gtfstools: gtfstools.html validating: validating.html -last_built: 2024-04-05T15:14Z - +last_built: 2024-10-07T13:51Z diff --git a/reference/Rplot001.png b/reference/Rplot001.png deleted file mode 100644 index 17a35806..00000000 Binary files a/reference/Rplot001.png and /dev/null differ diff --git a/reference/as_dt_gtfs.html b/reference/as_dt_gtfs.html new file mode 100644 index 00000000..445b40f0 --- /dev/null +++ b/reference/as_dt_gtfs.html @@ -0,0 +1,191 @@ + +Coerce lists and GTFS objects from other packages into gtfstools-compatible GTFS objects — as_dt_gtfs • gtfstools + + +
+
+ + + +
+
+ + +
+

Coerces an existing object, such as a list or a GTFS object created from +other packages ({tidytransit} and {gtfsio}, for example) into a +gtfstools-compatible GTFS object - i.e. one whose internal tables are +represented with data.tables and whose fields are formatted like the fields +of a feed read with read_gtfs().

+

as_dt_gtfs() is an S3 generic, with methods for:

  • tidygtfs: the class of GTFS objects read with tidytransit::read_gtfs(). +This method converts all tibbles to data.tables and convert time columns, +represented as hms objects in a tidygtfs, to strings in the "HH:MM:SS" +format.

  • +
  • gtfs: the class of GTFS objects read with gtfsio::import_gtfs(). This +method convert all date fields, represented as integers in {gtfsio}'s +representation, to Date objects.

  • +
  • list: this method tries to convert the elements of a list into +data.tables. Please note that all list elements must inherit from +data.frame and must be named. This method does not try not convert fields +to the representation used in {gtfstools}, as it does not have any +information on how they are formatted in the first place.

  • +
+ +
+
as_dt_gtfs(gtfs, ...)
+
+# S3 method for class 'tidygtfs'
+as_dt_gtfs(gtfs, calculate_distance = TRUE, ...)
+
+# S3 method for class 'gtfs'
+as_dt_gtfs(gtfs, ...)
+
+# S3 method for class 'list'
+as_dt_gtfs(gtfs, ...)
+
+ +
+

Arguments

+ + +
gtfs
+

The object that should be coerced to a dt_gtfs.

+ + +
...
+

Ignored.

+ + +
calculate_distance
+

A logical. Passed to convert_sf_to_shapes(), +which only affects the output when the object to be converted includes a +shapes element. Controls whether this function, used to convert a +LINESTRING sf into a GTFS shapes table, should calculate and populate +the shape_dist_traveled column. This column is used to describe the +distance along the shape from each one of its points to its first point. +Defaults to TRUE.

+ +
+
+

Value

+

A dt_gtfs GTFS object.

+
+ +
+

Examples

+
data_path <- system.file("extdata/spo_gtfs.zip", package = "gtfstools")
+
+gtfsio_gtfs <- gtfsio::import_gtfs(data_path)
+class(gtfsio_gtfs)
+#> [1] "gtfs" "list"
+
+gtfstools_gtfs <- as_dt_gtfs(gtfsio_gtfs)
+class(gtfstools_gtfs)
+#> [1] "dt_gtfs" "gtfs"    "list"   
+
+gtfs_like_list <- unclass(gtfsio_gtfs)
+class(gtfs_like_list)
+#> [1] "list"
+
+gtfstools_gtfs <- as_dt_gtfs(gtfs_like_list)
+class(gtfstools_gtfs)
+#> [1] "dt_gtfs" "gtfs"    "list"   
+
+
+
+
+ +
+ + +
+ +
+

Site built with pkgdown 2.1.1.

+
+ +
+ + + + + + + + diff --git a/reference/convert_from_standard.html b/reference/convert_from_standard.html index e947c93c..2aeca77f 100644 --- a/reference/convert_from_standard.html +++ b/reference/convert_from_standard.html @@ -1,10 +1,10 @@ -Convert a standards-compliant GTFS into a gtfstools' GTFS — convert_from_standard • gtfstoolsConvert a standards-compliant GTFS into a gtfstools' GTFS — convert_from_standard • gtfstools - +
@@ -32,7 +32,7 @@
- +
@@ -76,15 +76,15 @@

Convert a standards-compliant GTFS into a gtfstools' GTFS

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

Value

- - -

The GTFS object passed to the gtfs parameter, after converting the +

The GTFS object passed to the gtfs parameter, after converting the relevant fields.

@@ -100,15 +100,15 @@

Value

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/convert_sf_to_shapes.html b/reference/convert_sf_to_shapes.html new file mode 100644 index 00000000..d2a0a0f0 --- /dev/null +++ b/reference/convert_sf_to_shapes.html @@ -0,0 +1,199 @@ + +Convert a simple feature object into a shapes table — convert_sf_to_shapes • gtfstools + + +
+
+ + + +
+
+ + +
+

Converts a LINESTRING sf object into a GTFS shapes table.

+
+ +
+
convert_sf_to_shapes(sf_shapes, shape_id = NULL, calculate_distance = TRUE)
+
+ +
+

Arguments

+ + +
sf_shapes
+

A LINESTRING sf associating each shape_ids to a +geometry. This object must use CRS WGS 84 (EPSG code 4326).

+ + +
shape_id
+

A character vector specifying the shape_ids to be +converted. If NULL (the default), all shapes are converted.

+ + +
calculate_distance
+

A logical. Whether to calculate and populate the +shape_dist_traveled column. This column is used to describe the distance +along the shape from each one of its points to its first point. Defaults to +TRUE.

+ +
+
+

Value

+

A data.table representing a GTFS shapes table.

+
+ +
+

Examples

+
data_path <- system.file("extdata/spo_gtfs.zip", package = "gtfstools")
+gtfs <- read_gtfs(data_path)
+
+# first converting existing shapes table into a sf object
+shapes_sf <- convert_shapes_to_sf(gtfs)
+head(shapes_sf)
+#> Simple feature collection with 6 features and 1 field
+#> Geometry type: LINESTRING
+#> Dimension:     XY
+#> Bounding box:  xmin: -46.98404 ymin: -23.73644 xmax: -46.63535 ymax: -23.19474
+#> Geodetic CRS:  WGS 84
+#>   shape_id                       geometry
+#> 1    17846 LINESTRING (-46.63535 -23.5...
+#> 2    17847 LINESTRING (-46.87255 -23.1...
+#> 3    17848 LINESTRING (-46.64073 -23.5...
+#> 4    17849 LINESTRING (-46.98404 -23.5...
+#> 5    17850 LINESTRING (-46.77604 -23.5...
+#> 6    17851 LINESTRING (-46.69711 -23.7...
+
+# by default converts all shapes
+result <- convert_sf_to_shapes(shapes_sf)
+result
+#>        shape_id shape_dist_traveled shape_pt_lon shape_pt_lat shape_pt_sequence
+#>          <char>               <num>        <num>        <num>             <int>
+#>     1:    17846             0.00000    -46.63535    -23.53517                 1
+#>     2:    17846            13.55178    -46.63548    -23.53513                 2
+#>     3:    17846            95.86978    -46.63626    -23.53494                 3
+#>     4:    17846           184.81732    -46.63710    -23.53473                 4
+#>     5:    17846           211.17349    -46.63735    -23.53466                 5
+#>    ---                                                                         
+#> 12291:    68962         26058.05526    -46.64066    -23.54921               628
+#> 12292:    68962         26067.76199    -46.64057    -23.54922               629
+#> 12293:    68962         26094.30002    -46.64033    -23.54913               630
+#> 12294:    68962         26132.70120    -46.63995    -23.54910               631
+#> 12295:    68962         26162.11007    -46.63967    -23.54907               632
+
+# shape_id argument controls which shapes are converted
+result <- convert_sf_to_shapes(shapes_sf, shape_id = c("17846", "17847"))
+result
+#>       shape_id shape_dist_traveled shape_pt_lon shape_pt_lat shape_pt_sequence
+#>         <char>               <num>        <num>        <num>             <int>
+#>    1:    17846             0.00000    -46.63535    -23.53517                 1
+#>    2:    17846            13.55178    -46.63548    -23.53513                 2
+#>    3:    17846            95.86978    -46.63626    -23.53494                 3
+#>    4:    17846           184.81732    -46.63710    -23.53473                 4
+#>    5:    17846           211.17349    -46.63735    -23.53466                 5
+#>   ---                                                                         
+#> 1090:    17847         60507.76810    -46.63735    -23.53466               543
+#> 1091:    17847         60534.12426    -46.63710    -23.53473               544
+#> 1092:    17847         60623.07180    -46.63626    -23.53494               545
+#> 1093:    17847         60705.38981    -46.63548    -23.53513               546
+#> 1094:    17847         60718.94158    -46.63535    -23.53517               547
+
+# calculate_distance argument controls whether to calculate
+# shape_dist_traveled or not
+result <- convert_sf_to_shapes(shapes_sf, calculate_distance = TRUE)
+result
+#>        shape_id shape_dist_traveled shape_pt_lon shape_pt_lat shape_pt_sequence
+#>          <char>               <num>        <num>        <num>             <int>
+#>     1:    17846             0.00000    -46.63535    -23.53517                 1
+#>     2:    17846            13.55178    -46.63548    -23.53513                 2
+#>     3:    17846            95.86978    -46.63626    -23.53494                 3
+#>     4:    17846           184.81732    -46.63710    -23.53473                 4
+#>     5:    17846           211.17349    -46.63735    -23.53466                 5
+#>    ---                                                                         
+#> 12291:    68962         26058.05526    -46.64066    -23.54921               628
+#> 12292:    68962         26067.76199    -46.64057    -23.54922               629
+#> 12293:    68962         26094.30002    -46.64033    -23.54913               630
+#> 12294:    68962         26132.70120    -46.63995    -23.54910               631
+#> 12295:    68962         26162.11007    -46.63967    -23.54907               632
+
+
+
+
+ +
+ + +
+ +
+

Site built with pkgdown 2.1.1.

+
+ +
+ + + + + + + + diff --git a/reference/convert_shapes_to_sf.html b/reference/convert_shapes_to_sf.html index a9540e0c..d586bd14 100644 --- a/reference/convert_shapes_to_sf.html +++ b/reference/convert_shapes_to_sf.html @@ -1,9 +1,9 @@ -Convert shapes table to simple feature object — convert_shapes_to_sf • gtfstoolsConvert shapes table to simple feature object — convert_shapes_to_sf • gtfstools - +
@@ -31,7 +31,7 @@
- +
@@ -69,30 +69,38 @@

Convert shapes table to simple feature object

-
convert_shapes_to_sf(gtfs, shape_id = NULL, crs = 4326)
+
convert_shapes_to_sf(gtfs, shape_id = NULL, crs = 4326, sort_sequence = FALSE)

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
shape_id
+
shape_id

A character vector including the shape_ids to be converted. If NULL (the default), all shapes are converted.

-
crs
+
crs

The CRS of the resulting object, either as an EPSG code or as an crs object. Defaults to 4326 (WGS 84).

+ +
sort_sequence
+

A logical. Whether to sort shapes by +shape_pt_sequence. Defaults to FALSE, otherwise spec-compliant feeds, +in which shape points are already ordered by shape_pt_sequence, would be +penalized through longer processing times. Shapes generated from unordered +sequences do not correctly depict the real life trip shapes.

+

Value

- - -

A LINESTRING sf object.

+

A LINESTRING sf object.

@@ -140,15 +148,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/convert_stops_to_sf.html b/reference/convert_stops_to_sf.html index 3b9e59e7..0bbb9d1b 100644 --- a/reference/convert_stops_to_sf.html +++ b/reference/convert_stops_to_sf.html @@ -1,9 +1,9 @@ -Convert stops table to simple feature object — convert_stops_to_sf • gtfstoolsConvert stops table to simple feature object — convert_stops_to_sf • gtfstools - +
@@ -31,7 +31,7 @@
- +
@@ -74,25 +74,25 @@

Convert stops table to simple feature object

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
stop_id
+
stop_id

A character vector including the stop_ids to be converted. If NULL (the default), all stops are converted.

-
crs
+
crs

The CRS of the resulting object, either as an EPSG code or as an crs object. Defaults to 4326 (WGS 84).

Value

- - -

A POINT sf object.

+

A POINT sf object.

@@ -140,15 +140,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/convert_time_to_seconds.html b/reference/convert_time_to_seconds.html index 4f7dbf91..a2d4284c 100644 --- a/reference/convert_time_to_seconds.html +++ b/reference/convert_time_to_seconds.html @@ -1,11 +1,11 @@ -Convert time fields to seconds after midnight — convert_time_to_seconds • gtfstoolsConvert time fields to seconds after midnight — convert_time_to_seconds • gtfstools - +
@@ -33,7 +33,7 @@
- +
@@ -78,26 +78,26 @@

Convert time fields to seconds after midnight

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
file
+
file

A character vector, specifying the file whose fields should be converted. If NULL (the default), the function attempts to convert the times from both files, but only raises an error if none of them exist.

-
by_reference
+
by_reference

Whether to update the tables by reference. Defaults to FALSE.

Value

- - -

If by_reference is FALSE, returns a GTFS object with additional +

If by_reference is FALSE, returns a GTFS object with additional time in seconds columns (identified by a _secs suffix). Else, returns a GTFS object invisibly (please note that in such case the original GTFS object is altered).

@@ -203,15 +203,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/convert_to_standard.html b/reference/convert_to_standard.html index 83fe70d5..2aba0808 100644 --- a/reference/convert_to_standard.html +++ b/reference/convert_to_standard.html @@ -1,10 +1,10 @@ -Convert a gtfstools' GTFS into a standards-compliant GTFS — convert_to_standard • gtfstoolsConvert a gtfstools' GTFS into a standards-compliant GTFS — convert_to_standard • gtfstools - +
@@ -32,7 +32,7 @@
- +
@@ -76,15 +76,15 @@

Convert a gtfstools' GTFS into a standards-compliant GTFS

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

Value

- - -

The GTFS object passed to the gtfs parameter, after converting the +

The GTFS object passed to the gtfs parameter, after converting the relevant fields.

@@ -100,15 +100,15 @@

Value

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/copy_gtfs_diff_field_class.html b/reference/copy_gtfs_diff_field_class.html index 2710428e..1ab57d17 100644 --- a/reference/copy_gtfs_diff_field_class.html +++ b/reference/copy_gtfs_diff_field_class.html @@ -1,10 +1,10 @@ -Make a GTFS copy with a field of a different class — copy_gtfs_diff_field_class • gtfstoolsMake a GTFS copy with a field of a different class — copy_gtfs_diff_field_class • gtfstools - +
@@ -32,7 +32,7 @@
- +
@@ -76,27 +76,27 @@

Make a GTFS copy with a field of a different class

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
file
+
file

File whose field must have the class changed.

-
field
+
field

Field to have the class changed.

-
class
+
class

The desired class.

Value

- - -

A GTFS object with the field of desired class.

+

A GTFS object with the field of desired class.

@@ -111,15 +111,15 @@

Value

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/copy_gtfs_without_field.html b/reference/copy_gtfs_without_field.html index 6ac41817..5cd65614 100644 --- a/reference/copy_gtfs_without_field.html +++ b/reference/copy_gtfs_without_field.html @@ -1,10 +1,10 @@ -Make a GTFS copy without a given field from a given file — copy_gtfs_without_field • gtfstoolsMake a GTFS copy without a given field from a given file — copy_gtfs_without_field • gtfstools - +
@@ -32,7 +32,7 @@
- +
@@ -76,23 +76,23 @@

Make a GTFS copy without a given field from a given file

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
file
+
file

File from which the field must be removed.

-
field
+
field

Field to be removed.

Value

- - -

A GTFS object without the given field.

+

A GTFS object without the given field.

@@ -107,15 +107,15 @@

Value

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/copy_gtfs_without_file.html b/reference/copy_gtfs_without_file.html index 4e618dd8..a37751dc 100644 --- a/reference/copy_gtfs_without_file.html +++ b/reference/copy_gtfs_without_file.html @@ -1,9 +1,9 @@ -Make a GTFS copy without a given file — copy_gtfs_without_file • gtfstoolsMake a GTFS copy without a given file — copy_gtfs_without_file • gtfstools - +
@@ -31,7 +31,7 @@
- +
@@ -74,19 +74,19 @@

Make a GTFS copy without a given file

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
file
+
file

File to be removed.

Value

- - -

A GTFS object without the given file.

+

A GTFS object without the given file.

@@ -101,15 +101,15 @@

Value

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/date_to_integer.html b/reference/date_to_integer.html index 4a9c94e0..204154f2 100644 --- a/reference/date_to_integer.html +++ b/reference/date_to_integer.html @@ -1,9 +1,9 @@ -Convert a Date vector into an integer vector — date_to_integer • gtfstoolsConvert a Date vector into an integer vector — date_to_integer • gtfstools - +
@@ -31,7 +31,7 @@
- +
@@ -85,15 +85,15 @@

Convert a Date vector into an integer vector

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/download_validator.html b/reference/download_validator.html index 2965b2df..e454b644 100644 --- a/reference/download_validator.html +++ b/reference/download_validator.html @@ -1,9 +1,9 @@ -Download MobilityData's GTFS validator — download_validator • gtfstoolsDownload MobilityData's GTFS validator — download_validator • gtfstools - +
@@ -31,7 +31,7 @@
- +
@@ -74,37 +74,37 @@

Download MobilityData's GTFS validator

Arguments

-
path
+ + +
path

A string. The directory where the validator should be saved to.

-
version
+
version

A string. The version of the validator that should be downloaded. Defaults to "latest", but accepts version numbers as strings -(i.e. to download version v4.0.0 please enter "4.0.0"). Please check +(i.e. to download version v4.2.0 please enter "4.2.0"). Please check MobilityData/gtfs-validator releases for the full set of available versions.

-
force
+
force

A logical. Whether to overwrite a previously downloaded validator in path. Defaults to FALSE.

-
quiet
+
quiet

A logical. Whether to hide log messages and progress bars. Defaults to TRUE.

Value

- - -

Invisibly returns the normalized path to the downloaded validator.

+

Invisibly returns the normalized path to the downloaded validator.

See also

-

Other validation: +

Other validation: validate_gtfs()

@@ -115,7 +115,7 @@

Examples

download_validator(path) # specifying a specific version -download_validator(path, version = "4.0.0") +download_validator(path, version = "4.2.0")
@@ -130,15 +130,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/filter_by_agency_id.html b/reference/filter_by_agency_id.html index 75da6d21..a967f815 100644 --- a/reference/filter_by_agency_id.html +++ b/reference/filter_by_agency_id.html @@ -1,10 +1,10 @@ -Filter GTFS object by agency_id — filter_by_agency_id • gtfstoolsFilter GTFS object by agency_id — filter_by_agency_id • gtfstools - +
@@ -32,7 +32,7 @@
- +
@@ -76,16 +76,18 @@

Filter GTFS object by agency_id

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
agency_id
+
agency_id

A character vector. The agency_ids used to filter the data.

-
keep
+
keep

A logical. Whether the entries related to the specified agency_ids should be kept or dropped (defaults to TRUE, which keeps the entries).

@@ -93,19 +95,18 @@

Arguments

Value

- - -

The GTFS object passed to the gtfs parameter, after the filtering +

The GTFS object passed to the gtfs parameter, after the filtering process.

See also

-

Other filtering functions: +

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/filter_by_route_id.html b/reference/filter_by_route_id.html index 419691da..6fbd50b8 100644 --- a/reference/filter_by_route_id.html +++ b/reference/filter_by_route_id.html @@ -1,10 +1,10 @@ -Filter GTFS object by route_id — filter_by_route_id • gtfstoolsFilter GTFS object by route_id — filter_by_route_id • gtfstools - +
@@ -32,7 +32,7 @@
- +
@@ -76,15 +76,17 @@

Filter GTFS object by route_id

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
route_id
+
route_id

A character vector. The route_ids used to filter the data.

-
keep
+
keep

A logical. Whether the entries related to the specified route_ids should be kept or dropped (defaults to TRUE, which keeps the entries).

@@ -92,19 +94,18 @@

Arguments

Value

- - -

The GTFS object passed to the gtfs parameter, after the filtering +

The GTFS object passed to the gtfs parameter, after the filtering process.

See also

-

Other filtering functions: +

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/filter_by_route_type.html b/reference/filter_by_route_type.html index 914816c6..f8d259ac 100644 --- a/reference/filter_by_route_type.html +++ b/reference/filter_by_route_type.html @@ -1,10 +1,10 @@ -Filter GTFS object by route_type (transport mode) — filter_by_route_type • gtfstoolsFilter GTFS object by route_type (transport mode) — filter_by_route_type • gtfstools - +
@@ -32,7 +32,7 @@
- +
@@ -76,16 +76,18 @@

Filter GTFS object by route_type (transport mode)

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
route_type
+
route_type

An integer vector. The route_types used to filter the data.

-
keep
+
keep

A logical. Whether the entries related to the specified route_types should be kept or dropped (defaults to TRUE, which keeps the entries).

@@ -93,14 +95,14 @@

Arguments

Value

- - -

The GTFS object passed to the gtfs parameter, after the filtering +

The GTFS object passed to the gtfs parameter, after the filtering process.

Route types

-

Valid options are:

  • 0 - Tram, Streetcar, Light rail. Any light rail or street level system +

    Valid options include the route types listed in the GTFS Schedule +specification and in the Google Transit implementation. The types specified +in the GTFS Schedule specification are:

    • 0 - Tram, Streetcar, Light rail. Any light rail or street level system within a metropolitan area.

    • 1 - Subway, Metro. Any underground rail system within a metropolitan area.

    • 2 - Rail. Used for intercity or long-distance travel.

    • @@ -116,15 +118,98 @@

      Route types

      poles.

    • 12 - Monorail. Railway in which the track consists of a single rail or a beam.

    • +

    The types defined in Google Transit's extension are listed below, including +some examples (not available for all types):

    • 100 - Railway Service - Not applicable (N/A)

    • +
    • 101 - High Speed Rail Service - TGV (FR), ICE (DE), Eurostar (GB)

    • +
    • 102 - Long Distance Trains - InterCity/EuroCity

    • +
    • 103 - Inter Regional Rail Service - InterRegio (DE), Cross County Rail (GB)

    • +
    • 104 - Car Transport Rail Service

    • +
    • 105 - Sleeper Rail Service - GNER Sleeper (GB)

    • +
    • 106 - Regional Rail Service - TER (FR), Regionalzug (DE)

    • +
    • 107 - Tourist Railway Service - Romney, Hythe & Dymchurch (GB)

    • +
    • 108 - Rail Shuttle (Within Complex) - Gatwick Shuttle (GB), Sky Line (DE)

    • +
    • 109 - Suburban Railway - S-Bahn (DE), RER (FR), S-tog (Kopenhagen)

    • +
    • 110 - Replacement Rail Service

    • +
    • 111 - Special Rail Service

    • +
    • 112 - Lorry Transport Rail Service

    • +
    • 113 - All Rail Services

    • +
    • 114 - Cross-Country Rail Service

    • +
    • 115 - Vehicle Transport Rail Service

    • +
    • 116 - Rack and Pinion Railway - Rochers de Naye (CH), Dolderbahn (CH)

    • +
    • 117 - Additional Rail Service

    • +
    • 200 - Coach Service

    • +
    • 201 - International Coach Service - EuroLine, Touring

    • +
    • 202 - National Coach Service - National Express (GB)

    • +
    • 203 - Shuttle Coach Service - Roissy Bus (FR), Reading-Heathrow (GB)

    • +
    • 204 - Regional Coach Service

    • +
    • 205 - Special Coach Service

    • +
    • 206 - Sightseeing Coach Service

    • +
    • 207 - Tourist Coach Service

    • +
    • 208 - Commuter Coach Service

    • +
    • 209 - All Coach Services

    • +
    • 400 - Urban Railway Service

    • +
    • 401 - Metro Service - Métro de Paris

    • +
    • 402 - Underground Service - London Underground, U-Bahn

    • +
    • 403 - Urban Railway Service

    • +
    • 404 - All Urban Railway Services

    • +
    • 405 - Monorail

    • +
    • 700 - Bus Service

    • +
    • 701 - Regional Bus Service - Eastbourne-Maidstone (GB)

    • +
    • 702 - Express Bus Service - X19 Wokingham-Heathrow (GB)

    • +
    • 703 - Stopping Bus Service - 38 London: Clapton Pond-Victoria (GB)

    • +
    • 704 - Local Bus Service

    • +
    • 705 - Night Bus Service - N prefixed buses in London (GB)

    • +
    • 706 - Post Bus Service - Maidstone P4 (GB)

    • +
    • 707 - Special Needs Bus

    • +
    • 708 - Mobility Bus Service

    • +
    • 709 - Mobility Bus for Registered Disabled

    • +
    • 710 - Sightseeing Bus

    • +
    • 711 - Shuttle Bus - 747 Heathrow-Gatwick Airport Service (GB)

    • +
    • 712 - School Bus

    • +
    • 713 - School and Public Service Bus

    • +
    • 714 - Rail Replacement Bus Service

    • +
    • 715 - Demand and Response Bus Service

    • +
    • 716 - All Bus Services

    • +
    • 800 - Trolleybus Service

    • +
    • 900 - Tram Service

    • +
    • 901 - City Tram Service

    • +
    • 902 - Local Tram Service - Munich (DE), Brussels (BE), Croydon (GB)

    • +
    • 903 - Regional Tram Service

    • +
    • 904 - Sightseeing Tram Service - Blackpool Seafront (GB)

    • +
    • 905 - Shuttle Tram Service

    • +
    • 906 - All Tram Services

    • +
    • 1000 - Water Transport Service

    • +
    • 1100 - Air Service

    • +
    • 1200 - Ferry Service

    • +
    • 1300 - Aerial Lift Service - Telefèric de Montjuïc (ES), Saleve (CH), Roosevelt Island Tramway (US)

    • +
    • 1301 - Telecabin Service

    • +
    • 1302 - Cable Car Service

    • +
    • 1303 - Elevator Service

    • +
    • 1304 - Chair Lift Service

    • +
    • 1305 - Drag Lift Service

    • +
    • 1306 - Small Telecabin Service

    • +
    • 1307 - All Telecabin Services

    • +
    • 1400 - Funicular Service - Rigiblick (Zürich, CH)

    • +
    • 1500 - Taxi Service

    • +
    • 1501 - Communal Taxi Service - Marshrutka (RU), dolmuş (TR)

    • +
    • 1502 - Water Taxi Service

    • +
    • 1503 - Rail Taxi Service

    • +
    • 1504 - Bike Taxi Service

    • +
    • 1505 - Licensed Taxi Service

    • +
    • 1506 - Private Hire Service Vehicle

    • +
    • 1507 - All Taxi Services

    • +
    • 1700 - Miscellaneous Service

    • +
    • 1702 - Horse-drawn Carriage

See also

-

Other filtering functions: +

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/filter_by_service_id.html b/reference/filter_by_service_id.html index 12f3a488..c74164d8 100644 --- a/reference/filter_by_service_id.html +++ b/reference/filter_by_service_id.html @@ -1,10 +1,10 @@ -Filter GTFS object by service_id — filter_by_service_id • gtfstoolsFilter GTFS object by service_id — filter_by_service_id • gtfstools - +
@@ -32,7 +32,7 @@
- +
@@ -76,16 +76,18 @@

Filter GTFS object by service_id

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
service_id
+
service_id

A character vector. The service_ids used to filter the data.

-
keep
+
keep

A logical. Whether the entries related to the specified service_ids should be kept or dropped (defaults to TRUE, which keeps the entries).

@@ -93,19 +95,18 @@

Arguments

Value

- - -

The GTFS object passed to the gtfs parameter, after the filtering +

The GTFS object passed to the gtfs parameter, after the filtering process.

See also

-

Other filtering functions: +

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/filter_by_sf.html b/reference/filter_by_sf.html index fdae4568..8caf6fcb 100644 --- a/reference/filter_by_sf.html +++ b/reference/filter_by_sf.html @@ -1,11 +1,14 @@ -Filter a GTFS object using a simple features object — filter_by_sf • gtfstoolsFilter a GTFS object using a simple features object (deprecated) — filter_by_sf • gtfstools - +
@@ -33,7 +36,7 @@
- +
-

Filters a GTFS object using the geometry of an sf object, keeping (or +

This function has been deprecated as of the current package version and will +be completely removed from version 2.0.0 onward. Please use +filter_by_spatial_extent() instead.

+

Filters a GTFS object using the geometry of an sf object, keeping (or dropping) entries related to shapes and trips selected through a spatial operation.

@@ -78,15 +84,17 @@

Filter a GTFS object using a simple features object

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
geom
+
geom

An sf object. Describes the geometry used to filter the data.

-
spatial_operation
+
spatial_operation

A spatial operation function from the set of options listed in geos_binary_pred (check the DE-I9M Wikipedia entry for the @@ -96,7 +104,7 @@

Arguments

functions.

-
keep
+
keep

A logical. Whether the entries related to the shapes and trips that cross through the given geometry should be kept or dropped (defaults to TRUE, which keeps the entries).

@@ -104,19 +112,18 @@

Arguments

Value

- - -

The GTFS object passed to the gtfs parameter, after the filtering +

The GTFS object passed to the gtfs parameter, after the filtering process.

See also

-

Other filtering functions: +

Other filtering functions: filter_by_agency_id(), filter_by_route_id(), filter_by_route_type(), filter_by_service_id(), filter_by_shape_id(), +filter_by_spatial_extent(), filter_by_stop_id(), filter_by_time_of_day(), filter_by_trip_id(), @@ -136,16 +143,31 @@

Examples

# keeps entries that intersect with the specified polygon smaller_gtfs <- filter_by_sf(gtfs, bbox) +#> Warning: `filter_by_sf()` was deprecated in gtfstools 1.3.0. +#> Please use `filter_by_spatial_extent()` instead. +#> For backwards compatibility reasons, usage of `filter_by_sf()` is still +#> allowed as of the current version, but the function will be removed from the +#> package in version 2.0.0. object.size(smaller_gtfs) #> 324952 bytes # drops entries that intersect with the specified polygon smaller_gtfs <- filter_by_sf(gtfs, bbox, keep = FALSE) +#> Warning: `filter_by_sf()` was deprecated in gtfstools 1.3.0. +#> Please use `filter_by_spatial_extent()` instead. +#> For backwards compatibility reasons, usage of `filter_by_sf()` is still +#> allowed as of the current version, but the function will be removed from the +#> package in version 2.0.0. object.size(smaller_gtfs) #> 512288 bytes # uses a different function to filter the gtfs smaller_gtfs <- filter_by_sf(gtfs, bbox, spatial_operation = sf::st_contains) +#> Warning: `filter_by_sf()` was deprecated in gtfstools 1.3.0. +#> Please use `filter_by_spatial_extent()` instead. +#> For backwards compatibility reasons, usage of `filter_by_sf()` is still +#> allowed as of the current version, but the function will be removed from the +#> package in version 2.0.0. object.size(smaller_gtfs) #> 68976 bytes @@ -163,15 +185,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/filter_by_shape_id.html b/reference/filter_by_shape_id.html index 63605e5b..0f58d59e 100644 --- a/reference/filter_by_shape_id.html +++ b/reference/filter_by_shape_id.html @@ -1,10 +1,10 @@ -Filter GTFS object by shape_id — filter_by_shape_id • gtfstoolsFilter GTFS object by shape_id — filter_by_shape_id • gtfstools - +
@@ -32,7 +32,7 @@
- +
@@ -76,15 +76,17 @@

Filter GTFS object by shape_id

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
shape_id
+
shape_id

A character vector. The shape_ids used to filter the data.

-
keep
+
keep

A logical. Whether the entries related to the specified shape_ids should be kept or dropped (defaults to TRUE, which keeps the entries).

@@ -92,19 +94,18 @@

Arguments

Value

- - -

The GTFS object passed to the gtfs parameter, after the filtering +

The GTFS object passed to the gtfs parameter, after the filtering process.

See also

-

Other filtering functions: +

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/filter_by_spatial_extent.html b/reference/filter_by_spatial_extent.html new file mode 100644 index 00000000..79bf3941 --- /dev/null +++ b/reference/filter_by_spatial_extent.html @@ -0,0 +1,188 @@ + +Filter a GTFS object using a spatial extent — filter_by_spatial_extent • gtfstools + + +
+
+ + + +
+
+ + +
+

Filters a GTFS object using a spatial extent (passed as an sf object), +keeping (or dropping) entries related to shapes and trips whose geometries +are selected through a specified spatial operation.

+
+ +
+
filter_by_spatial_extent(
+  gtfs,
+  geom,
+  spatial_operation = sf::st_intersects,
+  keep = TRUE
+)
+
+ +
+

Arguments

+ + +
gtfs
+

A GTFS object, as created by read_gtfs().

+ + +
geom
+

An sf object. Describes the spatial extent used to filter the +data.

+ + +
spatial_operation
+

A spatial operation function from the set of +options listed in geos_binary_pred (check the +DE-I9M Wikipedia entry for the +definition of each function). Defaults to sf::st_intersects, which +tests if the shapes and trips have ANY intersection with the object +specified in geom. Please note that geom is passed as the x argument +of these functions.

+ + +
keep
+

A logical. Whether the entries related to the shapes and trips +selected by the given spatial operation should be kept or dropped (defaults +to TRUE, which keeps the entries).

+ +
+
+

Value

+

The GTFS object passed to the gtfs parameter, after the filtering +process.

+
+ + +
+

Examples

+
data_path <- system.file("extdata/spo_gtfs.zip", package = "gtfstools")
+gtfs <- read_gtfs(data_path)
+
+shape_id <- "68962"
+shape_sf <- convert_shapes_to_sf(gtfs, shape_id)
+bbox <- sf::st_bbox(shape_sf)
+object.size(gtfs)
+#> 860808 bytes
+
+# keeps entries that intersect with the specified polygon
+smaller_gtfs <- filter_by_spatial_extent(gtfs, bbox)
+object.size(smaller_gtfs)
+#> 324952 bytes
+
+# drops entries that intersect with the specified polygon
+smaller_gtfs <- filter_by_spatial_extent(gtfs, bbox, keep = FALSE)
+object.size(smaller_gtfs)
+#> 512288 bytes
+
+# uses a different function to filter the gtfs
+smaller_gtfs <- filter_by_spatial_extent(
+  gtfs,
+  bbox,
+  spatial_operation = sf::st_contains
+)
+object.size(smaller_gtfs)
+#> 68976 bytes
+
+
+
+
+ +
+ + +
+ +
+

Site built with pkgdown 2.1.1.

+
+ +
+ + + + + + + + diff --git a/reference/filter_by_stop_id.html b/reference/filter_by_stop_id.html index ba072dfd..b7da2b7a 100644 --- a/reference/filter_by_stop_id.html +++ b/reference/filter_by_stop_id.html @@ -1,12 +1,10 @@ -Filter GTFS object by stop_id — filter_by_stop_id • gtfstoolsFilter GTFS object by stop_id — filter_by_stop_id • gtfstools - +
@@ -34,7 +32,7 @@
- +

Filters a GTFS object by stop_ids, keeping (or dropping) relevant entries -in each file. In order to keep the integrity of trips as described in the -stop_times table, the stop_ids are actually used to filter trip_ids, -which are then used to filter the rest of the GTFS object.

+in each file.

-
filter_by_stop_id(gtfs, stop_id, keep = TRUE)
+
filter_by_stop_id(
+  gtfs,
+  stop_id,
+  keep = TRUE,
+  include_children = TRUE,
+  include_parents = keep,
+  full_trips = TRUE
+)

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
stop_id
+
stop_id

A character vector. The stop_ids used to filter the data.

-
keep
+
keep

A logical. Whether the entries related to the trip_ids that passes through the specified stop_ids should be kept or dropped (defaults to TRUE, which keeps the entries).

+ +
include_children
+

A logical. Whether the filtered output should +keep/drop children stops of those specified in stop_id. Defaults to +TRUE - i.e. by default children stops are kept if their parents are kept +and dropped if their parents are dropped.

+ + +
include_parents
+

A logical. Whether the filtered output should +keep/drop parent stations of those specified in stop_id. Defaults to +the same value of keep - i.e. by default parent stations are kept both +when their children are kept and dropped, because they can be parents of +multiple stops that are not necessarily dropped, even if their sibling are.

+ + +
full_trips
+

A logical. Whether to keep all stops that compose trips +that pass through the stops specified in stop_id. Defaults to TRUE, in +order to preserve the behavior of the function in versions 1.2.0 and below. +Please note that when TRUE, the resultant filtered feed may contain more +stops than the ones specified in stop_id to preserve the integrity of the +trips. IMPORTANT: using full_trips = TRUE is flagged as deprecated as of +version 1.3.0 and this parameter will default to FALSE from version 2.0.0 +onward.

+

Value

- - -

The GTFS object passed to the gtfs parameter, after the filtering +

The GTFS object passed to the gtfs parameter, after the filtering process.

See also

-

Other filtering functions: +

@@ -125,15 +155,32 @@

Examples

#> 811304 bytes # keeps entries related to trips that pass through specified stop_ids -smaller_gtfs <- filter_by_stop_id(gtfs, stop_ids) +smaller_gtfs <- filter_by_stop_id(gtfs, stop_ids, full_trips = FALSE) object.size(smaller_gtfs) -#> 95744 bytes +#> 64272 bytes # drops entries related to trips that pass through specified stop_ids -smaller_gtfs <- filter_by_stop_id(gtfs, stop_ids, keep = FALSE) +smaller_gtfs <- filter_by_stop_id( + gtfs, + stop_ids, + keep = FALSE, + full_trips = FALSE +) object.size(smaller_gtfs) -#> 741512 bytes +#> 809872 bytes +# the old behavior of filtering trips that contained the specified stops has +# been deprecated +invisible(filter_by_stop_id(gtfs, stop_ids, full_trips = TRUE)) +#> Warning: The `filter_by_stop_id()` behavior of filtering by trips that contain the +#> specified stops was deprecated in gtfstools 1.3.0. +#> For backwards compatibility reasons, this behavior is still the default as of +#> version 1.3.0, and is controlled by the parameter `full_trips`. +#> Please set `full_trips` to "FALSE" to actually filter by `stop_ids`. This +#> behavior will be the default from version 2.0.0 onward. +#> To achieve the old behavior, manually subset the `stop_times` table by +#> `stop_id` and specify the `trip_ids` included in the output in +#> `filter_by_trip_id()`.
@@ -148,15 +195,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/filter_by_time_of_day.html b/reference/filter_by_time_of_day.html index d5cef67b..858c78d2 100644 --- a/reference/filter_by_time_of_day.html +++ b/reference/filter_by_time_of_day.html @@ -1,5 +1,5 @@ -Filter GTFS object by time of day — filter_by_time_of_day • gtfstoolsFilter GTFS object by time of day — filter_by_time_of_day • gtfstools - +
@@ -35,7 +35,7 @@
- +
@@ -89,26 +89,28 @@

Filter GTFS object by time of day

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
from
+
from

A string. The starting point of the time of day, in the "HH:MM:SS" format.

-
to
+
to

A string. The ending point of the time of day, in the "HH:MM:SS" format.

-
keep
+
keep

A logical. Whether the entries related to the specified time of day should be kept or dropped (defaults to TRUE, which keeps the entries).

-
full_trips
+
full_trips

A logical. Whether trips should be treated as immutable blocks or each of its stops should be considered separately when filtering the stop_times table (defaults to FALSE, which considers each stop @@ -116,7 +118,7 @@

Arguments

this parameter changes the function behaviour.

-
update_frequencies
+
update_frequencies

A logical. Whether the frequencies table should have its start_time and end_time fields updated to fit inside/outside the specified time of day (defaults to FALSE, which doesn't update the fields).

@@ -124,14 +126,12 @@

Arguments

Value

- - -

The GTFS object passed to the gtfs parameter, after the filtering +

The GTFS object passed to the gtfs parameter, after the filtering process.

Details

- +

When filtering the frequencies table, filter_by_time_of_day() respects the exact_times field. This field indicates whether the service follows a @@ -187,13 +187,14 @@

Details

See also

-

Other filtering functions: +

@@ -329,15 +330,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/filter_by_trip_id.html b/reference/filter_by_trip_id.html index 191fcdbf..52e2ed3b 100644 --- a/reference/filter_by_trip_id.html +++ b/reference/filter_by_trip_id.html @@ -1,10 +1,10 @@ -Filter GTFS object by trip_id — filter_by_trip_id • gtfstoolsFilter GTFS object by trip_id — filter_by_trip_id • gtfstools - +
@@ -32,7 +32,7 @@
- +
@@ -76,15 +76,17 @@

Filter GTFS object by trip_id

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
trip_id
+
trip_id

A character vector. The trip_ids used to filter the data.

-
keep
+
keep

A logical. Whether the entries related to the specified trip_ids should be kept or dropped (defaults to TRUE, which keeps the entries).

@@ -92,20 +94,19 @@

Arguments

Value

- - -

The GTFS object passed to the gtfs parameter, after the filtering +

The GTFS object passed to the gtfs parameter, after the filtering process.

See also

-

Other filtering functions: +

@@ -144,15 +145,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/filter_by_weekday.html b/reference/filter_by_weekday.html index 37d6c123..d613db38 100644 --- a/reference/filter_by_weekday.html +++ b/reference/filter_by_weekday.html @@ -1,10 +1,10 @@ -Filter GTFS object by weekday — filter_by_weekday • gtfstoolsFilter GTFS object by weekday — filter_by_weekday • gtfstools - +
@@ -32,7 +32,7 @@
- +
@@ -76,32 +76,32 @@

Filter GTFS object by weekday

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
weekday
+
weekday

A character vector. The weekdays used to filter the data. Possible values are c("monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday").

-
combine
+
combine

A string. Specifies which logic operation (OR or AND) should be used to filter the calendar table when multiple weekdays are specified. Defaults to "or". Please check the details and examples sections for more information on this argument usage.

-
keep
+
keep

A logical. Whether the entries related to the specified weekdays should be kept or dropped (defaults to TRUE, which keeps the entries).

Value

- - -

The GTFS object passed to the gtfs parameter, after the filtering +

The GTFS object passed to the gtfs parameter, after the filtering process.

@@ -120,13 +120,14 @@

combine usage

See also

-

Other filtering functions: +

@@ -226,15 +227,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/frequencies_to_stop_times.html b/reference/frequencies_to_stop_times.html index 11d50295..5d7051a3 100644 --- a/reference/frequencies_to_stop_times.html +++ b/reference/frequencies_to_stop_times.html @@ -1,10 +1,10 @@ -Convert frequencies to stop times — frequencies_to_stop_times • gtfstoolsConvert frequencies to stop times — frequencies_to_stop_times • gtfstools - +
@@ -32,7 +32,7 @@
- +
@@ -76,17 +76,19 @@

Convert frequencies to stop times

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
trip_id
+
trip_id

A character vector including the trip_ids to have their frequencies converted to stop_times entries. If NULL (the default), the function converts all trips listed in the frequencies table.

-
force
+
force

Whether to convert trips specified in the frequencies table even if they are not described in stop_times (defaults to FALSE). When set to TRUE, these mismatched trip are removed from the frequencies table @@ -96,16 +98,12 @@

Arguments

Value

- - -

A GTFS object with updated frequencies, stop_times and trips

- - -

tables.

+

A GTFS object with updated frequencies, stop_times and trips +tables.

Details

- +

A single trip described in a frequencies table may yield multiple trips after converting the GTFS. Let's say, for example, that the frequencies @@ -173,15 +171,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/get_children_stops.html b/reference/get_children_stops.html index 1f2fdf26..6eb68e2e 100644 --- a/reference/get_children_stops.html +++ b/reference/get_children_stops.html @@ -1,12 +1,12 @@ -Get children stops recursively — get_children_stops • gtfstoolsGet children stops recursively — get_children_stops • gtfstools - +
@@ -34,7 +34,7 @@
- +
@@ -80,11 +80,13 @@

Get children stops recursively

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
stop_id
+
stop_id

A string vector including the stop_ids to have their children returned. If NULL (the default), the function returns the children of every stop_id in the GTFS.

@@ -92,13 +94,9 @@

Arguments

Value

- - -

A data.table containing the stop_ids and their children' -stop_ids. If a stop doesn't have a child, its correspondent child_id

- - -

entry is marked as "".

+

A data.table containing the stop_ids and their children' +stop_ids. If a stop doesn't have a child, its correspondent child_id +entry is marked as "".

@@ -145,15 +143,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/get_parent_station.html b/reference/get_parent_station.html index 3581699b..ae2bc5de 100644 --- a/reference/get_parent_station.html +++ b/reference/get_parent_station.html @@ -1,11 +1,11 @@ -Get parent stations recursively — get_parent_station • gtfstoolsGet parent stations recursively — get_parent_station • gtfstools - +
@@ -33,7 +33,7 @@
- +
@@ -78,11 +78,13 @@

Get parent stations recursively

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
stop_id
+
stop_id

A string vector including the stop_ids to have their parents returned. If NULL (the default), the function returns the parents of every stop_id in the GTFS.

@@ -90,9 +92,7 @@

Arguments

Value

- - -

A data.table containing the stop_ids and their parent_stations. +

A data.table containing the stop_ids and their parent_stations. If a stop doesn't have a parent, its correspondent parent_station entry is marked as "".

@@ -143,15 +143,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/get_stop_times_patterns.html b/reference/get_stop_times_patterns.html index 84103b21..dc63ad6e 100644 --- a/reference/get_stop_times_patterns.html +++ b/reference/get_stop_times_patterns.html @@ -1,11 +1,11 @@ -Get stop times patterns — get_stop_times_patterns • gtfstools - +
@@ -33,7 +33,7 @@
- +
@@ -73,35 +73,49 @@

Get stop times patterns

-
get_stop_times_patterns(gtfs, trip_id = NULL, type = "spatial")
+
get_stop_times_patterns(
+  gtfs,
+  trip_id = NULL,
+  type = "spatial",
+  sort_sequence = FALSE
+)

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
trip_id
+
trip_id

A character vector including the trip_ids to have their stop_times entries analyzed. If NULL (the default), the function analyses the pattern of every trip_id in the GTFS.

-
type
+
type

A string specifying the type of patterns to be analyzed. Either "spatial" (the default) or "spatiotemporal".

+ +
sort_sequence
+

A logical specifying whether to sort timetables by +stop_sequence. Defaults to FALSE, otherwise spec-compliant feeds, in +which timetables points are already ordered by stop_sequence, would be +penalized through longer processing times. Pattern identification based on +unordered timetables may result in multiple ids identifying what would be +the same pattern, had the table been ordered.

+

Value

- - -

A data.table associating each trip_id to a pattern_id.

+

A data.table associating each trip_id to a pattern_id.

Details

- +

Two trips are assigned to the same spatial pattern_id if they travel along the same sequence of stops. They are assigned to the same spatiotemporal @@ -179,15 +193,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/get_trip_duration.html b/reference/get_trip_duration.html index 37fcceb7..efff3252 100644 --- a/reference/get_trip_duration.html +++ b/reference/get_trip_duration.html @@ -1,9 +1,9 @@ -Get trip duration — get_trip_duration • gtfstoolsGet trip duration — get_trip_duration • gtfstools - +
@@ -31,7 +31,7 @@
- +
@@ -74,17 +74,19 @@

Get trip duration

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
trip_id
+
trip_id

A string vector including the trip_ids to have their duration calculated. If NULL (the default) the function calculates the duration of every trip_id in the GTFS.

-
unit
+
unit

A string representing the time unit in which the duration is desired. One of "s" (seconds), "min" (minutes, the default), "h" (hours) or "d" (days).

@@ -92,13 +94,11 @@

Arguments

Value

- - -

A data.table containing the duration of each specified trip.

+

A data.table containing the duration of each specified trip.

Details

- +

The duration of a trip is defined as the time difference between its last arrival time and its first departure time, as specified in the stop_times @@ -154,15 +154,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/get_trip_geometry-1.png b/reference/get_trip_geometry-1.png index 105ef369..0a809e42 100644 Binary files a/reference/get_trip_geometry-1.png and b/reference/get_trip_geometry-1.png differ diff --git a/reference/get_trip_geometry.html b/reference/get_trip_geometry.html index 884af287..e7b353a6 100644 --- a/reference/get_trip_geometry.html +++ b/reference/get_trip_geometry.html @@ -1,10 +1,10 @@ -Get trip geometry — get_trip_geometry • gtfstoolsGet trip geometry — get_trip_geometry • gtfstools - +
@@ -32,7 +32,7 @@
- +
@@ -71,42 +71,58 @@

Get trip geometry

-
get_trip_geometry(gtfs, trip_id = NULL, file = NULL, crs = 4326)
+
get_trip_geometry(
+  gtfs,
+  trip_id = NULL,
+  file = NULL,
+  crs = 4326,
+  sort_sequence = FALSE
+)

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
trip_id
+
trip_id

A character vector including the trip_ids to have their geometries generated. If NULL (the default), the function generates geometries for every trip_id in the GTFS.

-
file
+
file

A character vector specifying the file from which geometries should be generated (either one of or both shapes and stop_times). If NULL (the default), the function attemps to generate the geometries from both files, but only raises an error if none of the files exist.

-
crs
+
crs

The CRS of the resulting object, either as an EPSG code or as an crs object. Defaults to 4326 (WGS 84).

+ +
sort_sequence
+

A logical specifying whether to sort shapes and +timetables by shape_pt_sequence and stop_sequence, respectively. +Defaults to FALSE, otherwise spec-compliant feeds, in which +shape/timetables points are already ordered by +shape_pt_sequence/stop_sequence, would be penalized through longer +processing times. Geometries generated from unordered sequences do not +correctly depict the trip trajectories.

+

Value

- - -

A LINESTRING sf.

+

A LINESTRING sf.

Details

- +

The geometry generation works differently for the two files. In the case of shapes, the shape as described in the text file is converted to an sf @@ -183,15 +199,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/get_trip_length.html b/reference/get_trip_length.html index 9fe22e97..e9016d8e 100644 --- a/reference/get_trip_length.html +++ b/reference/get_trip_length.html @@ -1,10 +1,10 @@ -Get trip length — get_trip_length • gtfstoolsGet trip length — get_trip_length • gtfstools - +
@@ -32,7 +32,7 @@
- +
@@ -71,42 +71,58 @@

Get trip length

-
get_trip_length(gtfs, trip_id = NULL, file = NULL, unit = "km")
+
get_trip_length(
+  gtfs,
+  trip_id = NULL,
+  file = NULL,
+  unit = "km",
+  sort_sequence = FALSE
+)

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
trip_id
+
trip_id

A character vector including the trip_ids to have their length calculated If NULL (the default), the function calculates the length of each trip_id in the GTFS.

-
file
+
file

A character vector specifying the file from which lengths should be calculated (either one of or both shapes and stop_times). If NULL (the default), the function attempts to calculate the lengths from both files, but only raises an error if none of the files exist.

-
unit
+
unit

A string representing the unit in which lengths are desired. Either "km" (the default) or "m".

+ +
sort_sequence
+

A logical specifying whether to sort shapes and +timetables by shape_pt_sequence and stop_sequence, respectively. +Defaults to FALSE, otherwise spec-compliant feeds, in which +shape/timetables points are already ordered by +shape_pt_sequence/stop_sequence, would be penalized through longer +processing times. Lengths calculated from trip trajectories generated with +unordered sequences do not correctly depict the actual trip lengths.

+

Value

- - -

A data.table containing the length of each specified trip.

+

A data.table containing the length of each specified trip.

Details

- +

Please check get_trip_geometry() documentation to understand how geometry generation, and consequently length calculation, differs depending on the @@ -166,15 +182,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/get_trip_segment_duration.html b/reference/get_trip_segment_duration.html index 49ce532d..f4313376 100644 --- a/reference/get_trip_segment_duration.html +++ b/reference/get_trip_segment_duration.html @@ -1,9 +1,9 @@ -Get trip segments' duration — get_trip_segment_duration • gtfstoolsGet trip segments' duration — get_trip_segment_duration • gtfstools - +
@@ -31,7 +31,7 @@
- +
@@ -69,37 +69,51 @@

Get trip segments' duration

-
get_trip_segment_duration(gtfs, trip_id = NULL, unit = "min")
+
get_trip_segment_duration(
+  gtfs,
+  trip_id = NULL,
+  unit = "min",
+  sort_sequence = FALSE
+)

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
trip_id
+
trip_id

A string vector including the trip_ids to have their segments' duration calculated. If NULL (the default) the function calculates the segments' duration of every trip_id in the GTFS.

-
unit
+
unit

A string representing the time unit in which the duration is desired. One of "s" (seconds), "min" (minutes, the default), "h" (hours) or "d" (days).

+ +
sort_sequence
+

A logical specifying whether to sort timetables by +stop_sequence. Defaults to FALSE, otherwise spec-compliant feeds, in +which timetables points are already ordered by stop_sequence, would be +penalized through longer processing times. Durations calculated from +unordered timetables do not correctly depict the real life segment +durations.

+

Value

- - -

A data.table containing the segments' duration of each specified +

A data.table containing the segments' duration of each specified trip.

Details

- +

A trip segment is defined as the path between two subsequent stops in the same trip. The duration of a segment is defined as the time difference @@ -184,15 +198,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/get_trip_speed.html b/reference/get_trip_speed.html index 2e00774d..34c16af3 100644 --- a/reference/get_trip_speed.html +++ b/reference/get_trip_speed.html @@ -1,10 +1,10 @@ -Get trip speed — get_trip_speed • gtfstoolsGet trip speed — get_trip_speed • gtfstools - +
@@ -32,7 +32,7 @@
- +
@@ -71,42 +71,59 @@

Get trip speed

-
get_trip_speed(gtfs, trip_id = NULL, file = "shapes", unit = "km/h")
+
get_trip_speed(
+  gtfs,
+  trip_id = NULL,
+  file = "shapes",
+  unit = "km/h",
+  sort_sequence = FALSE
+)

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
trip_id
+
trip_id

A character vector including the trip_ids to have their speeds calculated. If NULL (the default), the function calculates the speed of every trip_id in the GTFS.

-
file
+
file

The file from which geometries should be generated, either shapes or stop_times (geometries are used to calculate the length of a trip). Defaults to shapes.

-
unit
+
unit

A string representing the unit in which the speeds are desired. Either "km/h" (the default) or "m/s".

+ +
sort_sequence
+

Ultimately passed to get_trip_length(), a logical +specifying whether to sort shapes and timetables by shape_pt_sequence and +stop_sequence, respectively. Speeds calculated from trip trajectories +generated with unordered sequences do not correctly depict the actual trip +speeds. Defaults to FALSE, otherwise spec-compliant feeds, in which +shape/timetables points are already ordered by +shape_pt_sequence/stop_sequence, would be penalized through longer +processing times.

+

Value

- - -

A data.table containing the duration of each specified trip and the +

A data.table containing the duration of each specified trip and the file from which geometries were generated.

Details

- +

Please check get_trip_geometry() documentation to understand how geometry generation differs depending on the chosen file.

@@ -175,15 +192,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/gtfstools.html b/reference/gtfstools.html index 871a0d71..2a59b5da 100644 --- a/reference/gtfstools.html +++ b/reference/gtfstools.html @@ -1,12 +1,10 @@ -gtfstools: General Transit Feed Specification (GTFS) Editing and Analysing -Tools — gtfstools • gtfstoolsgtfstools: General Transit Feed Specification (GTFS) Editing and Analysing Tools — gtfstools • gtfstools - +
@@ -34,7 +32,7 @@
- +
@@ -76,7 +73,7 @@

gtfstools: General Transit Feed Specification (GTFS) Editing and Analysing

Usage

- +

Please check the vignettes for more on the package usage:

  • Basic usage: reading, analysing, manipulating and writing feeds. Run vignette("gtfstools") or check it on the website.

  • @@ -116,15 +113,15 @@

    Author

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/index.html b/reference/index.html index 9855b72f..4209b8de 100644 --- a/reference/index.html +++ b/reference/index.html @@ -1,9 +1,9 @@ -Function reference • gtfstoolsPackage index • gtfstools - +
@@ -31,7 +31,7 @@
- +
@@ -63,10 +63,26 @@

Reference

+ + + + + + + @@ -79,54 +95,26 @@

All functions

- - - - - - - - - - - - - - - - - + - + - + - - + + @@ -158,30 +146,74 @@

All functions get_trip_speed()

+ + + - + + + + - + - + - + - + - + + + + + + + + + + + + + +
-

All functions

+

Input/output

+

+
+

read_gtfs()

+

Read GTFS files

+

write_gtfs()

+

Write GTFS files

+

Manipulation

+

convert_sf_to_shapes()

+

Convert a simple feature object into a shapes table

convert_shapes_to_sf()

Convert shapes table to simple feature object

Convert time fields to seconds after midnight

-

download_validator()

-

Download MobilityData's GTFS validator

-

filter_by_agency_id()

-

Filter GTFS object by agency_id

-

filter_by_route_id()

-

Filter GTFS object by route_id

-

filter_by_route_type()

-

Filter GTFS object by route_type (transport mode)

-

filter_by_service_id()

-

Filter GTFS object by service_id

-

filter_by_sf()

-

Filter a GTFS object using a simple features object

-

filter_by_shape_id()

-

Filter GTFS object by shape_id

-

filter_by_stop_id()

-

Filter GTFS object by stop_id

-

filter_by_time_of_day()

+

frequencies_to_stop_times()

Filter GTFS object by time of day

Convert frequencies to stop times

-

filter_by_trip_id()

+

merge_gtfs()

Filter GTFS object by trip_id

Merge GTFS files

-

filter_by_weekday()

+

remove_duplicates()

Filter GTFS object by weekday

Remove duplicated entries

-

frequencies_to_stop_times()

+

set_trip_speed()

Convert frequencies to stop times

+

Set trip average speed

+

Analysis

+

+

get_children_stops()

Get children stops recursively

Get trip speed

+

Validation

+

+
+

download_validator()

+

Download MobilityData's GTFS validator

-

merge_gtfs()

+

validate_gtfs()

Merge GTFS files

Validate GTFS feed

+

Filters

+

+
+

filter_by_agency_id()

+

Filter GTFS object by agency_id

-

read_gtfs()

+

filter_by_route_id()

Read GTFS files

Filter GTFS object by route_id

-

remove_duplicates()

+

filter_by_route_type()

Remove duplicated entries

Filter GTFS object by route_type (transport mode)

-

set_trip_speed()

+

filter_by_service_id()

Set trip average speed

Filter GTFS object by service_id

-

validate_gtfs()

+

filter_by_sf()

Validate GTFS feed

Filter a GTFS object using a simple features object (deprecated)

-

write_gtfs()

+

filter_by_shape_id()

Write GTFS files

Filter GTFS object by shape_id

+

filter_by_spatial_extent()

+

Filter a GTFS object using a spatial extent

+

filter_by_stop_id()

+

Filter GTFS object by stop_id

+

filter_by_time_of_day()

+

Filter GTFS object by time of day

+

filter_by_trip_id()

+

Filter GTFS object by trip_id

+

filter_by_weekday()

+

Filter GTFS object by weekday

+

Interoperability between GTFS packages

+

+
+

as_dt_gtfs()

+

Coerce lists and GTFS objects from other packages into gtfstools-compatible GTFS objects

- - + + diff --git a/reference/integer_to_date.html b/reference/integer_to_date.html index d631ca63..22f3df1b 100644 --- a/reference/integer_to_date.html +++ b/reference/integer_to_date.html @@ -1,9 +1,9 @@ -Convert an integer vector into a Date vector — integer_to_date • gtfstoolsConvert an integer vector into a Date vector — integer_to_date • gtfstools - +
@@ -31,7 +31,7 @@
- +
@@ -85,15 +85,15 @@

Convert an integer vector into a Date vector

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/merge_gtfs.html b/reference/merge_gtfs.html index cfe4fbe9..4b489093 100644 --- a/reference/merge_gtfs.html +++ b/reference/merge_gtfs.html @@ -1,9 +1,9 @@ -Merge GTFS files — merge_gtfs • gtfstoolsMerge GTFS files — merge_gtfs • gtfstools - +
@@ -31,7 +31,7 @@
- +
@@ -69,26 +69,24 @@

Merge GTFS files

-
merge_gtfs(..., files = NULL, warnings, prefix = FALSE)
+
merge_gtfs(..., files = NULL, prefix = FALSE)

Arguments

-
...
+ + +
...

GTFS objects to be merged. Each argument can either be a GTFS or a list of GTFS objects.

-
files
+
files

A character vector listing the GTFS tables to be merged. If NULL (the default), all tables are merged.

-
warnings
-

Whether to display warning messages (defaults to TRUE).

- - -
prefix
+
prefix

Either a logical or a character vector (defaults to FALSE). Whether to add a prefix to the value of id fields that identify from which GTFS object the value comes from. If TRUE, the prefixes will range from @@ -101,9 +99,7 @@

Arguments

Value

- - -

A GTFS object in which each table is a combination (by row) of the +

A GTFS object in which each table is a combination (by row) of the tables from the specified GTFS objects.

@@ -179,15 +175,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/read_gtfs.html b/reference/read_gtfs.html index 200c44ba..5d96ef39 100644 --- a/reference/read_gtfs.html +++ b/reference/read_gtfs.html @@ -1,9 +1,9 @@ -Read GTFS files — read_gtfs • gtfstoolsRead GTFS files — read_gtfs • gtfstools - +
@@ -31,7 +31,7 @@
- +
@@ -81,17 +81,19 @@

Read GTFS files

Arguments

-
path
+ + +
path

The path to a GTFS .zip file.

-
files
+
files

A character vector containing the text files to be read from the GTFS (without the .txt extension). If NULL (the default) all existing files are read.

-
fields
+
fields

A named list containing the fields to be read from each text file, in the format list(file = c("field1", "field2")). If NULL (the default), all fields from the files specified in files are read. If a @@ -100,18 +102,18 @@

Arguments

want to subset).

-
skip
+
skip

A character vector containing the text files that should not be read from the GTFS, without the .txt extension. If NULL (the default), no files are skipped. Cannot be used if files is already set.

-
quiet
+
quiet

Whether to hide log messages and progress bars (defaults to TRUE).

-
encoding
+
encoding

A string, ultimately passed to data.table::fread(). Defaults to "unknown". Other possible options are "UTF-8" and "Latin-1". Please note that this is not used to re-encode the input, but @@ -120,14 +122,12 @@

Arguments

Value

- - -

A data.table-based GTFS object: a list of data.tables in which +

A data.table-based GTFS object: a list of data.tables in which each table represents a GTFS text file.

Details

- +

The column types of each data.table in the final GTFS object conform as closely as possible to the Google's Static GTFS Reference. Exceptions are @@ -139,7 +139,7 @@

Details

See also

-

Other io functions: +

Other io functions: write_gtfs()

@@ -182,15 +182,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/remove_duplicates.html b/reference/remove_duplicates.html index 4ee81405..48935bb5 100644 --- a/reference/remove_duplicates.html +++ b/reference/remove_duplicates.html @@ -1,9 +1,9 @@ -Remove duplicated entries — remove_duplicates • gtfstoolsRemove duplicated entries — remove_duplicates • gtfstools - +
@@ -31,7 +31,7 @@
- +
@@ -74,15 +74,15 @@

Remove duplicated entries

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

Value

- - -

A GTFS object containing only unique entries.

+

A GTFS object containing only unique entries.

@@ -124,15 +124,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/seconds_to_string.html b/reference/seconds_to_string.html index 5d493497..04254abe 100644 --- a/reference/seconds_to_string.html +++ b/reference/seconds_to_string.html @@ -1,10 +1,10 @@ -Convert seconds after midnight to time string — seconds_to_string • gtfstools - +
@@ -32,7 +32,7 @@
- +
@@ -76,15 +76,15 @@

Convert seconds after midnight to time string

Arguments

-
seconds
+ + +
seconds

An integer.

Value

- - -

A time-representing string.

+

A time-representing string.

@@ -99,15 +99,15 @@

Value

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/set_trip_speed.html b/reference/set_trip_speed.html index a30745f6..42514202 100644 --- a/reference/set_trip_speed.html +++ b/reference/set_trip_speed.html @@ -1,10 +1,10 @@ -Set trip average speed — set_trip_speed • gtfstoolsSet trip average speed — set_trip_speed • gtfstools - +
@@ -32,7 +32,7 @@
- +
@@ -76,42 +76,42 @@

Set trip average speed

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
trip_id
+
trip_id

A string vector including the trip_ids to have their average speed set.

-
speed
+
speed

A numeric representing the speed to be set. Its length must either equal 1, in which case the value is recycled for all trip_ids, or equal trip_id's length.

-
unit
+
unit

A string representing the unit in which the speed is given. One of "km/h" (the default) or "m/s".

-
by_reference
+
by_reference

Whether to update stop_times' data.table by reference. Defaults to FALSE.

Value

- - -

If by_reference is set to FALSE, returns a GTFS object with the +

If by_reference is set to FALSE, returns a GTFS object with the time columns of its stop_times adjusted. Else, returns a GTFS object invisibly (note that in this case the original GTFS object is altered).

Details

- +

The average speed is calculated as the difference between the arrival time at the last stop minus the departure time at the first top, over the trip's @@ -244,15 +244,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/string_to_seconds.html b/reference/string_to_seconds.html index 3d6bb43c..8774ad00 100644 --- a/reference/string_to_seconds.html +++ b/reference/string_to_seconds.html @@ -1,9 +1,9 @@ -Convert time string to seconds after midnight — string_to_seconds • gtfstoolsConvert time string to seconds after midnight — string_to_seconds • gtfstools - +
@@ -31,7 +31,7 @@
- +
@@ -74,15 +74,15 @@

Convert time string to seconds after midnight

Arguments

-
string
+ + +
string

A string in "HH:MM:SS" format.

Value

- - -

The seconds after midnight of a given time string as an integer.

+

The seconds after midnight of a given time string as an integer.

@@ -97,15 +97,15 @@

Value

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/validate_gtfs.html b/reference/validate_gtfs.html index b65c0bcf..b2d2e3b3 100644 --- a/reference/validate_gtfs.html +++ b/reference/validate_gtfs.html @@ -1,5 +1,5 @@ -Validate GTFS feed — validate_gtfs • gtfstoolsValidate GTFS feed — validate_gtfs • gtfstools - +
@@ -37,7 +37,7 @@
- +
@@ -89,50 +89,52 @@

Validate GTFS feed

html_preview = TRUE, pretty_json = FALSE, quiet = TRUE, - n_threads = parallel::detectCores() - 1 + n_threads = 1 )

Arguments

-
gtfs
+ + +
gtfs

The GTFS to be validated. Can be in the format of a GTFS object, of a path to a GTFS file, of a path to a directory or an URL to a feed.

-
output_path
+
output_path

A string. The path to the directory that the validator will create and in which the results will be saved to.

-
validator_path
+
validator_path

A string. The path to the GTFS validator, previously downloaded with download_validator().

-
overwrite
+
overwrite

A logical. Whether to overwrite existing validation results in output_path. Defaults to TRUE.

-
html_preview
+
html_preview

A logical. Whether to show HTML report in a viewer, such as RStudio or a browser. Defaults to TRUE (only works on interactive sessions).

-
pretty_json
+
pretty_json

A logical. Whether JSON results should be printed in a readable way, that allows it to be inspected without manually formatting. Defaults to FALSE.

-
quiet
+
quiet

A logical. Whether to hide informative messages. Defaults to TRUE.

-
n_threads
+
n_threads

An integer between 1 and the number of cores in the running machine. Control how many threads are used during the validation. Defaults to using all but one of the available cores.

@@ -140,14 +142,12 @@

Arguments

Value

- - -

Invisibly returns the normalized path to the directory where the +

Invisibly returns the normalized path to the directory where the validation results were saved to.

See also

-

Other validation: +

Other validation: download_validator()

@@ -191,15 +191,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/reference/write_gtfs.html b/reference/write_gtfs.html index 7eca1fed..8b8d0d8b 100644 --- a/reference/write_gtfs.html +++ b/reference/write_gtfs.html @@ -1,9 +1,9 @@ -Write GTFS files — write_gtfs • gtfstoolsWrite GTFS files — write_gtfs • gtfstools - +
@@ -31,7 +31,7 @@
- +
@@ -82,54 +82,52 @@

Write GTFS files

Arguments

-
gtfs
+ + +
gtfs

A GTFS object, as created by read_gtfs().

-
path
+
path

The path to the .zip file in which the feed should be written to.

-
files
+
files

A character vector containing the name of the elements to be written to the feed. If NULL (the default), all elements inside the GTFS object are written.

-
standard_only
+
standard_only

Whether to write only standard files and fields (defaults to FALSE, which doesn't drop extra files and fields).

-
as_dir
+
as_dir

Whether to write the feed as a directory, instead of a .zip file (defaults to FALSE, which means that the field is written as a zip file).

-
overwrite
+
overwrite

Whether to overwrite existing .zip file (defaults to TRUE).

-
quiet
+
quiet

Whether to hide log messages and progress bars (defaults to TRUE).

Value

- - -

Invisibly returns the same GTFS object passed to the gtfs

- - -

parameter.

+

Invisibly returns the same GTFS object passed to the gtfs +parameter.

See also

-

Other io functions: +

Other io functions: read_gtfs()

@@ -145,7 +143,7 @@

Examples

tmp_file <- tempfile(pattern = "gtfs", tmpdir = tmp_dir, fileext = ".zip") write_gtfs(gtfs, tmp_file) list.files(tmp_dir) -#> [1] "gtfs4b79d3cfc40.zip" +#> [1] "gtfs1d8b567fb48b.zip" gtfs_all_files <- read_gtfs(tmp_file) names(gtfs_all_files) @@ -171,15 +169,15 @@

Examples

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.1.

- - + + diff --git a/sitemap.xml b/sitemap.xml index 16dde565..63810d1b 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -1,150 +1,55 @@ - - - - /404.html - - - /LICENSE-text.html - - - /articles/filtering.html - - - /articles/gtfstools.html - - - /articles/index.html - - - /articles/validating.html - - - /authors.html - - - /index.html - - - /news/index.html - - - /reference/convert_from_standard.html - - - /reference/convert_shapes_to_sf.html - - - /reference/convert_stops_to_sf.html - - - /reference/convert_time_to_seconds.html - - - /reference/convert_to_standard.html - - - /reference/copy_gtfs_diff_field_class.html - - - /reference/copy_gtfs_without_field.html - - - /reference/copy_gtfs_without_file.html - - - /reference/date_to_integer.html - - - /reference/download_validator.html - - - /reference/filter_by_agency_id.html - - - /reference/filter_by_route_id.html - - - /reference/filter_by_route_type.html - - - /reference/filter_by_service_id.html - - - /reference/filter_by_sf.html - - - /reference/filter_by_shape_id.html - - - /reference/filter_by_stop_id.html - - - /reference/filter_by_time_of_day.html - - - /reference/filter_by_trip_id.html - - - /reference/filter_by_weekday.html - - - /reference/frequencies_to_stop_times.html - - - /reference/get_children_stops.html - - - /reference/get_parent_station.html - - - /reference/get_stop_times_patterns.html - - - /reference/get_trip_duration.html - - - /reference/get_trip_geometry.html - - - /reference/get_trip_length.html - - - /reference/get_trip_segment_duration.html - - - /reference/get_trip_speed.html - - - /reference/gtfstools.html - - - /reference/index.html - - - /reference/integer_to_date.html - - - /reference/merge_gtfs.html - - - /reference/read_gtfs.html - - - /reference/remove_duplicates.html - - - /reference/seconds_to_string.html - - - /reference/set_trip_speed.html - - - /reference/string_to_seconds.html - - - /reference/validate_gtfs.html - - - /reference/write_gtfs.html - + +/404.html +/LICENSE-text.html +/articles/filtering.html +/articles/gtfstools.html +/articles/index.html +/articles/validating.html +/authors.html +/index.html +/news/index.html +/reference/as_dt_gtfs.html +/reference/convert_from_standard.html +/reference/convert_sf_to_shapes.html +/reference/convert_shapes_to_sf.html +/reference/convert_stops_to_sf.html +/reference/convert_time_to_seconds.html +/reference/convert_to_standard.html +/reference/copy_gtfs_diff_field_class.html +/reference/copy_gtfs_without_field.html +/reference/copy_gtfs_without_file.html +/reference/date_to_integer.html +/reference/download_validator.html +/reference/filter_by_agency_id.html +/reference/filter_by_route_id.html +/reference/filter_by_route_type.html +/reference/filter_by_service_id.html +/reference/filter_by_sf.html +/reference/filter_by_shape_id.html +/reference/filter_by_spatial_extent.html +/reference/filter_by_stop_id.html +/reference/filter_by_time_of_day.html +/reference/filter_by_trip_id.html +/reference/filter_by_weekday.html +/reference/frequencies_to_stop_times.html +/reference/get_children_stops.html +/reference/get_parent_station.html +/reference/get_stop_times_patterns.html +/reference/get_trip_duration.html +/reference/get_trip_geometry.html +/reference/get_trip_length.html +/reference/get_trip_segment_duration.html +/reference/get_trip_speed.html +/reference/gtfstools.html +/reference/index.html +/reference/integer_to_date.html +/reference/merge_gtfs.html +/reference/read_gtfs.html +/reference/remove_duplicates.html +/reference/seconds_to_string.html +/reference/set_trip_speed.html +/reference/string_to_seconds.html +/reference/validate_gtfs.html +/reference/write_gtfs.html +