Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/logocomune/maidenhead
This golang library compress and decompress latitude and longitude coordinates into Maidenhead locator
https://github.com/logocomune/maidenhead
go golang golang-library hamradio latitude-and-longitude maidenhead-grid-locators maidenhead-locator radioamateur
Last synced: about 2 months ago
JSON representation
This golang library compress and decompress latitude and longitude coordinates into Maidenhead locator
- Host: GitHub
- URL: https://github.com/logocomune/maidenhead
- Owner: logocomune
- License: mit
- Created: 2022-01-29T17:17:01.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-16T08:50:14.000Z (7 months ago)
- Last Synced: 2024-10-10T09:22:22.567Z (3 months ago)
- Topics: go, golang, golang-library, hamradio, latitude-and-longitude, maidenhead-grid-locators, maidenhead-locator, radioamateur
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 12
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Maidenhead Locator for golang
![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/logocomune/maidenhead)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/logocomune/maidenhead/go.yml)
[![Go Reference](https://pkg.go.dev/badge/github.com/logocomune/maidenhead)](https://pkg.go.dev/github.com/logocomune/maidenhead)
[![codecov](https://codecov.io/gh/logocomune/maidenhead/graph/badge.svg?token=GGN3PHjyZV)](https://codecov.io/gh/logocomune/maidenhead)
[![Go Report Card](https://goreportcard.com/badge/github.com/logocomune/maidenhead)](https://goreportcard.com/report/github.com/logocomune/maidenhead)The [Maidenhead Locator System](https://en.wikipedia.org/wiki/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.This Golang library compresses and decompresses (latitude, longitude) coordinates to and
from a Maidenhead locator.## Installation
```console
go get -u github.com/logocomune/maidenhead
```## Usage
```golang
package mainimport (
"fmt"
"github.com/logocomune/maidenhead"
)func main() {
latitude := 43.723073
longitude := 10.396637locator, _ := maidenhead.Locator(latitude, longitude, maidenhead.FieldPrecision)
fmt.Println("Locator with field precision:", locator)
locator, _ = maidenhead.Locator(latitude, longitude, maidenhead.SquarePrecision)
fmt.Println("Locator with square precision:", locator)
locator, err := maidenhead.Locator(latitude, longitude, maidenhead.SubSquarePrecision)
fmt.Println("Locator with sub square precision:", locator, err)
locator, _ = maidenhead.Locator(latitude, longitude, maidenhead.ExtendedSquarePrecision)
fmt.Println("Locator with extended square precision:", locator)
locator, _ = maidenhead.Locator(latitude, longitude, maidenhead.SubExtendedSquarePrecision)
fmt.Println("Locator with sub extended square precision:", locator)lat, lng, _ := maidenhead.GridCenter("JN53er73OM")
fmt.Printf("Grid center of %s is lat: %f and lng: %f\n", "JN53er73OM", lat, lng)square, _ := maidenhead.Square("JN53er73OM")
fmt.Printf("Square coordinates of %s are %+v\n", "JN53er73OM", square)
}
```