Documentation
¶
Index ¶
- Constants
- func CombineComponents(street, city, state, postalCode, country string, limit int) (map[string]string, error)
- type Address
- type Components
- type CongressionalDistrict
- type Fields
- type GeocodeResult
- type Geocodio
- func (g *Geocodio) Call(path string, query map[string]string) (GeocodeResult, error)
- func (g *Geocodio) Geocode(address string) (GeocodeResult, error)
- func (g *Geocodio) GeocodeAndReturnCongressionalDistrict(address string) (GeocodeResult, error)
- func (g *Geocodio) GeocodeAndReturnStateLegislativeDistricts(address string) (GeocodeResult, error)
- func (g *Geocodio) GeocodeAndReturnTimezone(address string) (GeocodeResult, error)
- func (g *Geocodio) GeocodeByComponents(street, city, state, postalCode, country string, limit int) (GeocodeResult, error)
- func (g *Geocodio) GeocodeByComponentsAndReturnTimezone(street, city, state, postalCode, country string, limit int) (GeocodeResult, error)
- func (g *Geocodio) GeocodeReturnFields(address string, fields ...string) (GeocodeResult, error)
- func (g *Geocodio) ReverseGeocode(latitude, longitude float64) (GeocodeResult, error)
- type Location
- type StateLegislativeDistrict
- type StateLegislativeDistricts
- type Timezone
Constants ¶
const (
// GeocodioAPIBaseURLv1 is the Geocod.io Base URL
GeocodioAPIBaseURLv1 = "https://api.geocod.io/v1.4"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Address ¶
type Address struct { Components Components `json:"address_components"` Formatted string `json:"formatted_address"` Location Location `json:"location"` Accuracy float64 `json:"accuracy"` AccuracyType string `json:"accuracy_type"` Source string `json:"source"` Fields Fields `json:"fields,omitempty"` }
type Components ¶
type Components struct { Number string `json:"number"` Street string `json:"street"` Suffix string `json:"suffix"` SecondaryNumber string `json:"secondarynumber"` SecondaryUnit string `json:"secondaryunit"` PostDirectional string `json:"postdirectional"` FormattedStreet string `json:"formatted_street"` City string `json:"city"` State string `json:"state"` Zip string `json:"zip"` County string `json:"county,omitempty"` Country string `json:"country"` PreDirectional string `json:"PreDirectional"` Prefix string `json:"Prefix"` }
type CongressionalDistrict ¶
type Fields ¶
type Fields struct { Timezone Timezone `json:"timezone,omitempty"` CongressionalDistrict CongressionalDistrict `json:"congressional_district,omitempty"` StateLegislativeDistricts StateLegislativeDistricts `json:"state_legislative_districts,omitempty"` }
Fields
type GeocodeResult ¶
type GeocodeResult struct { Input struct { AddressComponents Components `json:"address_components"` } `json:"input,omitempty"` Results []Address `json:"results"` Debug struct { RawResponse []byte `json:"-"` RequestedURL string `json:"requested_url"` Status string `json:"status"` StatusCode int `json:"status_code"` } `json:"-"` }
GeocodeResponse
func (*GeocodeResult) ResponseAsString ¶
func (self *GeocodeResult) ResponseAsString() string
type Geocodio ¶
type Geocodio struct {
APIKey string
}
Geocodio is the base struct
func NewGeocodio ¶
NewGeocodio is a helper to create new Geocodio pointer
func (*Geocodio) Geocode ¶
func (g *Geocodio) Geocode(address string) (GeocodeResult, error)
Geocode single address See: http://geocod.io/docs/#toc_4
func (*Geocodio) GeocodeAndReturnCongressionalDistrict ¶
func (g *Geocodio) GeocodeAndReturnCongressionalDistrict(address string) (GeocodeResult, error)
GeocodeAndReturnCongressionalDistrict will geocode and include Congressional District in the fields response
func (*Geocodio) GeocodeAndReturnStateLegislativeDistricts ¶
func (g *Geocodio) GeocodeAndReturnStateLegislativeDistricts(address string) (GeocodeResult, error)
GeocodeAndReturnStateLegislativeDistricts will geocode and include State Legislative Districts in the fields response
func (*Geocodio) GeocodeAndReturnTimezone ¶
func (g *Geocodio) GeocodeAndReturnTimezone(address string) (GeocodeResult, error)
GeocodeAndReturnTimezone will geocode and include Timezone in the fields response
func (*Geocodio) GeocodeByComponents ¶
func (g *Geocodio) GeocodeByComponents(street, city, state, postalCode, country string, limit int) (GeocodeResult, error)
func (*Geocodio) GeocodeByComponentsAndReturnTimezone ¶
func (g *Geocodio) GeocodeByComponentsAndReturnTimezone(street, city, state, postalCode, country string, limit int) (GeocodeResult, error)
GeocodeAndReturnTimezone will geocode and include Timezone in the fields response
func (*Geocodio) GeocodeReturnFields ¶
func (g *Geocodio) GeocodeReturnFields(address string, fields ...string) (GeocodeResult, error)
GeocodeReturnFields will geocode and includes additional fields in response
See: http://geocod.io/docs/#toc_22 Note: Each field counts as an additional lookup each
func (*Geocodio) ReverseGeocode ¶
func (g *Geocodio) ReverseGeocode(latitude, longitude float64) (GeocodeResult, error)
See: http://geocod.io/docs/#toc_16
ReverseGeocode does a reverse geocode look up for a single coordinate
type StateLegislativeDistricts ¶
type StateLegislativeDistricts struct { House StateLegislativeDistrict `json:"house"` Senate StateLegislativeDistrict `json:"senate"` }