My team want to make an iOS app like Uber, which can track GPS location for charge. But according to my experiment and real-test, the GPS location point is not always accurate, there is some deviation sometimes. (the accuracy is low sometimes). So what cane be done to do like Uber? thanks!
_locationManager.activityType = CLActivityTypeAutomotiveNavigation;
_locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
_locationManager.distanceFilter = kCLDistanceFilterNone;
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray<CLLocation *> *)locations
{
CLLocation *location = [locations lastObject];
if (location)
{
//success, but there is some deviation sometimes.the accuracy is low sometimes
}
else
{
//error
}
}
GPS accuracy depends on location. If you are moving in a tunnel or parking lot, GPS accuracy will be extremely low. So you need to check accuracy before taking signals for calculation for eg
if (location.horizontalAccuracy < 63) {
// GOOD SIGNAL
}
You can design some filter algorithm to filter out signals depending upon your need.
You can customize your accuracy.
CLLocation -horizontalAccuracy and -verticalAccuracy will do that.
You can see people posted answers already.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.