Documentation
¶
Index ¶
- type BatchQuery
- type BatchRequestOpts
- type BatchResponse
- type Coordinates
- type ForwardRequestOpts
- type ForwardResponse
- type Geocode
- func (g *Geocode) Batch(queries []BatchQuery, req *BatchRequestOpts) (*BatchResponse, error)
- func (g *Geocode) Forward(place string, req *ForwardRequestOpts) (*ForwardResponse, error)
- func (g *Geocode) ForwardLegacy(place string, req *ForwardRequestOpts, permanent ...bool) (*ForwardResponse, error)
- func (g *Geocode) ForwardStructured(req *StructuredInputOpts) (*ForwardResponse, error)
- func (g *Geocode) ForwardWithBBox(place string, bbox base.BoundingBox, req *ForwardRequestOpts) (*ForwardResponse, error)
- func (g *Geocode) ForwardWithProximity(place string, proximity []float64, req *ForwardRequestOpts) (*ForwardResponse, error)
- func (g *Geocode) ForwardWithTypes(place string, types []Type, req *ForwardRequestOpts) (*ForwardResponse, error)
- func (g *Geocode) Reverse(loc *base.Location, req *ReverseRequestOpts) (*ReverseResponse, error)
- func (g *Geocode) ReverseLegacy(loc *base.Location, req *ReverseRequestOpts) (*ReverseResponse, error)
- func (g *Geocode) ReverseWithTypes(loc *base.Location, types []Type, req *ReverseRequestOpts) (*ReverseResponse, error)
- type MatchCode
- type ReverseRequestOpts
- type ReverseResponse
- type StructuredInputOpts
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchQuery ¶
type BatchQuery struct {
// For forward geocoding
Q string `json:"q,omitempty"`
Types string `json:"types,omitempty"`
BBox string `json:"bbox,omitempty"`
Limit int `json:"limit,omitempty"`
Country string `json:"country,omitempty"`
Language string `json:"language,omitempty"`
// For structured input forward geocoding
AddressLine1 string `json:"address_line1,omitempty"`
AddressNumber string `json:"address_number,omitempty"`
Street string `json:"street,omitempty"`
Block string `json:"block,omitempty"`
Place string `json:"place,omitempty"`
Region string `json:"region,omitempty"`
Postcode string `json:"postcode,omitempty"`
Locality string `json:"locality,omitempty"`
Neighborhood string `json:"neighborhood,omitempty"`
// For reverse geocoding
Longitude float64 `json:"longitude,omitempty"`
Latitude float64 `json:"latitude,omitempty"`
// Common parameters
Autocomplete bool `json:"autocomplete,omitempty"`
Proximity string `json:"proximity,omitempty"`
Worldview string `json:"worldview,omitempty"`
Format string `json:"format,omitempty"`
}
BatchQuery represents a single query in a batch request
type BatchRequestOpts ¶
type BatchRequestOpts struct {
Permanent bool `url:"permanent,omitempty"`
}
BatchRequestOpts options for batch geocoding requests
type BatchResponse ¶
type BatchResponse struct {
Batch []base.FeatureCollection `json:"batch"`
}
BatchResponse is the response to a batch geocode request (new in v6)
type Coordinates ¶
type Coordinates struct {
Longitude float64 `json:"longitude"`
Latitude float64 `json:"latitude"`
Accuracy string `json:"accuracy,omitempty"`
RoutablePoints []struct {
Name string `json:"name"`
Longitude float64 `json:"longitude"`
Latitude float64 `json:"latitude"`
} `json:"routable_points,omitempty"`
}
Coordinates represents the enhanced coordinate information (updated in v6)
type ForwardRequestOpts ¶
type ForwardRequestOpts struct {
Country string `url:"country,omitempty"`
Proximity string `url:"proximity,omitempty"`
Types string `url:"types,omitempty"`
Autocomplete bool `url:"autocomplete,omitempty"`
BBox string `url:"bbox,omitempty"`
Limit uint `url:"limit,omitempty"`
Language string `url:"language,omitempty"`
Worldview string `url:"worldview,omitempty"`
Format string `url:"format,omitempty"`
Permanent bool `url:"permanent,omitempty"`
}
ForwardRequestOpts request options for forward geocoding
type ForwardResponse ¶
type ForwardResponse struct {
*base.FeatureCollection
}
ForwardResponse is the response from a forward geocode lookup
type Geocode ¶
type Geocode struct {
// contains filtered or unexported fields
}
Geocode api wrapper instance
func NewGeocode ¶
NewGeocode Create a new Geocode API wrapper
func (*Geocode) Batch ¶
func (g *Geocode) Batch(queries []BatchQuery, req *BatchRequestOpts) (*BatchResponse, error)
Batch geocode lookup (improved in v6) Allows up to 1000 forward or reverse geocoding queries in a single request
func (*Geocode) Forward ¶
func (g *Geocode) Forward(place string, req *ForwardRequestOpts) (*ForwardResponse, error)
Forward geocode lookup using search text Finds locations from a place name
func (*Geocode) ForwardLegacy ¶
func (g *Geocode) ForwardLegacy(place string, req *ForwardRequestOpts, permanent ...bool) (*ForwardResponse, error)
ForwardLegacy provides backward compatibility with v5-style API calls Deprecated: Use Forward, ForwardWithTypes, or ForwardStructured instead
func (*Geocode) ForwardStructured ¶
func (g *Geocode) ForwardStructured(req *StructuredInputOpts) (*ForwardResponse, error)
ForwardStructured geocode lookup using structured input (new in v6) Provides more accurate results by specifying address components separately
func (*Geocode) ForwardWithBBox ¶
func (g *Geocode) ForwardWithBBox(place string, bbox base.BoundingBox, req *ForwardRequestOpts) (*ForwardResponse, error)
ForwardWithBBox is a convenience method that accepts bounding box and converts to string
func (*Geocode) ForwardWithProximity ¶
func (g *Geocode) ForwardWithProximity(place string, proximity []float64, req *ForwardRequestOpts) (*ForwardResponse, error)
ForwardWithProximity is a convenience method that accepts proximity coordinates as float slice
func (*Geocode) ForwardWithTypes ¶
func (g *Geocode) ForwardWithTypes(place string, types []Type, req *ForwardRequestOpts) (*ForwardResponse, error)
ForwardWithTypes is a convenience method that accepts Type slice and converts to string
func (*Geocode) Reverse ¶
func (g *Geocode) Reverse(loc *base.Location, req *ReverseRequestOpts) (*ReverseResponse, error)
Reverse geocode lookup Finds place names from a location
func (*Geocode) ReverseLegacy ¶
func (g *Geocode) ReverseLegacy(loc *base.Location, req *ReverseRequestOpts) (*ReverseResponse, error)
ReverseLegacy provides backward compatibility with v5-style reverse geocoding Deprecated: Use Reverse or ReverseWithTypes instead
func (*Geocode) ReverseWithTypes ¶
func (g *Geocode) ReverseWithTypes(loc *base.Location, types []Type, req *ReverseRequestOpts) (*ReverseResponse, error)
ReverseWithTypes is a convenience method that accepts Type slice and converts to string
type MatchCode ¶
type MatchCode struct {
AddressNumber string `json:"address_number,omitempty"`
Street string `json:"street,omitempty"`
Postcode string `json:"postcode,omitempty"`
Place string `json:"place,omitempty"`
Region string `json:"region,omitempty"`
Locality string `json:"locality,omitempty"`
Country string `json:"country,omitempty"`
Confidence string `json:"confidence,omitempty"`
}
MatchCode represents the smart address match information (new in v6)
type ReverseRequestOpts ¶
type ReverseRequestOpts struct {
Types string `url:"types,omitempty"`
Limit uint `url:"limit,omitempty"`
Country string `url:"country,omitempty"`
Language string `url:"language,omitempty"`
Worldview string `url:"worldview,omitempty"`
Permanent bool `url:"permanent,omitempty"`
}
ReverseRequestOpts request options for reverse geocoding
type ReverseResponse ¶
type ReverseResponse struct {
*base.FeatureCollection
}
ReverseResponse is the response to a reverse geocode request
type StructuredInputOpts ¶
type StructuredInputOpts struct {
AddressLine1 string `url:"address_line1,omitempty"`
AddressNumber string `url:"address_number,omitempty"`
Street string `url:"street,omitempty"`
Block string `url:"block,omitempty"`
Place string `url:"place,omitempty"`
Region string `url:"region,omitempty"`
Postcode string `url:"postcode,omitempty"`
Locality string `url:"locality,omitempty"`
Neighborhood string `url:"neighborhood,omitempty"`
Country string `url:"country,omitempty"`
Autocomplete bool `url:"autocomplete,omitempty"`
BBox string `url:"bbox,omitempty"`
Format string `url:"format,omitempty"`
Language string `url:"language,omitempty"`
Limit uint `url:"limit,omitempty"`
Proximity string `url:"proximity,omitempty"`
Types string `url:"types,omitempty"`
Worldview string `url:"worldview,omitempty"`
Permanent bool `url:"permanent,omitempty"`
}
StructuredInputOpts options for structured input forward geocoding (new in v6)
type Type ¶
type Type string
Type defines geocode location response types
const ( // Country level Country Type = "country" // Region level Region Type = "region" // Postcode level Postcode Type = "postcode" // District level District Type = "district" // Place level Place Type = "place" // Locality level Locality Type = "locality" // Neighborhood level Neighborhood Type = "neighborhood" // Street level (new in v6) Street Type = "street" // Block level (new in v6, for Japanese addresses) Block Type = "block" // Address level Address Type = "address" // Secondary address level (new in v6, US only) SecondaryAddress Type = "secondary_address" )