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

相关内容

热门资讯

教程攻略!wpk辅助器(辅助挂... 教程攻略!wpk辅助器(辅助挂)其实存在有挂(有挂详情)1、这是跨平台的wpk辅助器轻量版有透视,在...
大家学习交流!hhpoker是... 大家学习交流!hhpoker是真的还是假的(辅助挂)一直是有挂(有挂讲解)1、点击下载安装,hhpo...
安装程序教程!wepoker辅... 安装程序教程!wepoker辅助透视(辅助挂)竟然真的有挂(有挂方式)1、全新机制【wepoker辅...
玩家必备教程!wepoker模... 玩家必备教程!wepoker模拟器哪个好用(辅助挂)一贯是有挂(有挂教学)1、下载好wepoker模...
玩家攻略!hhpoker辅助软... 玩家攻略!hhpoker辅助软件是真的么(辅助挂)真是有挂(新版有挂)1、hhpoker辅助软件是真...
玩家攻略!we-poker辅助... 玩家攻略!we-poker辅助(辅助挂)本来有挂(有挂秘笈)1)we-poker辅助辅助插件:进一步...
玩家必备科技!wpk辅助是什么... 您好,wpk辅助是什么这款游戏可以开挂的,确实是有挂的,需要了解加去威信【136704302】很多玩...
大神推荐!哈糖大菠萝辅助器(辅... 大神推荐!哈糖大菠萝辅助器(辅助挂)确实是真的有挂(有人有挂)1、玩家可以在哈糖大菠萝辅助器线上大神...
传递经验!hhpoker是正规... 传递经验!hhpoker是正规的吗(辅助挂)都是存在有挂(确实有挂)亲,关键说明,hhpoker是正...
科普!xpoker怎么作弊(辅... 科普!xpoker怎么作弊(辅助挂)都是是真的有挂(有挂详情)xpoker怎么作弊脚本下载中分为三种...