TransitPreferences
Stay organized with collections
Save and categorize content based on your preferences.
Preferences for TRANSIT
based routes that influence the route that is returned.
Fields |
allowedTravelModes[] |
enum (TransitTravelMode )
A set of travel modes to use when getting a TRANSIT route. Defaults to all supported modes of travel.
|
routingPreference |
enum (TransitRoutingPreference )
A routing preference that, when specified, influences the TRANSIT route returned.
|
TransitTravelMode
A set of values used to specify the mode of transit.
Enums |
TRANSIT_TRAVEL_MODE_UNSPECIFIED |
No transit travel mode specified. |
BUS |
Travel by bus. |
SUBWAY |
Travel by subway. |
TRAIN |
Travel by train. |
LIGHT_RAIL |
Travel by light rail or tram. |
RAIL |
Travel by rail. This is equivalent to a combination of SUBWAY , TRAIN , and LIGHT_RAIL . |
TransitRoutingPreference
Specifies routing preferences for transit routes.
Enums |
TRANSIT_ROUTING_PREFERENCE_UNSPECIFIED |
No preference specified. |
LESS_WALKING |
Indicates that the calculated route should prefer limited amounts of walking. |
FEWER_TRANSFERS |
Indicates that the calculated route should prefer a limited number of transfers. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-27 UTC.
[null,null,["Last updated 2025-08-27 UTC."],[[["\u003cp\u003e\u003ccode\u003eTransitPreferences\u003c/code\u003e influence the \u003ccode\u003eTRANSIT\u003c/code\u003e based routes that are returned.\u003c/p\u003e\n"],["\u003cp\u003eYou can specify transit travel modes such as \u003ccode\u003eBUS\u003c/code\u003e, \u003ccode\u003eSUBWAY\u003c/code\u003e, \u003ccode\u003eTRAIN\u003c/code\u003e, \u003ccode\u003eLIGHT_RAIL\u003c/code\u003e, and \u003ccode\u003eRAIL\u003c/code\u003e or use the default of all supported modes.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eTransitPreferences\u003c/code\u003e also allow you to indicate preferences for \u003ccode\u003eLESS_WALKING\u003c/code\u003e or \u003ccode\u003eFEWER_TRANSFERS\u003c/code\u003e when calculating a route.\u003c/p\u003e\n"]]],["The content outlines preferences for `TRANSIT` routes, using a JSON structure with `allowedTravelModes` and `routingPreference`. `allowedTravelModes` specifies transit modes like `BUS`, `SUBWAY`, `TRAIN`, `LIGHT_RAIL`, or `RAIL`. `routingPreference` allows choosing between `LESS_WALKING` or `FEWER_TRANSFERS`, to influence the transit route, and it allows for selecting no preferences. All available preferences have a corresponding unspecified value. The default `allowedTravelModes` is all available options.\n"],null,["# TransitPreferences\n\n- [JSON representation](#SCHEMA_REPRESENTATION)\n- [TransitTravelMode](#TransitTravelMode)\n- [TransitRoutingPreference](#TransitRoutingPreference)\n\nPreferences for `TRANSIT` based routes that influence the route that is returned.\n\n| JSON representation |\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"allowedTravelModes\": [ enum (/maps/documentation/routes/reference/rest/v2/TransitPreferences#TransitTravelMode) ], \"routingPreference\": enum (/maps/documentation/routes/reference/rest/v2/TransitPreferences#TransitRoutingPreference) } ``` |\n\n| Fields ||\n|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `allowedTravelModes[]` | `enum (`[TransitTravelMode](/maps/documentation/routes/reference/rest/v2/TransitPreferences#TransitTravelMode)`)` A set of travel modes to use when getting a `TRANSIT` route. Defaults to all supported modes of travel. |\n| `routingPreference` | `enum (`[TransitRoutingPreference](/maps/documentation/routes/reference/rest/v2/TransitPreferences#TransitRoutingPreference)`)` A routing preference that, when specified, influences the `TRANSIT` route returned. |\n\nTransitTravelMode\n-----------------\n\nA set of values used to specify the mode of transit.\n\n| Enums ||\n|-----------------------------------|---------------------------------------------------------------------------------------------|\n| `TRANSIT_TRAVEL_MODE_UNSPECIFIED` | No transit travel mode specified. |\n| `BUS` | Travel by bus. |\n| `SUBWAY` | Travel by subway. |\n| `TRAIN` | Travel by train. |\n| `LIGHT_RAIL` | Travel by light rail or tram. |\n| `RAIL` | Travel by rail. This is equivalent to a combination of `SUBWAY`, `TRAIN`, and `LIGHT_RAIL`. |\n\nTransitRoutingPreference\n------------------------\n\nSpecifies routing preferences for transit routes.\n\n| Enums ||\n|------------------------------------------|----------------------------------------------------------------------------------|\n| `TRANSIT_ROUTING_PREFERENCE_UNSPECIFIED` | No preference specified. |\n| `LESS_WALKING` | Indicates that the calculated route should prefer limited amounts of walking. |\n| `FEWER_TRANSFERS` | Indicates that the calculated route should prefer a limited number of transfers. |"]]