here

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: AGPL-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 Address

type Address struct {
	Title           string `json:"title"`
	ID              string `json:"id"`
	ResultType      string `json:"resultType"`
	HouseNumberType string `json:"houseNumberType"`
	Address         struct {
		Label       string `json:"label"`
		CountryCode string `json:"countryCode"`
		CountryName string `json:"countryName"`
		StateCode   string `json:"stateCode"`
		State       string `json:"state"`
		County      string `json:"county"`
		City        string `json:"city"`
		District    string `json:"district"`
		Street      string `json:"street"`
		PostalCode  string `json:"postalCode"`
		HouseNumber string `json:"houseNumber"`
	} `json:"address"`
	Position struct {
		Lat float64 `json:"lat"`
		Lng float64 `json:"lng"`
	} `json:"position"`
	Access []struct {
		Lat float64 `json:"lat"`
		Lng float64 `json:"lng"`
	} `json:"access"`
	Distance float64 `json:"distance"`
	MapView  struct {
		West  float64 `json:"west"`
		South float64 `json:"south"`
		East  float64 `json:"east"`
		North float64 `json:"north"`
	} `json:"mapView"`
}

type Client

type Client struct {
	AppID   string
	AppCode string
	APIKey  string
}

func NewClient

func NewClient(appID, appCode, apiKey string) (Client, error)

func (Client) Geocode

func (c Client) Geocode(r GeocodeRequest) (GeoPosition, error)

func (Client) ReverseGeocodeV7

func (c Client) ReverseGeocodeV7(lat, lng float64, limit int) (*ReverseGeocodeResponse, error)

type GeoPosition

type GeoPosition struct {
	Lng float64
	Lat float64
}

type GeocodeRequest

type GeocodeRequest struct {
	Country    string
	City       string
	PostalCode string
	Street     string
}

type GeocodeResponse

type GeocodeResponse struct {
	Response struct {
		View []struct {
			Type   string `json:"_type"`
			Result []struct {
				Relevance    float64 `json:"Relevance"`
				MatchLevel   string  `json:"MatchLevel"`
				MatchQuality struct {
					Country     float64   `json:"Country"`
					Street      []float64 `json:"Street"`
					HouseNumber float64   `json:"HouseNumber"`
				} `json:"MatchQuality"`
				Location struct {
					LocationType    string `json:"LocationType"`
					DisplayPosition struct {
						Latitude  float64 `json:"Latitude"`
						Longitude float64 `json:"Longitude"`
					} `json:"DisplayPosition"`
					Address struct {
						Label          string `json:"Label"`
						Country        string `json:"Country"`
						State          string `json:"State"`
						County         string `json:"County"`
						City           string `json:"City"`
						District       string `json:"District"`
						Street         string `json:"Street"`
						HouseNumber    string `json:"HouseNumber"`
						PostalCode     string `json:"PostalCode"`
						AdditionalData []struct {
							Value string `json:"value"`
							Key   string `json:"key"`
						} `json:"AdditionalData"`
					} `json:"Address"`
				} `json:"Location"`
			} `json:"Result"`
		} `json:"View"`
	} `json:"Response"`
}

func (GeocodeResponse) MostRelevantGeoPosition

func (g GeocodeResponse) MostRelevantGeoPosition() (GeoPosition, error)

MostRelevantGeoPosition returns a single geo position with the highest relevant score

type ReverseGeocodeResponse

type ReverseGeocodeResponse struct {
	Items []Address `json:"items"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳