Skip to content

Instantly share code, notes, and snippets.

@shamrin
Last active January 7, 2016 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shamrin/c5864ae378fe4139fbd8 to your computer and use it in GitHub Desktop.
Save shamrin/c5864ae378fe4139fbd8 to your computer and use it in GitHub Desktop.

Geolocation accuracy

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

Web

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.

Android

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.

iOS

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment