public class

GeomagneticField

extends Object
java.lang.Object
   ↳ android.hardware.GeomagneticField

Class Overview

This class is used to estimated estimate magnetic field at a given point on Earth, and in particular, to compute the magnetic declination from true north.

This uses the World Magnetic Model produced by the United States National Geospatial-Intelligence Agency. More details about the model can be found at http://www.ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml. This class currently uses WMM-2005 which is valid until 2010, but should produce acceptable results for several years after that.

Summary

Public Constructors
GeomagneticField(float gdLatitudeDeg, float gdLongitudeDeg, float altitudeMeters, long timeMillis)
Estimate the magnetic field at a given point and time.
Public Methods
float getDeclination()
float getFieldStrength()
float getHorizontalStrength()
float getInclination()
float getX()
float getY()
float getZ()
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public GeomagneticField (float gdLatitudeDeg, float gdLongitudeDeg, float altitudeMeters, long timeMillis)

Estimate the magnetic field at a given point and time.

Parameters
gdLatitudeDeg Latitude in WGS84 geodetic coordinates -- positive is east.
gdLongitudeDeg Longitude in WGS84 geodetic coordinates -- positive is north.
altitudeMeters Altitude in WGS84 geodetic coordinates, in meters.
timeMillis Time at which to evaluate the declination, in milliseconds since January 1, 1970. (approximate is fine -- the declination changes very slowly).

Public Methods

public float getDeclination ()

Returns
  • The declination of the horizontal component of the magnetic field from true north, in degrees (i.e. positive means the magnetic field is rotated east that much from true north).

public float getFieldStrength ()

Returns
  • Total field strength in nanoteslas.

public float getHorizontalStrength ()

Returns
  • Horizontal component of the field strength in nonoteslas.

public float getInclination ()

Returns
  • The inclination of the magnetic field in degrees -- positive means the magnetic field is rotated downwards.

public float getX ()

Returns
  • The X (northward) component of the magnetic field in nanoteslas.

public float getY ()

Returns
  • The Y (eastward) component of the magnetic field in nanoteslas.

public float getZ ()

Returns
  • The Z (downward) component of the magnetic field in nanoteslas.