Java 要查找位置(纬度、经度)点是否正在移动?
我有一个位置列表(arraylist中的纬度或经度),我想从该列表中找到停止和移动的位置。请给我一些解决这种情况的方法Java 要查找位置(纬度、经度)点是否正在移动?,java,collections,latitude-longitude,Java,Collections,Latitude Longitude,我有一个位置列表(arraylist中的纬度或经度),我想从该列表中找到停止和移动的位置。请给我一些解决这种情况的方法 public void find(ArrayList<Location> loclist) { for (int i = 0; i < loclist.size()-1; i++) { Location loc = loclist.get(i); // this is current location double la
public void find(ArrayList<Location> loclist) {
for (int i = 0; i < loclist.size()-1; i++) {
Location loc = loclist.get(i); // this is current location
double lat = loc.getLatitude();
double lng = loc.getLongitude();
Location nextloc = loclist.get(i+1); // this is next location
double nextlat = nextloc.getLatitude();
double nextlng = nextloc.getLongitude();
// now find distance between these points
double distance = getDistance(loc.getLatitude(), loc.getLongitude(), nextloc.getLatitude(), nextloc.getLongitude());
if(distance is less than 100 meters means point is halted) {
// now put this in halted point list
} else {
// add in moving point list
}
}
}
public void find(ArrayList loclist){
对于(int i=0;i
我认为你问题的措辞有点混乱,但我相信你是在试图确定在给定的时间间隔内,是否有运动。您可以简单地将一对坐标与前一对坐标进行比较。比如说,
ArrayList<Integer> latitude = new ArrayList<Integer>();
ArrayList<Boolean> moving = new ArrayList<Boolean>();
for(int i = 1; i<latitude.size(); i++)
{
if(latitude.get(i-1)!=latitude.get(i))
{
moving.set(i, true);
}
else
{
moving.set(i,false);
}
}
ArrayList latitude=new ArrayList();
ArrayList moving=新建ArrayList();
对于(int i=1;i)停止和移动的位置是什么意思?什么是停止的位置?什么是移动的位置?停止意味着超过2个点的经纬度相同。意味着点位于相同的gps位置。