GeomagneticField
public class GeomagneticField
extends Object
Estimates 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-2010 which is valid until 2015, but should produce acceptable results for several years after that. Future versions of Android may use a newer version of the model.
Summary
Public constructors |
GeomagneticField(float gdLatitudeDeg, float gdLongitudeDeg, float altitudeMeters, long timeMillis) Estimate the magnetic field at a given point and time. |
Inherited methods |
From class java.lang.Object
Object |
clone() Creates and returns a copy of this object. |
boolean |
equals(Object obj) Indicates whether some other object is "equal to" this one. |
void |
finalize() Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |
final Class<?> |
getClass() Returns the runtime class of this Object . |
int |
hashCode() Returns a hash code value for the object. |
final void |
notify() Wakes up a single thread that is waiting on this object's monitor. |
final void |
notifyAll() Wakes up all threads that are waiting on this object's monitor. |
String |
toString() Returns a string representation of the object. |
final void |
wait(long millis, int nanos) Causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed. |
final void |
wait(long millis) Causes the current thread to wait until either another thread invokes the notify() method or the notifyAll() method for this object, or a specified amount of time has elapsed. |
final void |
wait() Causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object. |
|
Public constructors
GeomagneticField
GeomagneticField (float gdLatitudeDeg,
float gdLongitudeDeg,
float altitudeMeters,
long timeMillis)
Estimate the magnetic field at a given point and time.
Parameters |
gdLatitudeDeg |
float : Latitude in WGS84 geodetic coordinates -- positive is east. |
gdLongitudeDeg |
float : Longitude in WGS84 geodetic coordinates -- positive is north. |
altitudeMeters |
float : Altitude in WGS84 geodetic coordinates, in meters. |
timeMillis |
long : Time at which to evaluate the declination, in milliseconds since January 1, 1970. (approximate is fine -- the declination changes very slowly). |
Public methods
getDeclination
float getDeclination ()
Returns |
float |
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). |
getFieldStrength
float getFieldStrength ()
Returns |
float |
Total field strength in nanoteslas. |
getHorizontalStrength
float getHorizontalStrength ()
Returns |
float |
Horizontal component of the field strength in nonoteslas. |
getInclination
float getInclination ()
Returns |
float |
The inclination of the magnetic field in degrees -- positive means the magnetic field is rotated downwards. |
getX
float getX ()
Returns |
float |
The X (northward) component of the magnetic field in nanoteslas. |
getY
float getY ()
Returns |
float |
The Y (eastward) component of the magnetic field in nanoteslas. |
getZ
float getZ ()
Returns |
float |
The Z (downward) component of the magnetic field in nanoteslas. |