Computes the full magnetic field at a geographic position using the World Magnetic Model 2025 (WMM2025).
Returns declination, inclination, and all field components (X, Y, Z, H, F).
Geodetic latitude in decimal degrees (-90 to 90).
Geodetic longitude in decimal degrees (-180 to 180).
Optional
Optional altitude and date.
Full magnetic field result with all components.
import { magnetic } from '@squawk/flight-math';const result = magnetic.magneticField(40.0, -105.0, { date: new Date(Date.UTC(2026, 0, 1)),});console.log(result.declinationDeg);console.log(result.totalIntensityNt); Copy
import { magnetic } from '@squawk/flight-math';const result = magnetic.magneticField(40.0, -105.0, { date: new Date(Date.UTC(2026, 0, 1)),});console.log(result.declinationDeg);console.log(result.totalIntensityNt);
Computes the full magnetic field at a geographic position using the World Magnetic Model 2025 (WMM2025).
Returns declination, inclination, and all field components (X, Y, Z, H, F).