Documentation
¶
Overview ¶
Package gogeocode provides utilities for utilizing the geocoding API provided through https://geocode.maps.co.
Index ¶
- Variables
- type Address
- type Client
- func (c Client) AddressGeocode(street, city, county, state, country, postalcode string) ([]*Response, error)
- func (c Client) AddressGeocodeWithContext(ctx context.Context, street, city, county, state, country, postalcode string) ([]*Response, error)
- func (c Client) Geocode(query string) ([]*Response, error)
- func (c Client) GeocodeWithContext(ctx context.Context, query string) ([]*Response, error)
- func (c Client) Reverse(lat, long float64) (*Response, error)
- func (c Client) ReverseWithContext(ctx context.Context, lat, long float64) (*Response, error)
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrAuthorization = errors.New("Geocode invalid API Key") ErrThrottle = errors.New("Geocode failed due to exceeding rquest limit") ErrTraffic = errors.New("Geocode failed due to high traffic on geocode server") ErrFlooding = errors.New("Geocode has detected api key abuse, contact: https://maps.co/contact/ to resolve") )
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct {
Tourism string `json:"tourism"`
HouseNumber string `json:"house_number"`
Road string `json:"road"`
Neighbourhood string `json:"neighbourhood"`
Suburb string `json:"suburb"`
County string `json:"county"`
City string `json:"city"`
State string `json:"state"`
ISO3166_2_lvl4 string `json:"ISO3166-2-lvl4"`
PostCode string `json:"postcode"`
Country string `json:"country"`
CountryCode string `json:"country_code"`
}
Address is apart of the Revese response
type Client ¶
type Client struct {
ApiKey string
}
Client is used to call geocoding api
func (Client) AddressGeocode ¶
func (c Client) AddressGeocode(street, city, county, state, country, postalcode string) ([]*Response, error)
AddressGeocode geocodes a specific address.
func (Client) AddressGeocodeWithContext ¶
func (c Client) AddressGeocodeWithContext(ctx context.Context, street, city, county, state, country, postalcode string) ([]*Response, error)
AddressGeocodeWithContext performs same action as AddressGeocode with provided context
func (Client) Geocode ¶
Geocode takes a string description of a location and returns precise location data. Possible queries include addresses or famous place names.
func (Client) GeocodeWithContext ¶
GeocodeWithContext performs the same request as Geocode using the given context.
type Response ¶
type Response struct {
PlaceID uint64 `json:"place_id"`
Licence string `json:"licence"`
OSMType string `json:"osm_type"`
OSMID uint64 `json:"osm_id"`
BoundingBox []string `json:"boundingbox"`
Latitude string `json:"lat"`
Longitude string `json:"lon"`
DisplayName string `json:"display_name"`
Class string `json:"class"`
Type string `json:"type"`
Importance float64 `json:"importance"`
// Address is only included when calling Reverse
Address Address `json:"address"`
}
Response contains all possible fields returned by the API
Click to show internal directories.
Click to hide internal directories.