I'm writing application in Java. I have a list of lat long, and I want to convert it to path. Then calculate distance between points. And finally base on current location (lat, long) detect point on path, and calculate remaining distance to final point.
我正在用Java编写应用程序。我有一个lat long列表,我想将它转换为路径。然后计算点之间的距离。最后根据当前位置(纬度,长度)检测路径上的点,并计算到最终点的剩余距离。
How can I do it, do you know any libraries that could help me?
我怎么能这样做,你知道任何可以帮助我的图书馆吗?
1 个解决方案
#1
1
When the points are not that far apart you can calculate the distance using the Pythagorean theorem. By calculating the distance between the points and adding them up you can get the total distance. (I assume that the points are sorted) I believe you also want to get the point on the path that is the closest to the current location. To do this you can use the same formular to check the distance for every point and use the shortest. If you have really many points you might want to use only every 10th point first to save time and resources.
当点不是那么远时,你可以用毕达哥拉斯定理来计算距离。通过计算点之间的距离并将它们相加可以得到总距离。 (我假设点已经排序)我相信你也希望得到最接近当前位置的路径上的点。要做到这一点,你可以使用相同的公式来检查每个点的距离,并使用最短的。如果你有很多分,你可能只想每10分使用一次,以节省时间和资源。
I hope I could help you
我希望我能帮助你
#1
1
When the points are not that far apart you can calculate the distance using the Pythagorean theorem. By calculating the distance between the points and adding them up you can get the total distance. (I assume that the points are sorted) I believe you also want to get the point on the path that is the closest to the current location. To do this you can use the same formular to check the distance for every point and use the shortest. If you have really many points you might want to use only every 10th point first to save time and resources.
当点不是那么远时,你可以用毕达哥拉斯定理来计算距离。通过计算点之间的距离并将它们相加可以得到总距离。 (我假设点已经排序)我相信你也希望得到最接近当前位置的路径上的点。要做到这一点,你可以使用相同的公式来检查每个点的距离,并使用最短的。如果你有很多分,你可能只想每10分使用一次,以节省时间和资源。
I hope I could help you
我希望我能帮助你