Google Maps将Directions API结果转换为渲染路线

问题描述

我想用从Directions API返回的数据在Google Maps JS地图上呈现路线。

因此,我首先从Directions API请求数据,然后得到{geocoded_waypoints: Array,routes: Array,status: "OK"}结果。

然后我要使用所述的renderer对象在地图上进行渲染:

const directionsRenderer = new google.maps.DirectionsRenderer()
directionsRenderer.setMap(map)
directionsRenderer.setDirections(RESULT_FROM_THE_DIRECTIONS_API)

但是在执行此操作时,出现以下错误

InvalidValueError: not a LatLngBounds or LatLngBoundsLiteral: unkNown property northeast

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)