geomag 0.1.0+5

  • Readme
  • Changelog
  • Example
  • Installing
  • 72

geomag #

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

The difference between true north and magnetic north is called magnetic declination. It is different everywhere on Earth and even changes over time. Every five years or so, a couple of governing bodies release coefficients data for calculating the magnetic declination at a given lat/lng and time.

[GeoMag] takes data from the World Magnetic Model Coefficients, [WmmCof], to initialize. You can provide your own or use the bundled data, WMM-2015v2 from 09/18/2018. Use [calculate()] to process GPS coordinates into a [GeoMagResult].

Accuracy is roughly within 0.2 degrees of test values.

See and

This is a port of the geomagJS package,

Adapted from the geomagc software and World Magnetic Model of the NOAA Satellite and Information Service, National Geophysical Data Center.


0.1.0+5 #

  • Add test and test results.

0.1.0 #

  • Initial version, ported from geomagJS


import 'package:geomag/geomag.dart';

// See also the Flutter example: ...geomag/example/flutter

main(List<String> args) {
  final geomag = GeoMag();
  final result = geomag.calculate(double.parse(args[0]), double.parse(args[1]),
      double.parse(args.length > 2 ? args[2] : '0'));
  print('Result: $result');
  print('Declination: ${result.dec}');

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  geomag: ^0.1.0+5

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:geomag/geomag.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Mar 30, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (intl).


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.4.0 <3.0.0
intl ^0.15.8 0.15.8 0.16.1
meta ^1.1.6 1.1.8
Transitive dependencies
path 1.6.4
Dev dependencies
pedantic ^1.8.0+1
test ^1.6.5