使用 Gmaps.js 绘制路线

Drawing routes using Gmaps.js

我正在为自己制作一个小型演示应用程序,我使用 Gmaps.js 库作为使用地图的主要工具,但在尝试绘制路线时遇到问题。

此代码(来自文档)运行良好

 map.drawRoute({
                    origin: [-12.044012922866312, -77.02470665341184],
                    destination: [-12.090814532191756, -77.02271108990476],
                    travelMode: 'driving',
                    strokeColor: '#131540',
                    strokeOpacity: 0.6,
                    strokeWeight: 6
                });

这个(我的)没用

 map.drawRoute({
                    origin: [32.090814532191756, -85.090814532191756],
                    destination: [32.000814532191756, -85.090814532191756],
                    travelMode: 'driving',
                    strokeColor: '#131540',
                    strokeOpacity: 0.6,
                    strokeWeight: 6
                });

你能帮我找出区别吗? 如果您能提供有关使用地图的任何其他库的建议,我将不胜感激。

根本原因在于 Google 地图 API 键。