[Python & 高德地图] API调用学习历程(二)

[二]路径规划调用

#路径规划
def walking(origin: str,destination: str)->dict:
    parameters = {'key':key,
                  'origin':origin,
                  'destination':destination,
                  'output':'json'
                  }
    r = requests.get("https://restapi.amap.com/v3/direction/walking?parameters",params = parameters)
    data = r.json()['route']['paths'][0]['steps']
    for i in range(0,len(data)):
        print(data[int(i)]['instruction'])

如需应用在嵌入式产品,可至高德地图开发者平台查询每一步字符编码等信息。

你可能感兴趣的:(高德地图API相关)