opencage

package
v0.0.0-...-a07846c Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GeocodeError

type GeocodeError struct {
	Result *GeocodeResult
}

func (*GeocodeError) Error

func (err *GeocodeError) Error() string

type GeocodeParams

type GeocodeParams struct {
	// Country hint
	CountryCode string
	Language    string
}

type GeocodeResult

type GeocodeResult struct {
	Status struct {
		Code    int    `json:"code"`
		Message string `json:"message"`
	} `json:"status"`

	Rate struct {
		Limit     int   `json:"limit"`
		Remaining int   `json:"remaining"`
		Reset     int64 `json:"reset"`
	} `json:"rate"`

	Results []GeocodeResultItem `json:"results"`
}

type GeocodeResultItem

type GeocodeResultItem struct {
	Confidence int                    `json:"confidence"`
	Formatted  string                 `json:"formatted"`
	Geometry   Geometry               `json:"geometry"`
	Components map[string]interface{} `json:"components"`

	Bounds struct {
		NorthEast Geometry `json:"northeast"`
		SouthWest Geometry `json:"southwest"`
	} `json:"bounds"`
}

type Geocoder

type Geocoder struct {
	Key        string
	HttpClient *http.Client
}

func NewGeocoder

func NewGeocoder(key string) *Geocoder

func (*Geocoder) Geocode

func (g *Geocoder) Geocode(query string, params *GeocodeParams) (*GeocodeResult, error)

type Geometry

type Geometry struct {
	Latitude  float32 `json:"lat"`
	Longitude float32 `json:"lng"`
}

Jump to

Keyboard shortcuts

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