AppsScriptGoogleDirectionAPI-arrival_stopreturningERROR
创始人
2024-11-10 09:00:26
0
  1. 确认输入参数的正确性,包括起点、终点和交通工具等信息是否正确,以及是否遵循API的请求格式;
  2. 检查Google Direction API的状态是否正常,有时候API服务会暂时不可用,导致出现错误;
  3. 确认账户是否有足够的调用配额,如果API配额不足也可能导致返回错误结果;
  4. 如果以上步骤均无法解决问题,可以尝试使用其他的Google Maps API或其他方案进行路线规划。

代码示例:

function getDirections() { var start = 'San Francisco, CA'; var destination = 'Los Angeles, CA'; var mode = 'driving'; var waypoints = 'optimize:true|San Jose, CA|Santa Cruz, CA';

var url = 'https://maps.googleapis.com/maps/api/directions/json?' + 'origin=' + start + '&' + 'destination=' + destination + '&' + 'mode=' + mode + '&' + 'waypoints=' + waypoints + '&' + 'key=' + YOUR_API_KEY;

var response = UrlFetchApp.fetch(url); var directions = JSON.parse(response.getContentText());

if (directions.status == 'OK') { var legs = directions.routes[0].legs; for (var i = 0; i < legs.length; i++) { var steps = legs[i].steps; for (var j = 0; j < steps.length; j++) { var step = steps[j]; var instructions = step.html_instructions; var distance = step.distance.text; Logger.log(instructions + ' (' + distance + ')'); } } } else { Logger.log('Directions service returned an error: ' + directions.error_message); } }

相关内容

热门资讯

现有说明如下!aapoker辅... 现有说明如下!aapoker辅助工具安全吗,wepoker分析(透视)科普教程(新版有挂)-哔哩哔哩...
反观!wpk模拟器是什么,we... 反观!wpk模拟器是什么,wepoker辅助软件视频(透视)有挂教程(有挂详细)-哔哩哔哩1、wep...
事发当天!wepoker高级辅... 事发当天!wepoker高级辅助,cloudpoker辅助(透视)了解教程(有挂详细)-哔哩哔哩1、...
透视有挂!来玩app破解版,哈... 透视有挂!来玩app破解版,哈糖大菠萝能开挂吗(透视)曝光教程(有挂方法)-哔哩哔哩1、这是跨平台的...
据统计!wepoker怎么破解... 据统计!wepoker怎么破解游戏,wepoker正确养号方法(透视)必备教程(揭秘有挂)-哔哩哔哩...
据报道!wepoker插件程序... 据报道!wepoker插件程序激活码,aapoker透视怎么用(透视)曝光教程(有挂工具)-哔哩哔哩...
透视ai!wepoker私人局... 透视ai!wepoker私人局开挂视频,sohoo poker辅助(透视)了解教程(有挂方法)-哔哩...
辅助透视!wepokerplu... 辅助透视!wepokerplus到底是挂了吗,werplan免费挂下载(透视)推荐教程(发现有挂)-...
截至目前!aapoker透视怎... 您好,aapoker透视怎么用这款游戏可以开挂的,确实是有挂的,需要了解加去威信【485275054...
透视好牌!aapoker公共底... 透视好牌!aapoker公共底牌,wepoker好友房开挂(透视)总结教程(有挂工具)-哔哩哔哩1、...