42

I've been working on a location based app recently and am noticing some strange values for CLLocation. I often get a horizontalAccuracy of 1414 and a verticalAccuracy of -1. Any clue what this indicates? As far as I can tell, these points are often very accurate. What is the difference between verticalAccuracy and horizontalAccuracy?

mfaani
  • 33,269
  • 19
  • 164
  • 293
Alex Argo
  • 8,920
  • 12
  • 43
  • 46

1 Answers1

70

The -1 for verticalAccuracy indicates that the altitude in the CLLocation is not valid. You only get altitude with a 3D GPS position.

The 1414 for horizontalAccuracy indicates that the horizontal (lat/lon) position could be up to 1414m off (this is just an estimated error). This is probably a location determined by cell tower triangulation or WiFi location data. GPS locations usually report 100m or better.

To get a higher accuracy location (300m or better) you need to set desiredAccuracy and wait for the GPS receiver to lock onto at least 3 satellites (or 4 for a 3D fix). Until that happens CLLocationManager will give you the best it has which is WiFi or Cell tower triangulation results.

progrmr
  • 75,956
  • 16
  • 112
  • 147
  • 5
    Aha! I was was very confused and thinking in a 2D coordinate system. I thought "verticalAccuracy" was latitudinal accuracy and "horizontalAccuracy" was longitudinal accuracy! Would it make sense to change my question to reflect this confusion somehow? – Alex Argo Sep 13 '11 at 14:50
  • 5
    I don't think you need to change your question, Alex. I had exactly the same question and my search brought me here - answering it - thanks :-) – philsquared Sep 17 '11 at 14:49
  • 9
    To build, it seems that 1414 is the constant the CLLocationManager gives if it has determined your location based on cell tower triangulation. In my testing, if it has determined your location based on wifi it gives a horizontal accuracy of 65m. – bearMountain May 02 '12 at 16:35
  • 1
    I'm filering locations by vertical/horizontal Accuracy. Simulator seems to report verticalAccuracy as -1 so it is good idea to code around this for testing (i.e. don't care about verticalAccuracy when in Simulator) – katit Aug 06 '14 at 22:20
  • @progrmr : Is this horizontalAccuracy error factor ? Is minimum the value (not -ve) better result? – dip Jun 01 '16 at 05:11
  • 4
    `horizontalAccuracy` is the estimated error in meters, the lower value is better (less error). – progrmr Jun 01 '16 at 18:41