问题描述
我正在开发一款嵌入了用mkmapkit制作的mapView的iPhone应用程序。
我有两个坐标,我正在追踪这两点之间的方向。
i'm developing an iPhone app which embed a mapView made with mkmapkit.I got two coordinates and I'm tracing the direction between these two points.
一切运作良好。我正在使用谷歌地图api:maps.googleapis.com/maps/api/directions来检索带有方向所有步骤的xml。
Everything works well. I'm using google maps api : maps.googleapis.com/maps/api/directions to retrieve xml with all the steps of the direction.
但有一点非常奇怪:我只是无法理解为什么驾驶方向不准确。
在两个步骤之间,它会跟踪一条右线并且不会沿着道路行走,而行走模式则沿着道路追踪非常准确的方向。
But one thing is very strange : I just can't understand why driving direction is not accurate.Between two steps it trace a right line and don't follow the road while walking travel mode trace a very accurate direction, following roads.
驾驶模式:
步行模式:
我的问题很简单:你有没有使用谷歌地图api,你能理解为什么一个比另一个更精确......
My question is simple : have you ever used the google maps api and can you understand why one is more accurate than the other...
推荐答案
您的行车路线似乎带您沿着主要道路或高速公路行驶,因此每个点之间的行车路线没有变化。你没有说明你从方向api得到的答复,但我的猜测是你正在接收沿着必须改变方向的路线的步骤,例如。高速公路路口等:
Your driving directions seems to take you along major roads or highways, so there are no change of driving directions between each of these points. You have not stated the reply you get from the directions api, but my guess is that you are receiving the steps along the route where you have to change direction, eg. highway junctions, etc:
当你走路时,你经常轮流在为了获得最短的路线。
When you are walking, you are taking turns more often in order to get the shortest route.
路线api没有为您提供与实际行驶路线相匹配的确切覆盖。只有您进行更改的位置。
The directions api does not provide you with the exact overlays that match the actually roads travelled. Only the positions where you make changes.
或者您可以查看回复中的 overview_polyline
字段。它可能比使用航路点的路径更平滑。
Alternatively you could take a look at the overview_polyline
field in the reply. It may have a smoother path than by using the waypoints.
这篇关于iPhone:谷歌地图方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!