MaidenheadLocator class

Converting between Maidenhead locator (used in amateur radio) and latitude/longitude, and calculating of distance and bearing.

This class provides methods for converting between Maidenhead Locators and Latitude/Longitude in degrees as well as for calculating the distance and bearing between two positions. This type of locator is mainly used in amateur radio and sometimes also called “QRA locator”.

This class is based on a Perl module by Dirk Koopman, G1TLH.

Compatibility: .NET Version 2.0 or newer

Maidenhead locator calculation in Pascal? Continue to locator distance calculation…

Example

The following sample code shows how to compute the distance between two locators:

// Define two locator positions
string homeLoc = "JN59MN"
string destLoc = "JO63DH"

// Compute distance [km] and direction [°]
double distance = MaidenheadLocator.Distance(homeLoc, destLoc);
double azimuth = MaidenheadLocator.Azimuth(homeLoc, destLoc);

// Convert locator to latitude/longitude
LatLng homeLL = MaidenheadLocator.LocatorToLatLng(homeLoc);

// Convert latitude/longitude to locator
string myLoc = MaidenheadLocator.LatLngToLocator(49.57, 11.08);

Download

MaidenheadLocator.cs9.5 KiBSource code of the MaidenheadLocator class

Changes

2015Mar1
Parsen von Locatorangaben niedrigerer Genauigkeit (XX99). (Idee von by Stewart Moss ZS6SGM)
LatLong in LatLng umbenannt (wie im Google-Maps-API).
2011Aug4
Höhere Genauigkeit der Locatorangabe (1 oder 2 zusätzliche Ebenen).

Licence and terms of use

Copying and distribution of this file, with or without modification, are permitted provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty. (GNU All-Permissive licence)

Statistic data

  • Created on 2007-04-02, updated on 2015-03-01.
  • First used in ARLog: Amateur Radio Logbook.
  • Ca. 170 lines of code, estimated development costs: 170 - 680 €