本文介绍了如何比较位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个位置,分别是位置A,B和C.现在让我们假设在折线中,位置A首先是位置B,其次是位置C,其次是位置C.假设我当前的位置是位置B.现在我可以清楚地看到我已经旅行或覆盖了位置A,而我即将到来的位置是一条多义线上的位置C,但是我如何以编程方式知道这些东西,因为我已经覆盖了很多点折线.

I have 3 Locations, Location A,B and C. Now let's assume in a Polyline Location A comes first Location B second and Location C third. Just assume that my current location is Location B. Now I can clearly see that I have traveled or covered Location A and my upcoming Location is Location C on a polyline, but how can I know these things programmatically that I have covered these much of points of the Polyline.

我有一个构成折线的经度和纬度列表.

I have a list of Latitude and Longitude which forms a Polyline.

简而言之,我想知道折线上的覆盖点或行进点

In short, I want to know the covered or traveled points on Polyline

推荐答案

您需要测量所有点之间的距离,然后找到最近的点以告诉您什么点.尝试在您和最近的点之间增加阈值,以确保您位于多义线上,因为位置读取的准确性可能会发生错误.

you need to measure the distance between you and all points then find the nearest point to tell you what point. try to add threshold between you and nearest point to make sure that you are on the polyline errors could happen because of location read accuracy.

要测量两个位置之间的距离,您需要编写此代码.

to measure a distance between two location you need to write this code.

locationA.distanceTo(locationB);

这篇关于如何比较位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 15:28