Skip to content
Documentation

Transitland v2 Vector Tiles

Last updated

Transitland publishes the routes and stops of every active feed version as two tilesets in Mapbox Vector Tile (MVT) format. Each feature carries the attributes to label, style, filter, and link it: names, colors, route types, operators, and Onestop IDs. Use a feature's Onestop ID to look up the full route or stop in the REST or GraphQL API.

Requests

Tiles are addressed by zoom, column, and row in the XYZ scheme:

https://transit.land/api/v2/tiles/routes/tiles/{z}/{x}/{y}.pbf
https://transit.land/api/v2/tiles/stops/tiles/{z}/{x}/{y}.pbf

Send your API key in the apikey header, or as the apikey query parameter for clients that cannot set headers. To get a key, see Signing up for an API key.

StatusMeaning
200The tile, as application/x-protobuf, gzip-encoded
204No features in this tile, or a zoom past the tileset's maximum
400A column or row outside the zoom level's range
401Missing or unknown API key
429Rate limit or fair-use limit reached

Each tileset also has a TileJSON document, at https://transit.land/api/v2/tiles/routes and https://transit.land/api/v2/tiles/stops, which a MapLibre source can use as its url. Its tile URLs do not include your key, so send the key with each tile request, for example with MapLibre's transformRequest option. An OpenAPI description of both tilesets is at https://transit.land/api/v2/tiles/openapi.json.

Freshness and IDs

The tiles are rebuilt daily from the active feed versions, so they can lag the REST and GraphQL APIs by up to a day.

Each feature's ID is Transitland's internal integer ID for the route or stop, so MapLibre can use feature state without promoteId. Internal IDs change when a feed version is replaced. To store or link to a route or stop, use its onestop_id.

Lists and objects are stored as JSON strings. Parse them in your code, for example in a click handler. Their fields are listed under Show fields. An attribute with no value, such as a blank route_short_name, is omitted from the feature.

Route tiles

GEThttps://transit.land/api/v2/tiles/routes/tiles/{z}/{x}/{y}.pbf

Layer routes, the source-layer a style names
Features One line feature per route. A route's attributes are its GTFS fields, its agency and operator, and its extent.
Geometry The route's top-ranked representative shape at zooms 0 to 7, and all of its representative shapes at 8 to 14. A decoder reports a feature as LineString or MultiLineString by how many lines it has in the tile, so a style filter should match both.
Zooms 0 to 14. Set maxzoom: 14 on the source, so a map zoomed in further draws from zoom 14 tiles. At zooms 0 to 7, crowded routes are clustered; see clustered.
Feature ID Internal route ID. Changes when the feed version is replaced; store onestop_id instead.
onestop_idstring
Onestop ID of the route, stable across feed versions. See Onestop IDs.

Example:r-9q9-yl~s

route_idstringrequired
GTFS routes.route_id.

Example:YL-S

route_short_namestring
GTFS routes.route_short_name. Absent when blank in the feed.

Example:Yellow-S

route_long_namestring
GTFS routes.route_long_name. Absent when blank in the feed.

Example:Antioch to SFIA/Millbrae

route_colorstringrequired
GTFS routes.route_color, lowercase, with a leading #. # alone when the feed has no color, which is not a valid color; styles need a fallback.

Example:#ffff33

route_typeintegerrequired
GTFS routes.route_type, including extended types such as 702 (express bus). See Route vehicle types.

Example:1

route_type_basicintegerrequired
Basic GTFS route type of route_type, such as 3 (bus) for 702 (express bus). See Route vehicle types.

Example:1

agency_idstring
GTFS agency.agency_id of the route's agency. Absent when blank in the feed.

Example:BART

agency_namestring
GTFS agency.agency_name of the route's agency.

Example:Bay Area Rapid Transit

operator_namestring
Name of the Transitland operator of the route's agency, which can differ from agency_name. Absent when the agency has no operator.

Example:Bay Area Rapid Transit

operator_short_namestring
Short name of the operator. Absent when it has none.

Example:BART

operator_onestop_idstring
Onestop ID of the operator. Absent when the agency has no operator. See Agencies and operators.

Example:o-9q9-bart

headway_secsintegerrequired
Shortest typical headway of the route, in seconds, across weekday, Saturday, and Sunday service in both directions. 100000 when unknown.

Example:960

generatedbooleanrequired
True when the geometry was generated from stop locations because the feed has no shapes for the route. See Route geometries.

Example:false

geometry_lengthnumber
Length of the route's representative geometry in meters.

Example:48293.4

geometry_max_segment_lengthnumber
Longest distance between consecutive points of the geometry, in meters. Large values suggest a generated or simplified line.

Example:1204.2

bboxstring (JSON array)required
Extent of the route's full geometry, as [west, south, east, north]. Tiles clip routes; use this to fit a map to the whole route.

Example:[-122.57092,37.77622,-122.39602,38.11394]

agency_bboxstring (JSON array)
Extent of the agency's stops, or its routes when it has no stops with locations, as [west, south, east, north]. Absent when the agency has neither.

Example:[-122.74045,37.77761,-122.31666,38.47208]

operator_bboxstring (JSON array)
Extent of all of the operator's agencies, as [west, south, east, north]. Absent when the agency has no operator.

Example:[-122.74045,37.77761,-122.31666,38.47208]

placesstring (JSON array)required
Countries and states or provinces the route's stops are in, the place with the most stops first. See Places.

Example:[{"adm0_name":"United States of America","adm0_iso":"US","adm1_name":"California","adm1_iso":"US-CA"}]

places.adm0_namestringrequired
Country name.

Example:United States of America

places.adm0_isonullable stringrequired
ISO 3166-1 country code.

Example:US

places.adm1_namenullable stringrequired
State or province name. null outside any state or province.

Example:California

places.adm1_isonullable stringrequired
ISO 3166-2 state or province code.

Example:US-CA

clusteredboolean
Zooms 0 to 7 only. True when tippecanoe dropped nearby routes to keep the tile under its size limit and this feature represents them. Other attributes describe this route only.

Example:true

point_countinteger
Zooms 0 to 7 only, on clustered features: number of routes represented, including this one.

Example:2

sqrt_point_countnumber
Zooms 0 to 7 only, on clustered features: square root of point_count, rounded to two decimal places, for scaling line width.

Example:1.41

Stop tiles

GEThttps://transit.land/api/v2/tiles/stops/tiles/{z}/{x}/{y}.pbf

Layer stops, the source-layer a style names
Features One point feature per stop, station, entrance, node, and boarding area. A stop's attributes are its GTFS fields, its place, and the agencies, operators, and routes serving it.
Geometry Point.
Zooms 0 to 14. Set maxzoom: 14 on the source, so a map zoomed in further draws from zoom 14 tiles. All stops from zoom 12. Below zoom 12, tiles hold a sample that shrinks at each lower zoom.
Feature ID Internal stop ID. Changes when the feed version is replaced; store onestop_id instead.
onestop_idstringrequired
Onestop ID of the stop, stable across feed versions. See Onestop IDs.

Example:s-9q9p19ut0x-12thstreet~oaklandcitycenter

stop_idstringrequired
GTFS stops.stop_id.

Example:12TH

stop_namestring
GTFS stops.stop_name. Absent when blank in the feed, as is common for nodes and boarding areas.

Example:12th Street / Oakland City Center

location_typeintegerrequired
GTFS stops.location_type. See Stop location types.
Values
0Stop or platform
1Station
2Entrance or exit
3Generic node
4Boarding area
feed_onestop_idstringrequired
Onestop ID of the feed the stop comes from. See Source feeds.

Example:f-9q9-bart

feed_version_sha1stringrequired
SHA1 of the source feed version: the feed's active version when the tiles were built. See Static GTFS feed versions.

Example:8aafa62e9ffcb5a3d7c3a8f4ef0be7f5a7c2c4d1

parent_stationstring (JSON object)
The station this stop belongs to, from GTFS stops.parent_station. Absent when the stop has none. See Stop hierarchies.
parent_station.idintegerrequired
Internal ID of the station. Not stable across feed versions.

Example:32915959

parent_station.onestop_idstringrequired
Onestop ID of the station.

Example:s-9q9p19ut0x-12thstreet~oaklandcitycenter

parent_station.stop_idstringrequired
GTFS stops.stop_id of the station.

Example:12TH

parent_station.stop_namenullable stringrequired
GTFS stops.stop_name of the station. null when blank.

Example:12th Street / Oakland City Center

parent_station.location_typeintegerrequired
GTFS stops.location_type of the station, normally 1.

Example:1

parent_station.geometrynullable objectrequired
Location of the station, as a GeoJSON Point.
parent_station.feed_onestop_idstringrequired
Onestop ID of the feed.

Example:f-9q9-bart

parent_station.feed_version_sha1stringrequired
SHA1 of the feed version.

Example:8aafa62e9ffcb5a3d7c3a8f4ef0be7f5a7c2c4d1

adm0_namestring
Country containing the stop. Absent outside any country.

Example:United States of America

adm0_isostring
ISO 3166-1 code of the country the stop is in.

Example:US

adm1_namestring
State or province containing the stop. Absent outside any state or province.

Example:California

adm1_isostring
ISO 3166-2 code of the state or province the stop is in.

Example:US-CA

operator_namestring
Operator of the stop's first agency that has one. Absent when no agency has an operator.

Example:Bay Area Rapid Transit

operator_short_namestring
Short name of that operator. Absent when it has none.

Example:BART

operator_onestop_idstring
Onestop ID of that operator. See Agencies and operators.

Example:o-9q9-bart

agenciesstring (JSON array)required
Agencies with routes serving the stop, or serving a station's platforms. Empty when no route serves it.

Example:[{"id":3804935,"agency_id":"BART","agency_name":"Bay Area Rapid Transit","onestop_id":"o-9q9-bart"}]

agencies.idintegerrequired
Internal ID of the agency. Not stable across feed versions.

Example:3804935

agencies.agency_idnullable stringrequired
GTFS agency.agency_id. null when blank in the feed.

Example:BART

agencies.agency_namestringrequired
GTFS agency.agency_name.

Example:Bay Area Rapid Transit

agencies.onestop_idstringrequired
Onestop ID of the agency's operator. An empty string when it has none.

Example:o-9q9-bart

agency_onestop_idsstring (JSON array)required
Onestop IDs of the operators of agencies, sorted, for filtering stops by operator.

Example:["o-9q9-bart"]

route_onestop_idsstring (JSON array)required
Onestop IDs of the routes serving the stop, sorted.

Example:["r-9q9-yl~s","r-9q9-rd~s"]

route_typesstring (JSON array)required
The distinct route_type values of the routes serving the stop, sorted.

Example:[1]

route_types_basicstring (JSON array)required
The distinct route_type_basic values of the routes serving the stop, sorted.

Example:[1]

routesstring (JSON array)required
Routes serving the stop, with enough attributes to list and style them without the route tiles. Routes without geometry appear only in route_onestop_ids and route_types.
routes.idintegerrequired
Internal ID of the route, its route tile feature's ID. Not stable across feed versions.

Example:8472496

routes.route_idstringrequired
GTFS routes.route_id.

Example:YL-S

routes.onestop_idnullable stringrequired
Onestop ID of the route.

Example:r-9q9-yl~s

routes.route_short_namenullable stringrequired
GTFS routes.route_short_name. null when blank in the feed.

Example:Yellow-S

routes.route_long_namenullable stringrequired
GTFS routes.route_long_name. null when blank in the feed.

Example:Antioch to SFIA/Millbrae

routes.route_colorstringrequired
Same as the route feature's route_color.

Example:#ffff33

routes.route_typeintegerrequired
GTFS routes.route_type.

Example:1

routes.route_type_basicintegerrequired
The basic GTFS route type of route_type.

Example:1

routes.bboxarray of numbersrequired
Extent of the route, as [west, south, east, north].
routes.operator_namenullable stringrequired
Name of the route's operator. null, with the other operator_ fields, when the route's agency has no operator.

Example:Bay Area Rapid Transit

routes.operator_short_namenullable stringrequired
Short name of the route's operator. null when it has none.

Example:BART

routes.operator_onestop_idnullable stringrequired
Onestop ID of the route's operator.

Example:o-9q9-bart

routes.operator_bboxnullable array of numbersrequired
Extent of the route's operator, as [west, south, east, north].