我正在使用 MapBox Directions API。它不适用于某些位置。 例如
https://api.mapbox.com/directions/v5/mapbox/driving-traffic/54.7124996,25.2623823;54.6813069,25.3061969?access_token={ACESS_TOKEN}
返回我的响应,其中距离和持续时间等于 0,这是错误的。
{"routes":[{"weight_typical":0,"duration_typical":0,"weight_name":"auto","weight":0,"duration":0,"distance":0,"legs":[{"via_waypoints":[],"admins":[{"iso_3166_1":""}],"weight_typical":0,"duration_typical":0,"weight":0,"duration":0,"steps":[],"distance":0,"summary":""}],"geometry":"yanyCiyslI??"}],"waypoints":[{"distance":7001.088,"name":"","location":[54.665333,25.308605]},{"distance":1629.751,"name":"","location":[54.665333,25.308605]}],"code":"Ok","uuid":"G3kVpZdvWK7iq2gf8GyPxMe3vAZ5Ppxb_lBuh8LIa0bAwfCihcblDg=="}
如果我们在 GoogleMaps API 中请求相同的坐标,我们就会得到这样的方向和距离
我尝试使用 POST 请求并交换坐标。这没有帮助。
您是否尝试过使用“alternatives”可选参数?