GeomagneticField
open class GeomagneticField
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-2020 which is valid until 2025, 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 |
Estimate the magnetic field at a given point and time.
|
Public constructors
GeomagneticField
GeomagneticField(
gdLatitudeDeg: Float,
gdLongitudeDeg: Float,
altitudeMeters: Float,
timeMillis: Long)
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
open fun getDeclination(): Float
Return |
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
open fun getFieldStrength(): Float
Return |
Float |
Total field strength in nanoteslas. |
getHorizontalStrength
open fun getHorizontalStrength(): Float
Return |
Float |
Horizontal component of the field strength in nanoteslas. |
getInclination
open fun getInclination(): Float
Return |
Float |
The inclination of the magnetic field in degrees -- positive means the magnetic field is rotated downwards. |
getX
open fun getX(): Float
Return |
Float |
The X (northward) component of the magnetic field in nanoteslas. |
getY
open fun getY(): Float
Return |
Float |
The Y (eastward) component of the magnetic field in nanoteslas. |
getZ
open fun getZ(): Float
Return |
Float |
The Z (downward) component of the magnetic field in nanoteslas. |