Google Map API:使用多种传输模式路由

时间:2016-03-16 07:03:34

标签: javascript api google-maps

我在Google地图中有要求。我有开始和结束点。在它们之间,几乎没有航路点。我必须通过航点连接起点和终点。使用谷歌地图api这是可行的,我已经这样做了。但在一种情况下,我必须绘制铁路线,即两个航点将通过铁路线连接。所以,我的路线包括汽车路线和铁路线。

示例:考虑A,B,C和D是地方。

A - 起始点,B-WayPoint 1,C - 航点2,D - 终点

A到B - 汽车路线

B到C - 铁路线

C到D - 车路线

我该怎么做。??

请指导我。!!

1 个答案:

答案 0 :(得分:0)

我希望这个例子用于并且必须注册YOUR_API_KEY 更改您的位置纬度和经度 flightPlanCoordinates javascript变量值

https://developers.google.com/maps/documentation/javascript/examples/polyline-simple?authuser=2

.top {
  position: absolute;
  top: 0px;
  left: 0px;
  height: auto;
  width: 50%;
}

.right {
  position: absolute;
  top: 0px;
  right: 0px;
  height: auto;
  width: 50%;
}

.left {
  position: absolute;
  left: 0px;
  bottom: 0px;
  height: auto;
  width: 50%;
}

.bottom {
  position: absolute;
  right: 0px;
  bottom: 0px;
  height: auto;
  width: 50%;
}