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软件辅... 透视法子!wepoker软件辅助程序,wepoker私人局透视教程(透视)真是真的是有脚本插件(哔哩...
透视积累!德扑之心免费透视,德... 透视积累!德扑之心免费透视,德普之星透视辅助软件是真的吗(透视)其实是有脚本挂(哔哩哔哩)1、德普之...
透视积累!aapoker插件,... 透视积累!aapoker插件,aapoker透视怎么用(透视)切实是真的透视软件(哔哩哔哩)1、aa...
透视指南!hhpoker作必弊... 透视指南!hhpoker作必弊码,sohoo poker辅助器(透视)都是存在有挂(哔哩哔哩)该软件...
透视手段!wepoker轻量版... 透视手段!wepoker轻量版有透视吗,wepoker智能辅助插件(透视)果然真的是有透视app(哔...
透视模块!wepoker透视脚... 透视模块!wepoker透视脚本下载,WePOker有没有透视方法(透视)真是是有透视器(哔哩哔哩)...
透视绝活!德州局怎么透视,wp... 透视绝活!德州局怎么透视,wpk有那种辅助吗(透视)真是是真的挂(哔哩哔哩)1、打开软件启动之后找到...
透视操作!hhpoker辅助挂... 透视操作!hhpoker辅助挂是真的吗,hhpoker德州真的假的(透视)切实有挂(哔哩哔哩)亲,关...
透视绝活!德州局怎么透视,wp... 透视绝活!德州局怎么透视,wpk有那种辅助吗(透视)真是真的有挂(哔哩哔哩)1、首先打开wpk有那种...
透视指南!wepoker好友局... 透视指南!wepoker好友局透视,购买wepoker模拟器(透视)一直真的有挂(哔哩哔哩)1、在w...