当我们在长距离上使用Directions api时,我们注意到这些线并不完全在道路上,如下图所示:
它来自:https : //docs.mapbox.com/playground/directions/
坐标:-86.945145,40.090054; -88.26635,40.136585
我没有找到使路线API返回更精确路径的任何方法,但是我看到了匹配的API,所以我认为我可以使用从路线API获取的路线并将其与道路匹配。问题是当我使用它时遇到错误:
“所有坐标都相距太远”
Even when I try to split the route to pairs of two coordinates it still says that. There's no mention of such a limit in https://docs.mapbox.com/api/navigation/#map-matching. The coordinates above return that error.
That's the coordinates I got from directions API so I have no choice but to use them but they're incompatible with matching API, so what can I do to get an accurate directions path that sits exactly on the roads?
I thought about adding midpoints between every pair of coordinates but that won't work in cases where those midpoints would be far off any road.
There are two ways to get more precise geometries from the Directions API:
geometries: "polyline6"
(get geometries with 6 decimal places of precision)overview: "full"
(include full geometry in the overview, not just in the route legs)我认为使用这些将解决您的问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句