cqzone

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 0 Imported by: 0

README

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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coordinate

type Coordinate struct {
	Lat float64 `json:"lat"`
	Lng float64 `json:"lng"`
}

type CqZone

type CqZone struct {
	Number  int        `json:"number"`
	Name    string     `json:"name"`
	Center  Coordinate `json:"center"`
	GeoJSON GeoJSON    `json:"geojson"`
}

func GetZoneByCoordinate

func GetZoneByCoordinate(c Coordinate) (CqZone, bool)

func GetZoneByNumber

func GetZoneByNumber(id int) (CqZone, bool)

type FeatureCollection

type FeatureCollection struct {
	Type     string    `json:"type"`
	Features []GeoJSON `json:"features"`
}

FeatureCollection represents a collection of GeoJSON features.

func GetGeoJSON added in v1.0.1

func GetGeoJSON() FeatureCollection

type GeoJSON

type GeoJSON struct {
	Type       string     `json:"type"`
	Properties Properties `json:"properties"`
	Geometry   Geometry   `json:"geometry"`
}

GeoJSON represents a GeoJSON feature with a type, properties, and geometry.

type Geometry

type Geometry struct {
	Type        string        `json:"type"`
	Coordinates [][][]float64 `json:"coordinates"`
}

Geometry defines a GeoJSON geometry object, represented by a type and a nested array of coordinates.

type Properties

type Properties struct {
	Name   string     `json:"name"`
	Number int        `json:"number"`
	Center Coordinate `json:"center"`
}

Properties is a structure representing various attributes including infos, a number, and a central coordinate.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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