Skip to content
pubscout

geomag

0.3.0, released 7 months ago by defylogic.dev

Translate GPS location data to geo-magnetic data such as magnetic declination.

WASM-ready
$ flutter pub add geomag
Source repository

What it does

Processes GPS coordinates and time into geo-magnetic data like magnetic declination using World Magnetic Model coefficients. It calculates the difference between true north and magnetic north using bundled or custom data.

AI-written summary of version 0.3.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to calculate magnetic declination from GPS coordinates in your app.
  • You are building navigation or compass features that require true north versus magnetic north adjustments.

Skip it when

  • You just need standard map rendering or geocoding without magnetic calculations.
  • You require real-time hardware compass sensor streams rather than coordinate-based magnetic data.

Strengths

  • Includes bundled WMM coefficients data.
  • Supports multiple platforms including Android, iOS, Web, Windows, macOS, and Linux.

Weaknesses

  • Limited in scope to geo-magnetic calculations.
  • Relies on periodic coefficient updates for long-term accuracy.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
2

not documented

final geoMag = GeoMag();
final result = geoMag.calculate(lat: 45.0, lon: -122.0, altitude: 0, date: DateTime.now());
print(result.declination);

Alternatives

Packages that do the same job and could replace geomag.

  • location_web

    Web implementation of the location plugin for Flutter web.

  • geolocator

    Cross-platform plugin to access device GPS, location updates, and coordinate calculations.

  • gpx

    Load, manipulate, and save GPS data in GPX format.

  • bd_map

    Interactive drill-down maps of Bangladesh from division to union.

Works with

Packages commonly used together with geomag: ones it builds on, ones built on it, and its own family.