Search code examples
iphoneiosios6core-locationcllocation

Creating a location based reminder: what to do with horizontal accuracy?


I'm creating a location-based reminder, EKReminder.

For the coordinates I'm using CLGeocoder to convert an address into a CLLocation.

When it comes to the reminder itself, I think that there are two factors involved that determine the 'area' (radius/circle) in which the reminder will fire.

1) the Horizontal accuracy of the CLLocation. The docs describe the horizontalAccuracy property as "The radius of uncertainty for the location, measured in meters. (read-only)".

There's more good information about this in a previous question: What do horizontalAccuracy and verticalAccuracy of a CLLocation refer to?

As suggested in that answer, the horizontalAccuracy is 100m.

2) the radius property on the EKStructuredLocation. The discussion notes for this property read "To use the default radius, set this property to 0."

If I create a location-based reminder in the stock, Reminders app from Apple, it comes out with radius = 0 and horizontalAccuracy = 0. So it's using the default 'reminder radius' (don't know what that is) with a value of 0 for the uncertainty in the horizontal location...

I want to avoid having two margins in my reminder. I think there are two options to achieve this:

a) use the default radius for the EKStructuredLocation by setting it to 0 and change the result coming back from the CLGeocoder to have a horizontalAccuracy of 0m.

b) keep the horizontalAccuracy (100m, or different, depending on circumstance) from the CLGeocoder - but not use the default radius for the EKStructuredLocation and set it to something small, like 1m.

Thoughts? Am I understanding these APIs correctly?

  • Will I get a 'double margin' if I use the returned horizontalAccuracy and the default value for radius?
  • Does the horizontalAccuracy for the CLLocation object introduce a radius from the coordinate, or is it purely giving information about the uncertainty of the location?

Cheers


Solution

  • As pointed out by progmr, horizontalAccuracy is purely an estimate of the uncertainty in the location.

    To back this up, I did a couple of real-world tests where:

    • I created a location-based reminder in the Reminders app, which has radius = 0 but also reports horizontalAccuracy = 0.
    • I created a reminder using the same location in my own code, setting radius = 0, but the return from CLGeocoder reporting horizontalAccuracy = 100

    With each test, the reminders fired at exactly the same position. horizontalAccuracy is purely for information.