Calculate a single isochrone from a given start station, returning the list of all stations reachable to the specified end_time.

gtfs_isochrone(
  gtfs,
  from,
  start_time,
  end_time,
  day = NULL,
  from_is_id = FALSE,
  route_pattern = NULL,
  hull_alpha = 0.1,
  quiet = FALSE
)

Arguments

gtfs

A set of GTFS data returned from extract_gtfs or, for more efficient queries, pre-processed with gtfs_timetable.

from

Name, ID, or approximate (lon, lat) coordinates of start station (as stop_name or stop_id entry in the stops table, or a vector of two numeric values).

start_time

Desired departure time at from station, either in seconds after midnight, a vector of two or three integers (hours, minutes) or (hours, minutes, seconds), an object of class difftime, hms, or lubridate.

end_time

End time to calculate isochrone

day

Day of the week on which to calculate route, either as an unambiguous string (so "tu" and "th" for Tuesday and Thursday), or a number between 1 = Sunday and 7 = Saturday. If not given, the current day will be used. (Not used if gtfs has already been prepared with gtfs_timetable.)

from_is_id

Set to TRUE to enable from parameter to specify entry in stop_id rather than stop_name column of the stops table (same as from_to_are_ids parameter of gtfs_route).

route_pattern

Using only those routes matching given pattern, for example, "^U" for routes starting with "U" (as commonly used for underground or subway routes. (Parameter not used at all if gtfs has already been prepared with gtfs_timetable.)

hull_alpha

alpha value of non-convex hulls returned as part of result (see ?alphashape::ashape for details).

quiet

Set to TRUE to suppress screen messages (currently just regarding timetable construction).

Value

An object of class gtfs_isochrone, including sf-formatted points representing the from station (start_point), the terminal end stations (end_points), and all intermediate stations (mid_points) each with the earliest possible arrival time, along with lines representing the individual routes. A non-convex ("alpha") hull is also returned (as an sf POLYGON object), including measures of area and "elongation", which equals zero for a circle, and increases towards one for more elongated shapes.

Examples

berlin_gtfs_to_zip () f <- file.path (tempdir (), "vbb.zip") g <- extract_gtfs (f)
#> Unzipping GTFS archive
#> ✔ Unzipped GTFS archive
#> Extracting GTFS feed
#> ✔ Extracted GTFS feed
#> Converting stop times to seconds
#> ✔ Converted stop times to seconds
#> Converting transfer times to seconds
#> ✔ Converted transfer times to seconds
g <- gtfs_timetable (g)
#> Day not specified; extracting timetable for Monday
from <- "Alexanderplatz" start_time <- 12 * 3600 + 600 end_time <- start_time + 600 ic <- gtfs_isochrone (g, from = from, start_time = start_time, end_time = end_time)
#> Loading required namespace: geodist
#> Loading required namespace: lwgeom
#> Registered S3 method overwritten by 'spatstat': #> method from #> print.boxx cli
#> Linking to GEOS 3.8.1, GDAL 3.1.1, PROJ 6.3.1
if (FALSE) { plot (ic) }