Google Maps API v3 - 如何指定“VehicleType” [英] Google Maps API v3 - How to specify "VehicleType"

查看:137
本文介绍了Google Maps API v3 - 如何指定“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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆