A library for converting a latitude and longitude into a Maidenhead grid locator.
Based on the algorithm published by Edmund T. Tyson, N5JTY, titled "Conversion Between Geodetic and Grid Locator Systems" in QST January 1989, pp. 29-30, 43.
Inspired by go-gridlocator Go module.
The Maidenhead Locator System (a.k.a. QTH Locator and IARU Locator) is a geocode system used by amateur radio operators to succinctly describe their geographic coordinates, which replaced the deprecated QRA locator, which was limited to European contacts.[1] Its purpose is to be concise, accurate, and robust in the face of interference and other adverse transmission conditions. The Maidenhead Locator System can describe locations anywhere in the world.
Encoding
import 'package:gridlocator/gridlocator.dart';
const m = Gridlocator(-34.91, -56.211666666666667);
print(m.encode()); // output: GF15vc
Decoding
import 'package:gridlocator/gridlocator.dart';
final m = Gridlocator.decode('GF15vc');
print(m.latitude); // output: -34.916666666666664
print(m.longitude); // output: -56.25