geonames

package
v0.1.4-alpha-deployment1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2022 License: Apache-2.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 Client

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

func NewClient

func NewClient(username string) *Client

func (*Client) FindOneLocation

func (c *Client) FindOneLocation(ctx context.Context, name string) (*Geoname, error)

type Geoname

type Geoname struct {
	GeonameID   int    `json:"geonameId"`
	CountryID   string `json:"countryId"`
	ToponymName string `json:"toponymName"`
	Population  int    `json:"population"`
	CountryCode string `json:"countryCode"`
	Name        string `json:"name"`
	CountryName string `json:"countryName"`
	Lat         string `json:"lat"`
	Lng         string `json:"lng"`
}

Geoname contains location data

func (*Geoname) Coordinates

func (g *Geoname) Coordinates() (string, string)

GetCoordinates returns latitude and longitude

func (*Geoname) CoordinatesFloat64

func (g *Geoname) CoordinatesFloat64() (float64, float64, error)

type LocationResult

type LocationResult struct {
	ResultCount int       `json:"totalResultsCount"`
	Geonames    []Geoname `json:"geonames"`
}

LocationResult contains found locations

Jump to

Keyboard shortcuts

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