iPhone Geofencing - The Difference Between Meters and Miles
GPS, Random Thoughts, Products, iPhone April 17th, 2008I’ve been doing a considerable amount of hacking with the iPhone SDK, mainly to get the iPhone communicating with our Foundation product. Last night I was trying to display the horizontal accuracy from the iPhone’s CoreLocation API in our Foundation user interface. The horizontal accuracy is the radius of uncertainty of the iPhone’s location (and it’s measured in meters). The uncertainty I was dealing with at the time of development was 1618 meters. I’ve seen the iPhone come close to 100m and even better when connected via WiFi, but more on that later.
As part of our Foundation product we provide some simple JavaScript functions that make it easy to draw geofences on Google Maps. If you’re not familiar with a geofence, it’s basically a virtual boundary you can create to receive a notification if a device moves into or out of it. In most circumstances a circular geofence is used. So I spent an hour trying to understand why I couldn’t get the geofence overlay to display on Google Maps. Here’s my initial screen:

After a considerable amount of time and frustration passed (1 hr to be exact) I decided to zoom nearly all the way out and was surprised to see that I geofenced all of North America. Then I came to the realization that units were keeping me down (m vs mi). I was passing 1618 meters into our function, which was expecting miles. This yielded the following screen:

My geofence was only 1,617 miles off. It turns out that 1618 meters is just a tad bit more than a mile. Finally, I ended up with exactly what I needed:

Ah yes, much better. The image above shows the reading from inside our office building where we’re surrounded by all sorts of windows, walls, cubes, etc. Because of triangulation we’re able to get readings indoors and even underground. Even though the accuracy isn’t all that precise it’s enough to do some really interesting things. If you’d like to get your iPhone hooked up to the Ublip Foundation for development and testing purposes please feel free to comment or drop us a line.


Recent Comments