I would like to be able to get transit directions through the JS api, that is limited to a single vehicle type (e.g. Bus). This functionality is available on maps.google.com, but how do i submit the vehicle type as part of the DirectionsRequest?. Using the code below will provide routes via Bus, Train


But if i want to restrict only to Train, how do i do it?

  • but it is not working with this code help me out ..plzzzz it's urgent <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <title>Displaying text directions with <code>setPanel()</code></title> <style> html, body, #map-canvas { height: 100%; margin: 0px; padding: 0px } #panel { position: absolute; top: 5px; left: 50%; margin-left: -180px; z-index: 5; background-color: #fff; padding: 5px; border: 1px solid #999; } </style> <style> #directions-panel { height: 100%; float: right; width: 390px; overflow: auto; } #map-canvas { mar – user37368 Sep 24 '14 at 8:41

google.maps.VehicleType object specification

Possible values for vehicle types. These values are specifed as strings, i.e. 'BUS' or 'TRAIN'.

BUS Bus.

CABLE_CAR A vehicle that operates on a cable, usually on the ground. Aerial cable cars may be of the type GONDOLA_LIFT.

COMMUTER_TRAIN Commuter rail.

FERRY Ferry.

FUNICULAR A vehicle that is pulled up a steep incline by a cable.

GONDOLA_LIFT An aerial cable car.

HEAVY_RAIL Heavy rail.

HIGH_SPEED_TRAIN High speed train.

INTERCITY_BUS Intercity bus.

METRO_RAIL Light rail.

MONORAIL Monorail.

OTHER Other vehicles. RAIL Rail.

SHARE_TAXI Share taxi is a sort of bus transport with ability to drop off and pick up passengers anywhere on its route. Generally share taxi uses minibus vehicles. SUBWAY Underground light rail.

TRAM Above ground light rail.

TROLLEYBUS Trolleybus.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.