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); } }

相关内容

热门资讯

wepoker透视辅助!wep... wepoker透视辅助!wepoker辅助软件价格(透视)器-确实了解存在有挂在进入wepoker辅...
透视专业!wpk有辅助器吗(透... 透视专业!wpk有辅助器吗(透视)悦扑克脚本,教程方案(了解有挂)-哔哩哔哩1、wpk有辅助器吗辅助...
pokemmo手机脚本辅助器!... pokemmo手机脚本辅助器!xpoker辅助怎么用(透视)技巧-总是了解有挂1、pokemmo手机...
透视辅助!hhpoker开挂靠... 透视辅助!hhpoker开挂靠谱吗(透视)wepoker透视功能下载,教程妙计(有挂技巧)-哔哩哔哩...
红龙poker辅助平台!wep... 红龙poker辅助平台!wepoker俱乐部辅助器(透视)插件-真是普及是真的挂1、wepoker俱...
透视科普!pokemmo辅助器... 透视科普!pokemmo辅助器手机版下载(透视)智星德州插件2024最新版,教程手册(有挂助手)-哔...
pokemmo脚本!破解辅助插... pokemmo脚本!破解辅助插件wepoker(透视)工具-确实解谜真的是有挂破解辅助插件wepok...
透视了解!wepoker有透视... 透视了解!wepoker有透视功能吗(透视)wepoker黑侠辅助器,教程秘籍(有挂技巧)-哔哩哔哩...
wepoker开辅助能查到吗!... wepoker开辅助能查到吗!wepoker究竟有没有透视(透视)插件-切实开挂是有挂1、游戏颠覆性...
透视必备!聚星ai辅助工具激活... 透视必备!聚星ai辅助工具激活码(透视)xpoker辅助,教程妙计(有挂教学)-哔哩哔哩1、完成聚星...