Skip to content

logocomune/go-cq-zone

Repository files navigation

Go CQ Zone Info Package

GitHub go.mod Go version GitHub Actions Workflow Status Go Reference codecov Go Report Card

A Go package to retrieve CQ Zone information (used in amateur radio) by geographic coordinates or zone number.

Features

  • Search by coordinates: get the CQ Zone for a given latitude/longitude pair.
  • Search by zone number: retrieve details for a specific CQ Zone (1–40).
  • GeoJSON export: get the full GeoJSON FeatureCollection of all CQ Zones.

Installation

go get github.com/logocomune/go-cq-zone

API

// GetZoneByCoordinate returns the CQ Zone containing the given coordinate.
// Returns false if the coordinate is out of bounds or matches no zone.
func GetZoneByCoordinate(c Coordinate) (CqZone, bool)

// GetZoneByNumber returns the CQ Zone with the given number (1–40).
// Returns false if the number is out of range.
func GetZoneByNumber(id int) (CqZone, bool)

// GetGeoJSON returns a GeoJSON FeatureCollection of all 40 CQ Zones.
func GetGeoJSON() FeatureCollection

Usage

Lookup by coordinate

package main

import (
	"fmt"
	"github.com/logocomune/go-cq-zone"
)

func main() {
	zone, found := cqzone.GetZoneByCoordinate(cqzone.Coordinate{Lat: 43.71, Lng: 11.75})
	if !found {
		fmt.Println("Zone not found")
		return
	}
	fmt.Println("CQ Zone:", zone.Number)
	fmt.Println("Name:   ", zone.Name)
	fmt.Println("Center: ", zone.Center)
}

Lookup by zone number

zone, found := cqzone.GetZoneByNumber(15)
if !found {
	fmt.Println("Zone not found")
	return
}
fmt.Println("Name:", zone.Name)

Export GeoJSON

fc := cqzone.GetGeoJSON()
// fc is a GeoJSON FeatureCollection with all 40 zones.

Acknowledgments

Special thanks to @HB9HIL for providing the GeoJSON files of CQ Zones via their repository: hamradio-zones-geojson.

License

This project is distributed under the MIT License. See the LICENSE file for more details.

About

A Go package to retrieve amateur radio CQ Zones by geographic coordinates or zone number, with GeoJSON export support.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages