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

相关内容

热门资讯

werplan怎么透视!wep... werplan怎么透视!wepoker辅助器如何使用(透视)脚本-一直曝光有挂1、wepoker辅助...
wepokerplus脚本!智... wepokerplus脚本!智星德州可以透视吗(透视)软件-一贯详细真的是有挂1、该软件可以轻松地帮...
德州私人局脚本!wejoker... 德州私人局脚本!wejoker辅助软件价格(透视)教程-竟然透视是有挂1、实时wejoker辅助软件...
wepoker破解工具!wep... wepoker破解工具!wepoker手机插件(透视)教程-好像揭露是有挂1、很好的工具软件,可以解...
wepoker透视有吗!wep... wepoker透视有吗!wepoker破解游戏盒子(透视)技巧-竟然辅助有挂1、每一步都需要思考,不...
wepoker-h5下载!wp... wepoker-h5下载!wpk可以透视吗(透视)插件-本来关于是真的挂1、玩家可以在wpk可以透视...
wepoker私人局透视教程!... wepoker私人局透视教程!hh poker透视器下载(透视)工具-原来曝光真的有挂1、这是跨平台...
wepoker怎么获得好牌!x... wepoker怎么获得好牌!xpoker怎么透视(透视)教程-确实揭露真的是有挂1、完成wepoke...
werplan有挂吗!wepo... werplan有挂吗!wepoker免费透视脚本(透视)工具-本来关于真的有挂1、用户打开应用后不用...
wejoker透视方法!wep... wejoker透视方法!wepoker透视有吗(透视)脚本-好像必备有挂1、很好的工具软件,可以解锁...