maze

package module
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 12 Imported by: 3

README

Maze

Go Report Card Documentation

This repository contains a set of tools to get locations (reverse search) for Geo URIs, location names, and airports. Special thanks to:

Without which this tool could not exist.

Install

go get go.hacdias.com/maze@latest

Usage

Check the documentation.

Contributing

Feel free to open an issue or a pull request.

License

MIT License © Henrique Dias

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GeoURI added in v0.5.0

type GeoURI struct {
	Latitude, Longitude, Altitude float64
	Parameters                    map[string][]string
	Query                         url.Values
}

GeoURI represents a geo URI according to rfc5870.

func ParseGeoURI added in v0.5.0

func ParseGeoURI(uri string) (*GeoURI, error)

func (*GeoURI) String added in v0.5.0

func (g *GeoURI) String() string

type Location

type Location struct {
	Latitude    float64 `json:"latitude,omitempty" yaml:"latitude,omitempty" csv:"latitude"`
	Longitude   float64 `json:"longitude,omitempty" yaml:"longitude,omitempty" csv:"longitude"`
	Altitude    float64 `json:"altitude,omitempty" yaml:"altitude,omitempty" csv:"altitude"`
	Name        string  `json:"name,omitempty" yaml:"name,omitempty" csv:"name"`
	Locality    string  `json:"locality,omitempty" yaml:"locality,omitempty" csv:"locality"`
	Region      string  `json:"region,omitempty" yaml:"region,omitempty" csv:"region"`
	Country     string  `json:"country,omitempty" yaml:"country,omitempty" csv:"country"`
	CountryCode string  `json:"countryCode,omitempty" yaml:"countryCode,omitempty" csv:"countryCode"`
	PostalCode  string  `json:"postalCode,omitempty" yaml:"postalCode,omitempty" csv:"postalCode"`
	ICAO        string  `json:"icao,omitempty" yaml:"icao,omitempty" csv:"icao"`
	IATA        string  `json:"iata,omitempty" yaml:"iata,omitempty" csv:"iata"`
}

func ParseLocation added in v0.5.0

func ParseLocation(geoUri string) (*Location, error)

ParseLocation parses a geo URI string and returns a Location struct. Query parameters are used to fill in additional fields, such as name, locality, etc.

func (*Location) Distance

func (l1 *Location) Distance(l2 *Location) float64

Distance returns the distance, in meters, between l1 and l2.

func (*Location) String added in v0.5.0

func (l *Location) String() string

String returns a geo URI representation of the Location struct, including query parameters for the fields that are not present in the base specification.

type Maze

type Maze struct {
	// contains filtered or unexported fields
}

func NewMaze

func NewMaze(client *http.Client) *Maze

func (*Maze) Airport

func (l *Maze) Airport(query string) (*Location, error)

func (*Maze) Reverse

func (l *Maze) Reverse(lang string, lon, lat float64) (*Location, error)

func (*Maze) ReverseGeoURI

func (l *Maze) ReverseGeoURI(lang, geoUri string) (*Location, error)

func (*Maze) Search

func (l *Maze) Search(lang, query string) (*Location, error)

Jump to

Keyboard shortcuts

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