网格距离计算
def get_dis_tm(origin, destination): url = 'https://restapi.amap.com/v3/direction/driving?' key = '208ce530fdd2dc162c8831657fff3232' #这里就是需要去高德开放平台去申请key,请在xxxx位置填写 link = '{}origin={}&destination={}&key={}&strategy={}'.format(url, origin ,destination , key,"2") response = requests.get(link) dis, tm = 999999, 999999 if response.status_code == 200: results = response.json() if results['status'] == '1': for temp in results['route']['paths']: print(temp['distance']) if results['status'] == '1': dis = int(results['route']['paths'][0]['distance']) tm = int(results['route']['paths'][0]['duration']) else: print(link) response.close() return dis, tm
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现