Google Maps API v3 - 如何指定“VehicleType” [英] Google Maps API v3 - How to specify "VehicleType"
问题描述
在我的要求中指定车辆类型时遇到一些困难。根据文档,它应该看起来像这样:
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
我认为我的TransitDetails路径存在问题..但我无法弄清楚究竟是什么...
I think there's something wrong with my TransitDetails path.. but I can't figure out what exactly...
推荐答案
no TransitDetails
- 选择 directionsRequest
。
There is no TransitDetails
-option for a directionsRequest
.
只有 TransitOptions
- 选项,您可以在其中定义 departureTime
和 arrivalTime
。 vehicleType
是 directionsResponse
的一部分,并且是一个简单的字符串(例如 BUS
)
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
)
这篇关于Google Maps API v3 - 如何指定“VehicleType”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!