-2
我有位置列表(意思是緯度或經度在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 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
}
}
}
你是什麼意思,暫停和移動位置?什麼是暫停的位置?什麼是移動的? – Jokab
停止表示緯度經度相同超過2點。手段點是在相同的GPS位置。 –