iPhone:谷歌地图方向

发布于 2024-10-19 08:58:51 字数 649 浏览 8 评论 0原文

我正在开发一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

俯瞰星空 2024-10-26 08:58:51

您的行车方向似乎会带您沿着主要道路或高速公路行驶,因此这些点之间的行车方向没有变化。您没有说明从方向 api 获得的答复,但我的猜测是您正在收到沿路线的步骤,您必须改变方向,例如。高速公路路口等:

Google 文档:
步骤数组中的每个元素
定义了单个步骤
计算出的方向。一个步骤是
方向的最大原子单位
路线,包含单个步骤
描述一个具体的、单一的
旅途中的指导。例如“转
在 W. 4th St. 左转。”台阶不仅
描述了指令,而且还
包含距离和持续时间
有关如何执行此步骤的信息
涉及到下面的步骤。为了
例如,一个步骤表示为“合并到
I-80 West”可能包含持续时间
“37英里”和“40分钟”
表示下一步是37
从这一步开始,英里/40 分钟。

当您步行时,您会更频繁地轮流,以便找到最短路线。

路线 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:

Google documentation:
Each element in the steps array
defines a single step of the
calculated directions. A step is the
most atomic unit of a direction's
route, containing a single step
describing a specific, single
instruction on the journey. E.g. "Turn
left at W. 4th St." The step not only
describes the instruction but also
contains distance and duration
information relating to how this step
relates to the following step. For
example, a step denoted as "Merge onto
I-80 West" may contain a duration of
"37 miles" and "40 minutes,"
indicating that the next step is 37
miles/40 minutes from this step.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文