Learn R Programming

GTFSwizard (version 1.1.0)

plot_corridor: Plot Transit Corridors

Description

The `plot_corridor` function visualizes high-density transit corridors on a map. It overlays the identified corridors on the route shapes from the GTFS data, providing a representation of the transit network and its key corridors.

Usage

plot_corridor(gtfs, i = 0.01, min.length = 1500)

Value

A `ggplot` object representing the transit network with corridors overlaid. The plot includes:

Base map

Route shapes from the GTFS data, displayed in gray.

Corridors

High-density transit corridors, colored uniquely for each corridor.

Arguments

gtfs

A GTFS object, preferably of class `wizardgtfs`. If not, the function will attempt to convert it using `GTFSwizard::as_wizardgtfs()`.

i

A numeric value representing the percentile threshold for selecting high-density segments. Defaults to `0.01` (top 1% of segments by trip frequency).

min.length

A numeric value specifying the minimum corridor length (in meters) to retain. Defaults to `1500`.

Details

The function performs the following steps:

  1. Extracts route shapes from the GTFS data using `get_shapes_sf`.

  2. Identifies transit corridors using the `get_corridor` function with the specified `i` and `min.length` parameters.

  3. Creates a map using `ggplot2` with:

    1. Route shapes as the base layer (gray lines).

    2. High-density transit corridors as colored lines, with transparency for visualization.

See Also

[GTFSwizard::get_corridor()], [GTFSwizard::get_shapes_sf()]

Examples

Run this code
plot_corridor(for_bus_gtfs, i = 0.02, min.length = 2000)


Run the code above in your browser using DataLab