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

相关内容

热门资讯

今年以来!智星菠萝透视(透视)... 今年以来!智星菠萝透视(透视)一贯是有挂的(有挂头条开挂辅助安装)-哔哩哔哩1、下载好智星菠萝透视辅...
此事引发广泛关注!智星德州有脚... 此事引发广泛关注!智星德州有脚本吗,哈糖大菠萝助手,学习教程(确实有挂)-哔哩哔哩1、智星德州有脚本...
更值得关注的是!hhpoker... 更值得关注的是!hhpoker脚本下载(透视)果然确实有挂(揭秘有挂开挂辅助插件)-哔哩哔哩1、起透...
据统计!智星菠萝可以辅助吗,n... 据统计!智星菠萝可以辅助吗,newpoker怎么安装脚本,阶段教程(有挂透视)-哔哩哔哩1、起透看视...
据监测!pokemmo免费脚本... 据监测!pokemmo免费脚本(透视)原来确实有挂(揭秘有挂开挂辅助工具)-哔哩哔哩1、pokemm...
据通报!wepoker轻量版透... 据通报!wepoker轻量版透视方法,wepoker俱乐部辅助,模板教程(有挂技巧)-哔哩哔哩1、打...
据权威媒体报道!wepoker... 据权威媒体报道!wepoker手机助手(透视)一直是有挂的(有挂教学开挂辅助工具)-哔哩哔哩在进入w...
围绕透视问题!wepoker透... 围绕透视问题!wepoker透视辅助下载,智星菠萝有挂吗,攻略教程(有挂辅助)-哔哩哔哩1、进入到w...
据玩家消息!pokemmo免费... 据玩家消息!pokemmo免费脚本(透视)一直有挂(有挂总结开挂辅助神器)-哔哩哔哩1、让任何用户在...
目前!poker辅助器免费安装... 目前!poker辅助器免费安装,德州局透视脚本,模板教程(今日头条)-哔哩哔哩1、让任何用户在无需p...