Chapter 30. Getting Your Location Using Core Location
In This Chapter
Using GPS and cell tower triangulation to determine your iPhone's location |
Using the Core Location API to find where you are |
Narrowing the results of Core Location |
Using Core Location coordinates to draw your location on a map |
Working with the iPhone 3GS compass |
One feature that makes developing for the iPhone platform unique and powerful is its support for location awareness. The API used for accessing this feature is called Core Location. With it, you can pinpoint the location of the device anywhere in the world.
Core Location actually uses three methods to determine your location. If you're on a first-generation iPhone, it first uses a combination of cell phone tower triangulation and then Wi-Fi access point lookup. This provides reasonable accuracy both indoors and outdoors but is by no means exact. If you're on a second-generation iPhone, which has a built-in GPS receiver, and if you're outdoors, it instead uses a third method, GPS triangulation. Between these three methods, the iPhone is able to determine your position with reasonable accuracy and is also able to do it both indoors and outdoors, which overcomes a limitation that many devices with only GPS capabilities lack.
Utilizing this ability to determine the user's location enables a new class of applications and provides exciting opportunities for location-aware computing.
The latest iPhone revision, the iPhone 3GS, also adds built-in magnetic compass hardware. ...
Get Cocoa Touch™ for iPhone® OS 3 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.