maidenhead

package module
v0.0.0-...-fd08903 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2023 License: AGPL-3.0 Imports: 5 Imported by: 1

README

logo

maidenhead

This library provides an easy and convenient way to perform conversions between Maidenhead Grid Squares and latitudes and longitudes.

Example

Ready to use example can be found in cmd/main.go

Alternatively, you can use the following code snippet:

package main

import (
	"fmt"
	"log"

	"github.com/8ff/maidenhead"
)

func main() {
	// Convert lat/long to Maidenhead locator
	locator, err := maidenhead.GetGrid(45.5231, -122.6765)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("Grid: %s\n", locator)

	// Convert Maidenhead locator to lat/long
	lat, long, err := maidenhead.GetCoordinates("CN85pm")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("Coordinates: %f, %f\n", lat, long)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCoordinates

func GetCoordinates(location string) (float64, float64, error)

func GetGrid

func GetGrid(latitude, longitude float64) (string, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL