将地图路线转换为轨迹或 GPS 坐标

Convert Map Route to tracks or GPS Coordinates

从点A(coodinate/point)到点B[=19的导航路线=](coodinate/point) -

我想知道我是否可以将它们转换成 GPS 坐标列表( 或轨迹 ),具有固定的间隔,即这些坐标将追踪出路线

我找到了一种使用 OSRM 的方法 如果我们发送这个 request-

我们将获得 JSON 格式的输出,其中列出了位置。添加了我制作的示例代码-

URL = "http://router.project-osrm.org/route/v1/driving/"+args.coord+"?overview="+args.ovw+"&steps="+args.steps

r=requests.get(URL, verify=False)
data = r.json()    

if data["code"]=='Ok':
    for i in range(len(data["routes"])):
        for j in range(len(data["routes"][i]["legs"])):
            for k in range(len(data["routes"][i]["legs"][j]["steps"])):
                for l in range(len(data["routes"][i]["legs"][j]["steps"][k]["intersections"])):
                    locations_i.append(data["routes"][i]["legs"][j]["steps"][k]["intersections"][l]["location"])