Mapquest服务点的路线上 [英] MapQuest points on a route

查看:263
本文介绍了Mapquest服务点的路线上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用MapQuest的Andr​​oid的API和绘制两个点之间的路线。我所试图做的是找到沿线的多个点,说lat和长值沿道路上每隔100米,并将其存储在数组中。有没有办法做到这一点。我希望我的问题是不够清楚明白。

I am using the MapQuest Android API and drawing a route between two points. What I am trying to do is find multiple points along the route, say the lat and long values every 100 meters along on the path and store it in an array. Is there a way to do that. I hope my question was clear enough to understand.

推荐答案

我已经做了在Java中和ActionScript类似的东西。

I have done something similar in Java and Actionscript.

首先,如果你没有已经知道,在有路由每条腿是一条直线。路线的直,腿少,你都会有。

Firstly, if you were not already aware, each leg in the route you have is a straight line. The straighter the route, the less legs you will have.

要确定沿线的距离相等的点 - 或者对于我来说,沿着路线行驶时间 - 只需通过设置[纬度,经度] COORDS在计算每条腿末端的累积距离的周期。

To identify points of an equal distance along the route - or in my case, travel time along the route - simply cycle through the set of [lat,long] coords calculating the cumulative distance at the end of each leg.

使用这个信息,你可以很容易地修改你的循环以检查沿腿部发生的距离点(或点)。记住每个腿是一条直线。如果是这样,它足够简单,以确定沿着你正在寻找,并从该计算是远远沿腿部点腿的距离。

Using this information you can easily modify your loop to check where a distance point (or points) occur along a leg. Remembering that each leg is a straight line. If so, its simple enough to identify the distance along the leg you are looking for and from that calculate the point that is that far along the leg.

为此,您需要2算法:


  1. 之间的距离为2 [纬度,经度]坐标

  2. 这是x距离沿之间的线2点[纬度,经度]坐标

谈何容易,这些都是复杂的算法,有在网络上一些不三不四的例子。很少在我看来,做解释的数学是如何工作的一个好工作,MOT我发现是不完整的。

Easier said than done, these are complex algorithms and there are some dubious examples on the net. Few in my opinion do a good job in explaining how the math works, and mot I have found are incomplete.

然后我发现这种宝石: HTTP://www.movable-type。 co.uk/scripts/latlong.html

Then I found this gem: http://www.movable-type.co.uk/scripts/latlong.html

我实现我的算法在ActionScript和Java基于克里斯俯伏这个极好的参考。

I implemented my algorithms in actionscript and java based on this excellent reference by Chris Veness.

链接应提供你需要的一切。你需要做什么解释,在这两个psudo code和JavaScript简洁的算法,并且如果那还不够,一个设施,测试你的算法。

The link should provide everything you need. Explanation of what you need to do, concise algorithms in both psudocode and javascript, and if thats not enough, a facility to test your algorithms.

这篇关于Mapquest服务点的路线上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆