Skip to main content

Public Transit Stops

Last updated: April 8, 2026 | 7 minutes read

This API provides access to public transport data including agencies, routes, stops, and trips. Fetch and explore real-time public transportation information from selected positions on the map.

Tip

The public transport data structure follows the General Transit Feed Specification (GTFS) and offers access to a subset of GTFS fields and entities.

Key features:

  • Query public transport overlays by screen position
  • Retrieve information about transport agencies, stops, routes, and trips
  • Access real-time data including delays and cancellations
  • View metadata about accessibility, bike allowances, and platform details

How it works:

  • Set a cursor position on the map using setCursorPosition(_:) on MapViewController
  • Retrieve overlay items at that position using getCursorSelectionOverlayItems()
  • Filter items by overlay UID to isolate public transit stops
  • Fetch extended stop data asynchronously using getPreviewExtendedDataWithCompletionHandler(_:) on each OverlayItemObject
  • Parse the returned SearchableParameterListObject using findPublicTransportListParameterType(_:) with the appropriate PublicTransportParameterType

Query Public Transit Stops

Implement the mapViewController(_:onLongTouchPoint:) delegate method on MapViewControllerDelegate. When the user long-presses the map, set the cursor to that position and retrieve public transit overlay items.

func mapViewController(_ mapViewController: MapViewController, onLongTouch point: CGPoint) {

mapViewController.setCursorPosition(point)

let overlays = mapViewController.getCursorSelectionOverlayItems()
let publicTransportId = Int(CommonOverlayIdentifier.publicTransport.rawValue)

for item in overlays where item.getOverlayUid() == publicTransportId {

guard item.hasPreviewExtendedData() else { continue }

item.getPreviewExtendedData { parametersList in
// agencies
let agencies = parametersList.findPublicTransportListParameterType(.agencies)
// stops (routes without heading set)
let stops = parametersList.findPublicTransportListParameterType(.stops)
// trips (route, agency, stop times, real-time info)
let trips = parametersList.findPublicTransportListParameterType(.trips)
// example of parsing stops
for stop in stops {

if let stopId = stop[PublicTransportStopParameterType.id.rawValue] as? NSValue,
let stopName = stop[PublicTransportStopParameterType.name.rawValue] as? NSValue {
print("Stop id: \(stopId) name: \(stopName)")
}

if let routes = stop[NSNumber(value: PublicTransportStopParameterType.routes.rawValue)] as? [[NSNumber: NSValue]] {
for route in routes {

if let value = route[NSNumber(value: PublicTransportRouteParameterType.shortName.rawValue)] {

if let data = value.nonretainedObjectValue as? NSData,
let name = String(data: data as Data, encoding: .utf8) {
print(" Route short name: \(name)")
}
}
}
}
}
}
}
}
danger

All returned times are local times encoded as Unix timestamps (seconds since 1970-01-01T00:00:00). Use TimezoneContext to convert them to other time zones.

danger

Two types of public transit stops exist on the map:

  • OverlayItemObject stops selected via getCursorSelectionOverlayItems() — provide extensive extended data and display with a blue icon (default style)
  • LandmarkObject stops selected via getCursorSelectionLandmarks() — provide limited details and display with a gray icon (default style)

Agencies

Agencies are returned as an array of [NSNumber: NSValue] dictionaries. Use PublicTransportAgencyParameterType enum values as keys.

KeyTypeDescription
PublicTransportAgencyParameterTypeIdNSValue (Int)Agency ID
PublicTransportAgencyParameterTypeNameNSValue (String)Full name of the transit agency
PublicTransportAgencyParameterTypeUrlNSValue (String)URL of the transit agency

Public Transport Routes

Route info is embedded within stop and trip dictionaries. Use PublicTransportRouteParameterType enum values as keys.

KeyTypeDescription
PublicTransportRouteParameterTypeIdNSValue (Int)Route ID
PublicTransportRouteParameterTypeShortNameNSValue (String)Short name (e.g., "32", "100X")
PublicTransportRouteParameterTypeLongNameNSValue (String)Full name, often including destination
PublicTransportRouteParameterTypeTypeNSValue (Int)Transport type — see PublicTransportRouteTransportType
PublicTransportRouteParameterTypeRouteColorNSValue (String)Route color as a hex string
PublicTransportRouteParameterTypeTextColorNSValue (String)Text color for use against route color
PublicTransportRouteParameterTypeHeadingNSValue (String)Optional heading information
danger

Route info embedded in stop and trip dictionaries provides information about public transit routes available at a specific stop. PTRouteObject represents a computed public transit route between multiple waypoints.

See Compute Public Transit Routes for computing routes.

Route transport types

The PublicTransportRouteTransportType enum represents the type of public transport route:

Enum valueDescription
PublicTransportRouteTransportTypeBusBus or trolleybus
PublicTransportRouteTransportTypeUndergroundSubway or metro
PublicTransportRouteTransportTypeRailwayIntercity or long-distance rail
PublicTransportRouteTransportTypeTramTram, streetcar, or light rail
PublicTransportRouteTransportTypeWaterTransportFerry or other water-based transit
PublicTransportRouteTransportTypeMiscOther types of public transport

Stops

Stops are returned as an array of [NSNumber: NSValue] dictionaries. Use PublicTransportStopParameterType enum values as keys.

KeyTypeDescription
PublicTransportStopParameterTypeIdNSValue (Int)Stop ID
PublicTransportStopParameterTypeNameNSValue (String)Name of the stop as it appears on timetables and signage
PublicTransportStopParameterTypeIsStationNSValue (Bool)Whether this location is a station containing one or more platforms
PublicTransportStopParameterTypeRoutesNSArray of route dictsRoutes serving this stop

Stop Times

Stop times are embedded within trip dictionaries under the PublicTransportTripParameterTypeStopTimes key. Each stop time is a [NSNumber: NSValue] dictionary. Use PublicTransportStopTimeParameterType enum values as keys.

KeyTypeDescription
PublicTransportStopTimeParameterTypeStopNameNSValue (String)Name of the serviced stop
PublicTransportStopTimeParameterTypeDepartureTimeNSValue (Int)Departure time (seconds since 1970-01-01T00:00:00)
PublicTransportStopTimeParameterTypeHasRealtimeNSValue (Bool)Whether data is provided in real-time
PublicTransportStopTimeParameterTypeDelayNSValue (Int)Delay in seconds. Not meaningful if hasRealtime is false
PublicTransportStopTimeParameterTypeIsBeforeNSValue (Bool)Whether the stop time is before the current time
PublicTransportStopTimeParameterTypeLatitudeNSValue (Double)Stop latitude
PublicTransportStopTimeParameterTypeLongitudeNSValue (Double)Stop longitude

Trips

Trips are returned as an array of [NSNumber: NSValue] dictionaries. Use PublicTransportTripParameterType enum values as keys.

KeyTypeDescription
PublicTransportRouteParameterTypeIdNSValue (Int)Route ID
PublicTransportRouteParameterTypeShortNameNSValue (String)Route short name
PublicTransportRouteParameterTypeLongNameNSValue (String)Route long name
PublicTransportRouteParameterTypeTypeNSValue (Int)Route transport type
PublicTransportRouteParameterTypeHeadingNSValue (String)Optional heading
PublicTransportTripParameterTypeHasRealtimeNSValue (Bool)Whether real-time data is available
PublicTransportTripParameterTypeDepartureTimeNSValue (Int)Departure time from first stop (seconds since 1970-01-01T00:00:00)
PublicTransportTripParameterTypeTripDateNSValue (Int)Date of the trip (seconds since 1970-01-01T00:00:00)
PublicTransportTripParameterTypeTripDelayMinutesNSValue (Int)Delay in minutes. Not meaningful if hasRealtime is false
PublicTransportTripParameterTypeStopPlatformCodeNSValue (String)Platform code
PublicTransportTripParameterTypeIndexNSValue (Int)Trip index
PublicTransportTripParameterTypeStopIndexNSValue (Int)Stop index
PublicTransportTripParameterTypeIsCancelledNSValue (Bool)Whether the trip is cancelled
PublicTransportTripParameterTypeWheelchairAccessibleNSValue (Int)Wheelchair accessibility — see PublicTransportWheelchairAccessibleType
PublicTransportTripParameterTypeBikesAllowedNSValue (Int)Bikes allowed — see PublicTransportBikesAllowedType
PublicTransportTripParameterTypeAgencyIdNSValue (Int)ID of the associated agency
PublicTransportTripParameterTypeStopTimesNSArray of stop time dictsDetails of stop times in the trip

Wheelchair accessibility values

ValueDescription
PublicTransportWheelchairAccessibleTypeNoInfoNo accessibility information
PublicTransportWheelchairAccessibleTypeYesAt least one wheelchair rider can be accommodated
PublicTransportWheelchairAccessibleTypeNoNo wheelchair riders can be accommodated

Bikes allowed values

ValueDescription
PublicTransportBikesAllowedTypeNoInfoNo bike information
PublicTransportBikesAllowedTypeYesAt least one bicycle can be accommodated
PublicTransportBikesAllowedTypeNoNo bicycles are allowed
danger

Route info in stop and trip dictionaries represents the public-facing service riders recognize (e.g., "Bus 42"). A trip is a single scheduled journey along that route at a specific time with its own stop times. The route is the line identity; trips are individual vehicle runs throughout the day.