Summary of the API major platforms provide regarding geolocation and its accuracy.
Platform | Coordinates accuracy | Altitude accuracy | Confidence interval | Invalid value |
---|---|---|---|---|
Web | Coordinates.accuracy | Coordinates.altitudeAccuracy | 95% | null (but coordinates accuracy is always available) |
Android | getAccuracy() | no | 68% | 0.0 |
iOS | horizontalAccuracy | verticalAccuracy | not defined | < 0 |
The accuracy attribute denotes the accuracy level of the latitude and longitude coordinates. It is specified in meters and must be supported by all implementations. The value of the accuracy attribute must be a non-negative real number.
The altitudeAccuracy attribute is specified in meters. If the implementation cannot provide altitude information, the value of this attribute must be null. Otherwise, the value of the altitudeAccuracy attribute must be a non-negative real number. The accuracy and altitudeAccuracy values returned by an implementation should correspond to a 95% confidence level.
- http://www.w3.org/TR/geolocation-API/#accuracy
- https://developer.mozilla.org/en-US/docs/Web/API/Coordinates/accuracy
- https://developer.mozilla.org/en-US/docs/Web/API/Coordinates/altitudeAccuracy
public float getAccuracy ()
Get the estimated accuracy of this location, in meters.
We define accuracy as the radius of 68% confidence. In other words, if you draw a circle centered at this location's latitude and longitude, and with a radius equal to the accuracy, then there is a 68% probability that the true location is inside the circle.
In statistical terms, it is assumed that location errors are random with a normal distribution, so the 68% confidence circle represents one standard deviation. Note that in practice, location errors do not always follow such a simple distribution.
This accuracy estimation is only concerned with horizontal accuracy, and does not indicate the accuracy of bearing, velocity or altitude if those are included in this Location.
If this location does not have an accuracy, then 0.0 is returned. All locations generated by the LocationManager include an accuracy.
@property(readonly, nonatomic) CLLocationAccuracy horizontalAccuracy
@property (nonatomic, readonly) double horizontalAccuracy;
The radius of uncertainty for the location, measured in meters. (read-only)
The location’s latitude and longitude identify the center of the circle, and this value indicates the radius of that circle. A negative value indicates that the location’s latitude and longitude are invalid.
@property(readonly, nonatomic) CLLocationAccuracy verticalAccuracy
@property (nonatomic, readonly) double verticalAccuracy;
The accuracy of the altitude value in meters. (read-only)
The value in the altitude property could be plus or minus the value indicated by this property. A negative value indicates that the altitude value is invalid.
Determining the vertical accuracy requires a device with GPS capabilities. Thus, on some earlier iOS-based devices, this property always contains a negative value.