Donnerstag, 11. Februar 2010

iPhone Compass

In this video they review the iPhone 3Gs compass and discuss about the advantages and disadvantages of it.



A description about how compass works (taken from:http://www.ipodobserver.com/ipo/article/exploring_the_compass_app_in_the_iphone_3gs1/ )

The Earth has a molten iron core that rotates along with the Earth and acts like a magnet. The magnetic field of the Earth has a magnetic North Pole and South Pole. For complex reasons, these are not at the true geographic North and South Poles. Also due to the magnetization of near surface rocks, the magnetic field lines, the direction a magnetized compass aligns with, varies with position on the globe. As a result, at any given point on the planet, there is a difference angle between True North and Magnetic North. This angle is called the Magnetic Declination. The magnetic North Pole is just north of Canada and moves slightly in time. (40 km/year.)

Given that we know our position, in latitude and longitude, it's possible to calculate this Magnetic Declination. It can vary from 0 to 30 degrees here in North America. So, knowing the direction that a magnetic compass points to, there is a calculation that tells you the offset, East or West, and the angle to correct, to obtain True Geographic North.
The National Geographic Data Center, a division of NOAA, the National Oceanic and Atmospheric Administration, has a Web page that allows you do that calculation.
For example, for ZIP code 80120 in Denver, here's where a magnetic compass would point.

That angle computed above is what the iPhone calculates to convert from Magnetic North to True North. Some traditional, physical magnetic compasses can also dial in that adjustment because, most of the time, what we really want is True North in order to navigate on maps.
Previous compass apps on the iPhone and iPhone 3G utilized the fact that the user is in motion. If you move far enough, fast enough, the GPS coordinates can create a vector, a direction in which you are moving. That can be displayed on a pseudo-compass app. The problem is, if you don't keep moving, or don't move fast enough, it's hard to calculate the vector, and so users have been generally dissatisfied with the previous compass apps that do it all in software and utilize the motion obtained from GPS coordinates.
And now you know all about Apple's Compass app in the iPhone 3GS, how it augments the GPS system, how the app works and why it's better than the previous generation of 3rd party compass apps on the iPhone.


The best Compass Apps:
http://www.articlesbase.com/technology-articles/whats-the-best-iphone-compass-app-1580803.html



Here are the steps needed to use the compass. (taken from Forum)

1) check the availability: if the headingAvailable property of the location manager is YES, then you can use the compass.

2) use the location manager method -(void) startUpdatingHeading to begin receiving the information you are searching for

3) actually retrieve this information using the delegate method (do not forget to set yourself as the delegate)

Keine Kommentare: