How to compare locations

南笙酒味 提交于 2019-12-11 11:32:59

问题


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


回答1:


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);


来源:https://stackoverflow.com/questions/52016863/how-to-compare-locations

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!