Google Maps API v3 – How to specify “VehicleType”-Collection of common programming errors

I’m having some difficulties to specify Vehicle Type in my request. According to the documentation, it should look like something like this:

var request = {
    origin:start,
    destination:end,
    travelMode: google.maps.DirectionsTravelMode.DRIVING,
    TransitDetails: google.maps.TransitLine.TransitVehicle.VehicleType.BUS
};

But the folowing error shows up every time:

TypeError: google.maps.TransitLine is undefined

I think there’s something wrong with my TransitDetails path.. but I can’t figure out what exactly…

  1. There is no TransitDetails-option for a directionsRequest.

    There is only a TransitOptions-option where you can define departureTime and arrivalTime . The vehicleType is a part of the directionsResponse and is a simple string(e.g. BUS)

Originally posted 2013-11-09 21:39:09.