iPhone:谷歌地图方向
我正在开发一个 iPhone 应用程序,它嵌入了用 mkmapkit 制作的地图视图。 我得到了两个坐标,并且正在追踪这两点之间的方向。
一切都运转良好。我正在使用谷歌地图 api:maps.googleapis.com/maps/api/directions 来检索 xml 以及方向的所有步骤。
但有一点很奇怪:我就是不明白为什么行车方向不准确。 在两个步骤之间,它会追踪一条正确的路线,并且步行时不跟随道路。旅行模式会追踪非常准确的方向,跟随道路。
驾驶模式: http://www.michael-blin.fr/misc/aden/google /drive.png
步行模式: http://www.michael-blin.fr/misc/aden/google /walking.png
我的问题很简单:您曾经使用过谷歌地图 API 吗?您能理解为什么其中一个比另一个更准确吗?
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.
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.
Driving Mode :
http://www.michael-blin.fr/misc/aden/google/driving.png
Walking Mode :
http://www.michael-blin.fr/misc/aden/google/walking.png
My question is simple : have you ever used the google maps api and can you understand why one is more accurate than the other...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的行车方向似乎会带您沿着主要道路或高速公路行驶,因此这些点之间的行车方向没有变化。您没有说明从方向 api 获得的答复,但我的猜测是您正在收到沿路线的步骤,您必须改变方向,例如。高速公路路口等:
当您步行时,您会更频繁地轮流,以便找到最短路线。
路线 api 不会为您提供与实际行驶道路相匹配的准确叠加层。仅您进行更改的位置。
或者,您可以查看回复中的
overview_polyline
字段。它可能具有比使用航路点更平滑的路径。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.
The directions api does not provide you with the exact overlays that match the actually roads travelled. Only the positions where you make changes.
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.