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

相关内容

热门资讯

4分钟辅助!werplan透视... 4分钟辅助!werplan透视挂,pokernow辅助工具,策略教程(有挂详细)1、pokernow...
6分钟辅助!aapoker真的... 6分钟辅助!aapoker真的假的,wepoker开脚本视频,技法教程(有挂解惑)1、下载好wepo...
第一分钟辅助!we poker... 第一分钟辅助!we poker免费辅助器,wpk插件,绝活儿教程(有挂分享)1、we poker免费...
第一分钟辅助!wepoker辅... 第一分钟辅助!wepoker辅助器官方,wepoker游戏的安装教程,指南教程(新版有挂)wepok...
第九分钟辅助!aapoker脚... 第九分钟辅助!aapoker脚本,德普之星透视辅助软件激活码,机巧教程(有挂秘籍)德普之星透视辅助软...
第1分钟辅助!wpk可以作弊吗... 第1分钟辅助!wpk可以作弊吗,steampokermaster辅助,举措教程(真是有挂)1、ste...
第一分钟辅助!德州透视脚本,h... 第一分钟辅助!德州透视脚本,hhpoker有辅助吗,攻略教程(有挂辅助)1、完成hhpoker有辅助...
3分钟辅助!hhpoker辅助... 3分钟辅助!hhpoker辅助器,德普之星辅助软件,练习教程(有挂猫腻)1、下载好德普之星辅助软件脚...
一分钟辅助!hh poker辅... 一分钟辅助!hh poker辅助器先试用,wepoker是不是有人用挂,烘培教程(有挂解惑)1、we...
第8分钟辅助!wepoker代... 第8分钟辅助!wepoker代打辅助,wpk软件是正规的吗,指南教程(有挂分析)1、操作简单,无需w...