Can I get the accuracy of GPS location in iOS?
Asked Answered
S

3

5

I've seen Android developers get the accuracy of a GPS location. Is there a way that I can get the accuracy of my currenct GPS location in iOS?

I am using the code from this answer to get my location:

 locationManager = [[CLLocationManager alloc] init];
 locationManager.delegate = self;
 locationManager.distanceFilter = kCLDistanceFilterNone;
 locationManager.desiredAccuracy = kCLLocationAccuracyBest;
 [locationManager startUpdatingLocation];


 - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
     NSLog(@"OldLocation %f %f", oldLocation.coordinate.latitude, oldLocation.coordinate.longitude);
     NSLog(@"NewLocation %f %f", newLocation.coordinate.latitude, newLocation.coordinate.longitude);
 }
Syd answered 27/6, 2013 at 7:41 Comment(1)
Yes, you can surely do that by using same CLLocation .Utilize
A
8

There are 2 properties on the CLLocation -horizontalAccuracy and -verticalAccuracy. Most of times the accuracy is based on the hardware that you are using to get the location

Agency answered 27/6, 2013 at 7:44 Comment(0)
L
8

horizontalAccuary of CLLocation gives the estimated positional error in meters related to the latitude, longitude coordinate.

verticalAccuracy gives the estimated error related to altitude.

Lomond answered 27/6, 2013 at 8:2 Comment(0)
C
2

Use horizontalAccuracy and verticalAccuracy properties in CLLocation class. If horizontalAccuracy is a huge value you can discard the signals.

Also make sure to check the timeStamp with current date to ensure that the GPS signal is not cached.

Creativity answered 19/3, 2016 at 14:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.