2

我正在构建一个网页,我可以在其中选择来源和目的地位置,然后在 Google 地图上显示距离、旅行时间(当前流量)和实际流量。

Google Maps API 文档建议使用 Google Maps Embed API,如下所示(路线 = 巴黎到阿姆斯特丹):

<iframe src="https://www.google.com/maps/embed/v1/directions?origin=Paris&destination=Amsterdam&key=APIKEY"></iframe>

这工作正常。现在我想向路线添加航点,以便我确定将选择并显示某些特定路线,因此(路线=巴黎经布鲁塞尔到阿姆斯特丹):

<iframe src="https://www.google.com/maps/embed/v1/directions?origin=Paris&destination=Amsterdam&waypoints=Brussels&key=APIKEY"></iframe>

在这种情况下,不会显示任何交通流量,并且计算的行程时间不包括由于交通造成的延误。您还可以在我为显示问题而构建的此页面上看到效果。

我在 Google Maps Embed API 文档中没有发现使用航点时未显示流量。这是一个错误还是我读得不够好?是否有 Google Maps Embed API 的替代品?

4

0 回答 0