This repository contains a Golang implementation which converts regular longitude and latitude coordinates to the Maidenhead Locator System and vice versa.
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.
The Maidenhead Locator System is a grid system which divides the earth in fields, squares, subsquares and extended subsquares. The extended subsquares could be split again in extended subsquares.
If we want the Maidenhead Locator string of Londen, it would be:
Field | Square | Subsquare | Ext. Subsq. |
---|---|---|---|
IO | 91 | xm | 02 |
Assuming you have set up a working instance of Go, using this module in your app is fairly easy
- Fetch this module
go get -u github.com/LighthouseLab/go-maidenhead
- Import the package and use the provided functionalities in your app. An example of a very basic app is shown below:
package main
import (
"fmt"
"os"
"github.com/LighthouseLab/go-maidenhead"
)
func main() {
// Converting coords to grid sq
val, err := gridlocator.Convert(&gridlocator.Coordinates{48.858370, 2.294481})
if err != nil {
os.Exit(1)
}
fmt.Println(val)
}