Documentation ¶
Overview ¶
Package maps provides a client library for the Google Maps Web Service APIs. Please see https://developers.google.com/maps/documentation/webservices/ for an overview of the Maps Web Service API suite.
Index ¶
- Constants
- func Encode(path []LatLng) string
- type AddressComponent
- type AddressGeometry
- type AltID
- type Anchor
- type AutocompleteMatchedSubstring
- type AutocompletePlaceType
- type AutocompletePrediction
- type AutocompleteResponse
- type AutocompleteStructuredFormatting
- type AutocompleteTermOffset
- type Avoid
- type CellTower
- type Client
- func (c *Client) Directions(ctx context.Context, r *DirectionsRequest) ([]Route, []GeocodedWaypoint, error)
- func (c *Client) DistanceMatrix(ctx context.Context, r *DistanceMatrixRequest) (*DistanceMatrixResponse, error)
- func (c *Client) Elevation(ctx context.Context, r *ElevationRequest) ([]ElevationResult, error)
- func (c *Client) Geocode(ctx context.Context, r *GeocodingRequest) ([]GeocodingResult, error)
- func (c *Client) Geolocate(ctx context.Context, r *GeolocationRequest) (*GeolocationResult, error)
- func (c *Client) NearbySearch(ctx context.Context, r *NearbySearchRequest) (PlacesSearchResponse, error)
- func (c *Client) NearestRoads(ctx context.Context, r *NearestRoadsRequest) (*NearestRoadsResponse, error)
- func (c *Client) PlaceAutocomplete(ctx context.Context, r *PlaceAutocompleteRequest) (AutocompleteResponse, error)
- func (c *Client) PlaceDetails(ctx context.Context, r *PlaceDetailsRequest) (PlaceDetailsResult, error)
- func (c *Client) PlacePhoto(ctx context.Context, r *PlacePhotoRequest) (PlacePhotoResponse, error)
- func (c *Client) QueryAutocomplete(ctx context.Context, r *QueryAutocompleteRequest) (AutocompleteResponse, error)
- func (c *Client) RadarSearch(ctx context.Context, r *RadarSearchRequest) (PlacesSearchResponse, error)deprecated
- func (c *Client) ReverseGeocode(ctx context.Context, r *GeocodingRequest) ([]GeocodingResult, error)
- func (c *Client) SnapToRoad(ctx context.Context, r *SnapToRoadRequest) (*SnapToRoadResponse, error)
- func (c *Client) SpeedLimits(ctx context.Context, r *SpeedLimitsRequest) (*SpeedLimitsResponse, error)
- func (c *Client) StaticMap(ctx context.Context, r *StaticMapRequest) (image.Image, error)
- func (c *Client) TextSearch(ctx context.Context, r *TextSearchRequest) (PlacesSearchResponse, error)
- func (c *Client) Timezone(ctx context.Context, r *TimezoneRequest) (*TimezoneResult, error)
- type ClientOption
- func WithAPIKey(apiKey string) ClientOption
- func WithBaseURL(baseURL string) ClientOption
- func WithChannel(channel string) ClientOption
- func WithClientIDAndSignature(clientID, signature string) ClientOption
- func WithHTTPClient(c *http.Client) ClientOption
- func WithRateLimit(requestsPerSecond int) ClientOption
- type Component
- type CustomIcon
- type DirectionsRequest
- type Distance
- type DistanceMatrixElement
- type DistanceMatrixElementsRow
- type DistanceMatrixRequest
- type DistanceMatrixResponse
- type ElevationRequest
- type ElevationResult
- type Fare
- type Format
- type GeocodeAccuracy
- type GeocodedWaypoint
- type GeocodingRequest
- type GeocodingResult
- type GeolocationError
- type GeolocationRequest
- type GeolocationResult
- type LatLng
- type LatLngBounds
- type Leg
- type MapStyle
- type MapType
- type Marker
- type MarkerSize
- type Mode
- type NearbySearchRequest
- type NearestRoadsRequest
- type NearestRoadsResponse
- type OpeningHours
- type OpeningHoursOpenClose
- type OpeningHoursPeriod
- type Path
- type Photo
- type PlaceAutocompleteRequest
- type PlaceDetailsRequest
- type PlaceDetailsResult
- type PlacePhotoRequest
- type PlacePhotoResponse
- type PlaceReview
- type PlaceReviewAspect
- type PlaceType
- type PlacesSearchResponse
- type PlacesSearchResult
- type Polyline
- type PriceLevel
- type QueryAutocompleteRequest
- type RadarSearchRequest
- type RadioType
- type RankBy
- type Route
- type SnapToRoadRequest
- type SnapToRoadResponse
- type SnappedPoint
- type SpeedLimit
- type SpeedLimitsRequest
- type SpeedLimitsResponse
- type StaticMapRequest
- type Step
- type TextSearchRequest
- type TimezoneRequest
- type TimezoneResult
- type TrafficModel
- type TransitAgency
- type TransitDetails
- type TransitLine
- type TransitLineVehicle
- type TransitMode
- type TransitRoutingPreference
- type TransitStop
- type Units
- type WiFiAccessPoint
Constants ¶
const ( // GeocodeAccuracyRooftop restricts the results to addresses for which Google has location information accurate down to street address precision GeocodeAccuracyRooftop = GeocodeAccuracy("ROOFTOP") // GeocodeAccuracyRangeInterpolated restricts the results to those that reflect an approximation interpolated between two precise points. GeocodeAccuracyRangeInterpolated = GeocodeAccuracy("RANGE_INTERPOLATED") // GeocodeAccuracyGeometricCenter restricts the results to geometric centers of a location such as a polyline or polygon. GeocodeAccuracyGeometricCenter = GeocodeAccuracy("GEOMETRIC_CENTER") // GeocodeAccuracyApproximate restricts the results to those that are characterized as approximate. GeocodeAccuracyApproximate = GeocodeAccuracy("APPROXIMATE") )
const ( // SpeedLimitMPH is for requesting speed limits in Miles Per Hour. SpeedLimitMPH = "MPH" // SpeedLimitKPH is for requesting speed limits in Kilometers Per Hour. SpeedLimitKPH = "KPH" )
const ( //RoadMap (default) specifies a standard roadmap image, as is normally shown on the Google Maps website. If no maptype value is specified, the Google Static Maps API serves roadmap tiles by default. RoadMap MapType = "roadmap" //Satellite specifies a satellite image. Satellite MapType = "satellite" //Terrain specifies a physical relief map image, showing terrain and vegetation. Terrain MapType = "terrain" //Hybrid specifies a hybrid of the satellite and roadmap image, showing a transparent layer of major streets and place names on the satellite image. Hybrid MapType = "hybrid" //PNG8 or png (default) specifies the 8-bit PNG format. PNG8 Format = "png8" //PNG32 specifies the 32-bit PNG format. PNG32 Format = "png32" //GIF specifies the GIF format. GIF Format = "gif" //JPG specifies the JPEG compression format. JPG Format = "jpg" //JPGBaseline specifies a non-progressive JPEG compression format. JPGBaseline Format = "jpg-baseline" //Tiny Marker size Tiny MarkerSize = "tiny" //Mid Marker size Mid MarkerSize = "mid" //Small Marker size Small MarkerSize = "small" //Top Marker anchor position Top Anchor = "top" //Bottom Marker anchor position Bottom Anchor = "Bottom" //Left Marker anchor position Left Anchor = "left" //Right Marker anchor position Right Anchor = "right" //Center Marker anchor position Center Anchor = "center" //Topleft Marker anchor position Topleft Anchor = "topleft" //Topright Marker anchor position Topright Anchor = "topright" //Bottomleft Marker anchor position Bottomleft Anchor = "bottomleft" //Bottomright Marker anchor position Bottomright Anchor = "bottomright" )
const ( TravelModeDriving = Mode("driving") TravelModeWalking = Mode("walking") TravelModeBicycling = Mode("bicycling") TravelModeTransit = Mode("transit") )
Travel mode preferences.
const ( AvoidTolls = Avoid("tolls") AvoidHighways = Avoid("highways") AvoidFerries = Avoid("ferries") )
Features to avoid.
const ( UnitsMetric = Units("metric") UnitsImperial = Units("imperial") )
Units to use on human readable distances.
const ( TransitModeBus = TransitMode("bus") TransitModeSubway = TransitMode("subway") TransitModeTrain = TransitMode("train") TransitModeTram = TransitMode("tram") TransitModeRail = TransitMode("rail") )
Transit mode of directions or distance matrix request.
const ( TransitRoutingPreferenceLessWalking = TransitRoutingPreference("less_walking") TransitRoutingPreferenceFewerTransfers = TransitRoutingPreference("fewer_transfers") )
Transit Routing preferences for transit mode requests
const ( TrafficModelBestGuess = TrafficModel("best_guess") TrafficModelOptimistic = TrafficModel("optimistic") TrafficModelPessimistic = TrafficModel("pessimistic") )
Traffic prediction model when requesting future directions.
const ( PriceLevelFree = PriceLevel("0") PriceLevelInexpensive = PriceLevel("1") PriceLevelModerate = PriceLevel("2") PriceLevelExpensive = PriceLevel("3") PriceLevelVeryExpensive = PriceLevel("4") )
Price Levels for the Places API
const ( // ComponentRoute matches long or short name of a route ComponentRoute = Component("route") // ComponentLocality matches against both locality and sublocality types ComponentLocality = Component("locality") // ComponentAdministrativeArea matches all the administrative_area levels ComponentAdministrativeArea = Component("administrative_area") // ComponentPostalCode matches postal_code and postal_code_prefix ComponentPostalCode = Component("postal_code") // ComponentCountry matches a country name or a two letter ISO 3166-1 country code ComponentCountry = Component("country") )
const ( RankByProminence = RankBy("prominence") RankByDistance = RankBy("distance") )
RankBy options for Places Search
const ( PlaceTypeAccounting = PlaceType("accounting") PlaceTypeAirport = PlaceType("airport") PlaceTypeAmusementPark = PlaceType("amusement_park") PlaceTypeAquarium = PlaceType("aquarium") PlaceTypeArtGallery = PlaceType("art_gallery") PlaceTypeAtm = PlaceType("atm") PlaceTypeBakery = PlaceType("bakery") PlaceTypeBank = PlaceType("bank") PlaceTypeBar = PlaceType("bar") PlaceTypeBeautySalon = PlaceType("beauty_salon") PlaceTypeBicycleStore = PlaceType("bicycle_store") PlaceTypeBookStore = PlaceType("book_store") PlaceTypeBowlingAlley = PlaceType("bowling_alley") PlaceTypeBusStation = PlaceType("bus_station") PlaceTypeCafe = PlaceType("cafe") PlaceTypeCampground = PlaceType("campground") PlaceTypeCarDealer = PlaceType("car_dealer") PlaceTypeCarRental = PlaceType("car_rental") PlaceTypeCarRepair = PlaceType("car_repair") PlaceTypeCarWash = PlaceType("car_wash") PlaceTypeCasino = PlaceType("casino") PlaceTypeCemetery = PlaceType("cemetery") PlaceTypeChurch = PlaceType("church") PlaceTypeCityHall = PlaceType("city_hall") PlaceTypeClothingStore = PlaceType("clothing_store") PlaceTypeConvenienceStore = PlaceType("convenience_store") PlaceTypeCourthouse = PlaceType("courthouse") PlaceTypeDentist = PlaceType("dentist") PlaceTypeDepartmentStore = PlaceType("department_store") PlaceTypeDoctor = PlaceType("doctor") PlaceTypeElectrician = PlaceType("electrician") PlaceTypeElectronicsStore = PlaceType("electronics_store") PlaceTypeEmbassy = PlaceType("embassy") PlaceTypeEstablishment = PlaceType("establishment") PlaceTypeFinance = PlaceType("finance") PlaceTypeFireStation = PlaceType("fire_station") PlaceTypeFlorist = PlaceType("florist") PlaceTypeFood = PlaceType("food") PlaceTypeFuneralHome = PlaceType("funeral_home") PlaceTypeFurnitureStore = PlaceType("furniture_store") PlaceTypeGasStation = PlaceType("gas_station") PlaceTypeGeneralContractor = PlaceType("general_contractor") PlaceTypeGroceryOrSupermarket = PlaceType("grocery_or_supermarket") PlaceTypeGym = PlaceType("gym") PlaceTypeHairCare = PlaceType("hair_care") PlaceTypeHardwareStore = PlaceType("hardware_store") PlaceTypeHealth = PlaceType("health") PlaceTypeHinduTemple = PlaceType("hindu_temple") PlaceTypeHomeGoodsStore = PlaceType("home_goods_store") PlaceTypeHospital = PlaceType("hospital") PlaceTypeInsuranceAgency = PlaceType("insurance_agency") PlaceTypeJewelryStore = PlaceType("jewelry_store") PlaceTypeLaundry = PlaceType("laundry") PlaceTypeLawyer = PlaceType("lawyer") PlaceTypeLibrary = PlaceType("library") PlaceTypeLiquorStore = PlaceType("liquor_store") PlaceTypeLocalGovernmentOffice = PlaceType("local_government_office") PlaceTypeLocksmith = PlaceType("locksmith") PlaceTypeLodging = PlaceType("lodging") PlaceTypeMealDelivery = PlaceType("meal_delivery") PlaceTypeMealTakeaway = PlaceType("meal_takeaway") PlaceTypeMosque = PlaceType("mosque") PlaceTypeMovieRental = PlaceType("movie_rental") PlaceTypeMovieTheater = PlaceType("movie_theater") PlaceTypeMovingCompany = PlaceType("moving_company") PlaceTypeMuseum = PlaceType("museum") PlaceTypeNightClub = PlaceType("night_club") PlaceTypePainter = PlaceType("painter") PlaceTypePark = PlaceType("park") PlaceTypeParking = PlaceType("parking") PlaceTypePetStore = PlaceType("pet_store") PlaceTypePharmacy = PlaceType("pharmacy") PlaceTypePhysiotherapist = PlaceType("physiotherapist") PlaceTypePlaceOfWorship = PlaceType("place_of_worship") PlaceTypePlumber = PlaceType("plumber") PlaceTypePolice = PlaceType("police") PlaceTypePostOffice = PlaceType("post_office") PlaceTypeRealEstateAgency = PlaceType("real_estate_agency") PlaceTypeRestaurant = PlaceType("restaurant") PlaceTypeRoofingContractor = PlaceType("roofing_contractor") PlaceTypeRvPark = PlaceType("rv_park") PlaceTypeSchool = PlaceType("school") PlaceTypeShoeStore = PlaceType("shoe_store") PlaceTypeShoppingMall = PlaceType("shopping_mall") PlaceTypeSpa = PlaceType("spa") PlaceTypeStadium = PlaceType("stadium") PlaceTypeStorage = PlaceType("storage") PlaceTypeStore = PlaceType("store") PlaceTypeSubwayStation = PlaceType("subway_station") PlaceTypeSynagogue = PlaceType("synagogue") PlaceTypeTaxiStand = PlaceType("taxi_stand") PlaceTypeTrainStation = PlaceType("train_station") PlaceTypeTravelAgency = PlaceType("travel_agency") PlaceTypeUniversity = PlaceType("university") PlaceTypeVeterinaryCare = PlaceType("veterinary_care") PlaceTypeZoo = PlaceType("zoo") )
Place Types for the Places API
const ( AutocompletePlaceTypeGeocode = AutocompletePlaceType("geocode") AutocompletePlaceTypeAddress = AutocompletePlaceType("address") AutocompletePlaceTypeEstablishment = AutocompletePlaceType("establishment") AutocompletePlaceTypeRegions = AutocompletePlaceType("(regions)") AutocompletePlaceTypeCities = AutocompletePlaceType("(cities)") )
https://developers.google.com/places/web-service/autocomplete#place_types
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddressComponent ¶
type AddressComponent struct { LongName string `json:"long_name"` ShortName string `json:"short_name"` Types []string `json:"types"` }
AddressComponent is a part of an address
type AddressGeometry ¶
type AddressGeometry struct { Location LatLng `json:"location"` LocationType string `json:"location_type"` Bounds LatLngBounds `json:"bounds"` Viewport LatLngBounds `json:"viewport"` Types []string `json:"types"` }
AddressGeometry is the location of a an address
type AltID ¶
type AltID struct { // PlaceID is the APP scoped Place ID that you received when you initially created this Place, before it was given a Google wide Place ID. PlaceID string `json:"place_id,omitempty"` // Scope is the scope of this alternative place ID. It will always be APP, indicating that the alternative place ID is recognised by your application only. Scope string `json:"scope,omitempty"` }
AltID is the alternative place IDs for a place.
type Anchor ¶
type Anchor string
Anchor sets how the icon is placed in relation to the specified markers locations
type AutocompleteMatchedSubstring ¶
type AutocompleteMatchedSubstring struct { // Length describes the length of the matched substring. Length int `json:"length"` // Offset defines the start position of the matched substring. Offset int `json:"offset"` }
AutocompleteMatchedSubstring describes the location of the entered term in the prediction result text, so that the term can be highlighted if desired.
type AutocompletePlaceType ¶
type AutocompletePlaceType string
AutocompletePlaceType restricts Place Autocomplete API to the results to places matching the specified type.
func ParseAutocompletePlaceType ¶
func ParseAutocompletePlaceType(placeType string) (AutocompletePlaceType, error)
type AutocompletePrediction ¶
type AutocompletePrediction struct { // Description of the matched prediction. Description string `json:"description,omitempty"` // PlaceID is the ID of the Place PlaceID string `json:"place_id,omitempty"` // Types is an array indicating the type of the address component. Types []string `json:"types,omitempty"` // MatchedSubstring describes the location of the entered term in the prediction result text, so that the term can be highlighted if desired. MatchedSubstrings []AutocompleteMatchedSubstring `json:"matched_substrings,omitempty"` // Terms contains an array of terms identifying each section of the returned description (a section of the description is generally terminated with a comma). Terms []AutocompleteTermOffset `json:"terms,omitempty"` // StructuredFormatting contains the main and secondary text of a prediction StructuredFormatting AutocompleteStructuredFormatting `json:"structured_formatting,omitempty"` }
AutocompletePrediction represents a single Query Autocomplete result returned from the Google Places API Web Service.
type AutocompleteResponse ¶
type AutocompleteResponse struct {
Predictions []AutocompletePrediction `json:"predictions"`
}
AutocompleteResponse is a response to a Query Autocomplete request.
type AutocompleteStructuredFormatting ¶
type AutocompleteStructuredFormatting struct { MainText string `json:"main_text,omitempty"` MainTextMatchedSubstrings []AutocompleteMatchedSubstring `json:"main_text_matched_substrings,omitempty"` SecondaryText string `json:"secondary_text,omitempty"` }
AutocompleteStructuredFormatting contains the main and secondary text of an autocomplete prediction
type AutocompleteTermOffset ¶
type AutocompleteTermOffset struct { // Value is the text of the matched term. Value string `json:"value,omitempty"` // Offset defines the start position of this term in the description, measured in Unicode characters. Offset int `json:"offset"` }
AutocompleteTermOffset identifies each section of the returned description (a section of the description is generally terminated with a comma).
type CellTower ¶
type CellTower struct { // CellID Unique identifier of the cell CellID int `json:"cellId,omitempty"` // LocationAreaCode is the Location Area Code (LAC) for GSM and WCDMAnetworks. The Network ID (NID) for CDMA networks. LocationAreaCode int `json:"locationAreaCode,omitempty"` // MobileCountryCode is the cell tower's Mobile Country Code (MCC). MobileCountryCode int `json:"mobileCountryCode,omitempty"` // MobileNetworkCode is the cell tower's Mobile Network Code. This is the MNC for GSM and WCDMA; CDMA uses the System ID (SID). MobileNetworkCode int `json:"mobileNetworkCode,omitempty"` // Age is the number of milliseconds since this cell was primary. If age is 0, the cellId represents a current measurement. Age int `json:"age,omitempty"` // SignalStrength is the radio signal strength measured in dBm. SignalStrength int `json:"signalStrength,omitempty"` // TimingAdvance is the timing advance value. Please see https://en.wikipedia.org/wiki/Timing_advance for more detail. TimingAdvance int `json:"timingAdvance,omitempty"` }
CellTower is a cell tower object for localisation requests
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client may be used to make requests to the Google Maps WebService APIs
func NewClient ¶
func NewClient(options ...ClientOption) (*Client, error)
NewClient constructs a new Client which can make requests to the Google Maps WebService APIs.
func (*Client) Directions ¶
func (c *Client) Directions(ctx context.Context, r *DirectionsRequest) ([]Route, []GeocodedWaypoint, error)
Directions issues the Directions request and retrieves the Response
func (*Client) DistanceMatrix ¶
func (c *Client) DistanceMatrix(ctx context.Context, r *DistanceMatrixRequest) (*DistanceMatrixResponse, error)
DistanceMatrix makes a Distance Matrix API request
func (*Client) Elevation ¶
func (c *Client) Elevation(ctx context.Context, r *ElevationRequest) ([]ElevationResult, error)
Elevation makes an Elevation API request
func (*Client) Geocode ¶
func (c *Client) Geocode(ctx context.Context, r *GeocodingRequest) ([]GeocodingResult, error)
Geocode makes a Geocoding API request
func (*Client) Geolocate ¶
func (c *Client) Geolocate(ctx context.Context, r *GeolocationRequest) (*GeolocationResult, error)
Geolocate makes a Geolocation API request
func (*Client) NearbySearch ¶
func (c *Client) NearbySearch(ctx context.Context, r *NearbySearchRequest) (PlacesSearchResponse, error)
NearbySearch lets you search for places within a specified area. You can refine your search request by supplying keywords or specifying the type of place you are searching for.
func (*Client) NearestRoads ¶
func (c *Client) NearestRoads(ctx context.Context, r *NearestRoadsRequest) (*NearestRoadsResponse, error)
NearestRoads makes a Nearest Roads API request
func (*Client) PlaceAutocomplete ¶
func (c *Client) PlaceAutocomplete(ctx context.Context, r *PlaceAutocompleteRequest) (AutocompleteResponse, error)
PlaceAutocomplete issues the Places API Place Autocomplete request and retrieves the response
func (*Client) PlaceDetails ¶
func (c *Client) PlaceDetails(ctx context.Context, r *PlaceDetailsRequest) (PlaceDetailsResult, error)
PlaceDetails issues the Places API Place Details request and retrieves the response
func (*Client) PlacePhoto ¶
func (c *Client) PlacePhoto(ctx context.Context, r *PlacePhotoRequest) (PlacePhotoResponse, error)
PlacePhoto issues the Places API Photo request and retrieves the response
func (*Client) QueryAutocomplete ¶
func (c *Client) QueryAutocomplete(ctx context.Context, r *QueryAutocompleteRequest) (AutocompleteResponse, error)
QueryAutocomplete issues the Places API Query Autocomplete request and retrieves the response
func (*Client) RadarSearch
deprecated
func (c *Client) RadarSearch(ctx context.Context, r *RadarSearchRequest) (PlacesSearchResponse, error)
RadarSearch lets you search for places within a specified area. You can refine your search request by supplying keywords or specifying the type of place you are searching for.
Deprecated: This functionality is deprecated and will stop working on June 30, 2018. See https://maps-apis.googleblog.com/2017/06/announcing-deprecation-of-place-add.html for more detail.
func (*Client) ReverseGeocode ¶
func (c *Client) ReverseGeocode(ctx context.Context, r *GeocodingRequest) ([]GeocodingResult, error)
ReverseGeocode makes a Reverse Geocoding API request
func (*Client) SnapToRoad ¶
func (c *Client) SnapToRoad(ctx context.Context, r *SnapToRoadRequest) (*SnapToRoadResponse, error)
SnapToRoad makes a Snap to Road API request
func (*Client) SpeedLimits ¶
func (c *Client) SpeedLimits(ctx context.Context, r *SpeedLimitsRequest) (*SpeedLimitsResponse, error)
SpeedLimits makes a Speed Limits API request
func (*Client) TextSearch ¶
func (c *Client) TextSearch(ctx context.Context, r *TextSearchRequest) (PlacesSearchResponse, error)
TextSearch issues the Places API Text Search request and retrieves the Response
func (*Client) Timezone ¶
func (c *Client) Timezone(ctx context.Context, r *TimezoneRequest) (*TimezoneResult, error)
Timezone makes a Timezone API request
type ClientOption ¶
ClientOption is the type of constructor options for NewClient(...).
func WithAPIKey ¶
func WithAPIKey(apiKey string) ClientOption
WithAPIKey configures a Maps API client with an API Key
func WithBaseURL ¶
func WithBaseURL(baseURL string) ClientOption
WithBaseURL configures a Maps API client with a custom base url
func WithChannel ¶
func WithChannel(channel string) ClientOption
WithChannel configures a Maps API client with a Channel
func WithClientIDAndSignature ¶
func WithClientIDAndSignature(clientID, signature string) ClientOption
WithClientIDAndSignature configures a Maps API client for a Maps for Work application The signature is assumed to be URL modified Base64 encoded
func WithHTTPClient ¶
func WithHTTPClient(c *http.Client) ClientOption
WithHTTPClient configures a Maps API client with a http.Client to make requests over.
func WithRateLimit ¶
func WithRateLimit(requestsPerSecond int) ClientOption
WithRateLimit configures the rate limit for back end requests. Default is to limit to 50 requests per second. A value of zero disables rate limiting.
type Component ¶
type Component string
Component specifies a key for the parts of a structured address. See https://developers.google.com/maps/documentation/geocoding/intro#ComponentFiltering for more detail.
type CustomIcon ¶
type CustomIcon struct { //IconURL is th icon URL IconURL string //Anchor sets how the icon is placed in relation to the specified markers locations Anchor Anchor }
CustomIcon replace the default Map Pin
func (CustomIcon) String ¶
func (c CustomIcon) String() string
type DirectionsRequest ¶
type DirectionsRequest struct { // Origin is the address or textual latitude/longitude value from which you wish to calculate directions. Required. Origin string // Destination is the address or textual latitude/longitude value from which you wish to calculate directions. Required. Destination string // Mode specifies the mode of transport to use when calculating directions. Optional. Mode Mode // DepartureTime specifies the desired time of departure. You can specify the time as an integer in seconds since midnight, January 1, 1970 UTC. Alternatively, you can specify a value of `"now"`. Optional. DepartureTime string // ArrivalTime specifies the desired time of arrival for transit directions, in seconds since midnight, January 1, 1970 UTC. Optional. You cannot specify both `DepartureTime` and `ArrivalTime`. ArrivalTime string // Waypoints specifies an array of points to add to a route. Optional. Waypoints []string // Alternatives specifies if Directions service may provide more than one route alternative in the response. Optional. Alternatives bool // Optimize allow the Directions service to optimize the provided route by rearranging the waypoints in a more efficient order. Optional. Optimize bool // Avoid indicates that the calculated route(s) should avoid the indicated features. Optional. Avoid []Avoid // Language specifies the language in which to return results. Optional. Language string // Units specifies the unit system to use when displaying results. Optional. Units Units // Region specifies the region code, specified as a ccTLD two-character value. Optional. Region string // TransitMode specifies one or more preferred modes of transit. This parameter may only be specified for transit directions. Optional. TransitMode []TransitMode // TransitRoutingPreference specifies preferences for transit routes. Optional. TransitRoutingPreference TransitRoutingPreference // TrafficModel specifies traffic prediction model when requesting future directions. Optional. TrafficModel TrafficModel }
DirectionsRequest is the functional options struct for directions.Get
type Distance ¶
type Distance struct { // HumanReadable is the human friendly distance. This is rounded and in an appropriate unit for the // request. The units can be overriden with a request parameter. HumanReadable string `json:"text"` // Meters is the numeric distance, always in meters. This is intended to be used only in // algorithmic situations, e.g. sorting results by some user specified metric. Meters int `json:"value"` }
Distance is the API representation for a distance between two points.
type DistanceMatrixElement ¶
type DistanceMatrixElement struct { Status string `json:"status"` // Duration is the length of time it takes to travel this route. Duration time.Duration `json:"duration"` // DurationInTraffic is the length of time it takes to travel this route considering traffic. DurationInTraffic time.Duration `json:"duration_in_traffic"` // Distance is the total distance of this route. Distance Distance `json:"distance"` }
DistanceMatrixElement is the travel distance and time for a pair of origin and destination.
func (*DistanceMatrixElement) MarshalJSON ¶
func (dme *DistanceMatrixElement) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler for DistanceMatrixElement. This encodes Go types back to the API representation.
func (*DistanceMatrixElement) UnmarshalJSON ¶
func (dme *DistanceMatrixElement) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler for DistanceMatrixElement. This decodes the API representation into types useful for Go developers.
type DistanceMatrixElementsRow ¶
type DistanceMatrixElementsRow struct {
Elements []*DistanceMatrixElement `json:"elements"`
}
DistanceMatrixElementsRow is a row of distance elements.
type DistanceMatrixRequest ¶
type DistanceMatrixRequest struct { // Origins is a list of addresses and/or textual latitude/longitude values from which to calculate distance and time. Required. Origins []string // Destinations is a list of addresses and/or textual latitude/longitude values to which to calculate distance and time. Required. Destinations []string // Mode specifies the mode of transport to use when calculating distance. Valid values are `ModeDriving`, `ModeWalking`, `ModeBicycling` // and `ModeTransit`. Optional. Mode Mode // Language in which to return results. Optional. Language string // Avoid introduces restrictions to the route. Valid values are `AvoidTolls`, `AvoidHighways` and `AvoidFerries`. Optional. Avoid Avoid // Units Specifies the unit system to use when expressing distance as text. Valid values are `UnitsMetric` and `UnitsImperial`. Optional. Units Units // DepartureTime is the desired time of departure. You can specify the time as an integer in seconds since midnight, January 1, 1970 UTC. // Alternatively, you can specify a value of `"now"“. Optional. DepartureTime string // ArrivalTime specifies the desired time of arrival for transit requests, in seconds since midnight, January 1, 1970 UTC. You cannot // specify both `DepartureTime` and `ArrivalTime`. Optional. ArrivalTime string // TrafficModel determines the type of model that will be used when determining travel time when using depature times in the future // options are TrafficModelBestGuess, TrafficModelOptimistic or TrafficModelPessimistic. Optional. Default is TrafficModelBestGuess TrafficModel TrafficModel // TransitMode specifies one or more preferred modes of transit. This parameter may only be specified for requests where the mode is // `transit`. Valid values are `TransitModeBus`, `TransitModeSubway`, `TransitModeTrain`, `TransitModeTram`, and `TransitModeRail`. // Optional. TransitMode []TransitMode // TransitRoutingPreference Specifies preferences for transit requests. Valid values are `TransitRoutingPreferenceLessWalking` and // `TransitRoutingPreferenceFewerTransfers`. Optional. TransitRoutingPreference TransitRoutingPreference }
DistanceMatrixRequest is the request struct for Distance Matrix APi
type DistanceMatrixResponse ¶
type DistanceMatrixResponse struct { // OriginAddresses contains an array of addresses as returned by the API from your original request. OriginAddresses []string `json:"origin_addresses"` // DestinationAddresses contains an array of addresses as returned by the API from your original request. DestinationAddresses []string `json:"destination_addresses"` // Rows contains an array of elements. Rows []DistanceMatrixElementsRow `json:"rows"` }
DistanceMatrixResponse represents a Distance Matrix API response.
type ElevationRequest ¶
type ElevationRequest struct { // Locations defines the location(s) on the earth from which to return elevation data. Locations []LatLng // Path defines a path on the earth for which to return elevation data. Path []LatLng // Samples specifies the number of sample points along a path for which to return elevation data. Required if Path is supplied. Samples int }
ElevationRequest is the request structure for Elevation API. Either Locations or Path must be set.
type ElevationResult ¶
type ElevationResult struct { // Location is the position for which elevation data is being computed. Location *LatLng `json:"location"` // Elevation indicates the elevation of the location in meters Elevation float64 `json:"elevation"` // Resolution indicates the maximum distance between data points from which the elevation was interpolated, in meters Resolution float64 `json:"resolution"` }
ElevationResult is a single elevation at a specific location
type Fare ¶
type Fare struct { // Currency is an ISO 4217 currency code indicating the currency that the amount is expressed in. Currency string `json:"currency"` // Value is the total fare amount, in the currency specified above. Value float64 `json:"value"` // Text is the total fare amount, formatted in the requested language. Text string `json:"text"` }
Fare represents the total fare for a route.
type GeocodeAccuracy ¶
type GeocodeAccuracy string
GeocodeAccuracy is the type of a location result from the Geocoding API.
type GeocodedWaypoint ¶
type GeocodedWaypoint struct { // GeocoderStatus indicates the status code resulting from the geocoding operation. This field may contain the following values. GeocoderStatus string `json:"geocoder_status"` // PartialMatch indicates that the geocoder did not return an exact match for the original request, though it was able to match part of the requested address. PartialMatch bool `json:"partial_match"` // PlaceID is a unique identifier that can be used with other Google APIs. PlaceID string `json:"place_id"` // Types indicates the address type of the geocoding result used for calculating directions. Types []string `json:"types"` }
GeocodedWaypoint represents the geocoded point for origin, supplied waypoints, or destination for a requested direction request.
type GeocodingRequest ¶
type GeocodingRequest struct { // Address is the street address that you want to geocode, in the format used by the national postal service of the country concerned. Address string // Components is a component filter for which you wish to obtain a geocode. Either Address or Components is required in a geocoding request. // For more detail on Component Filtering please see // https://developers.google.com/maps/documentation/geocoding/intro#ComponentFiltering Components map[Component]string // Bounds is the bounding box of the viewport within which to bias geocode results more prominently. Optional. Bounds *LatLngBounds // Region is the region code, specified as a ccTLD two-character value. Optional. Region string // LatLng is the textual latitude/longitude value for which you wish to obtain the closest, human-readable address. Either LatLng or PlaceID is required for Reverse Geocoding. LatLng *LatLng // ResultType is an array of one or more address types. Optional. ResultType []string // LocationType is an array of one or more geocoding accuracy types. Optional. LocationType []GeocodeAccuracy // PlaceID is a string which contains the place_id, which can be used for reverse geocoding requests. Either LatLng or PlaceID is required for Reverse Geocoding. PlaceID string // Language is the language in which to return results. Optional. Language string // Custom allows passing through custom parameters to the Geocoding back end. Use with caution. // For more detail on why this is required, please see // https://googlegeodevelopers.blogspot.com/2016/11/address-geocoding-in-google-maps-apis.html Custom url.Values }
GeocodingRequest is the request structure for Geocoding API
type GeocodingResult ¶
type GeocodingResult struct { AddressComponents []AddressComponent `json:"address_components"` FormattedAddress string `json:"formatted_address"` Geometry AddressGeometry `json:"geometry"` Types []string `json:"types"` PlaceID string `json:"place_id"` }
GeocodingResult is a single geocoded address
type GeolocationError ¶
type GeolocationError struct { // Errors lists errors that occurred Errors []struct { Domain string // Reason is an identifier for the error Reason string // Message is a short description of the error Message string } // Code is the error code (same as HTTP response) Code int // Message is a short description of the error Message string }
GeolocationError is an error object reporting a request error
type GeolocationRequest ¶
type GeolocationRequest struct { // HomeMobileCountryCode is the mobile country code (MCC) for the device's home network. HomeMobileCountryCode int `json:"homeMobileCountryCode,omitempty"` // HomeMobileNetworkCode is the mobile network code (MNC) for the device's home network. HomeMobileNetworkCode int `json:"homeMobileNetworkCode,omitempty"` // RadioType is the mobile radio type, this is optional but should be included if available RadioType RadioType `json:"radioType,omitempty"` // Carrier is the carrier name Carrier string `json:"carrier,omitempty"` // ConsiderIP Specifies whether to fall back to IP geolocation if wifi and cell tower signals are not available. ConsiderIP bool `json:"considerIp"` // CellTowers is an array of CellTower objects. CellTowers []CellTower `json:"cellTowers,omitempty"` // WifiAccessPoints is an array of WifiAccessPoint objects. WiFiAccessPoints []WiFiAccessPoint `json:"wifiAccessPoints,omitempty"` }
GeolocationRequest is the request structure for Geolocation API All fields are optional
type GeolocationResult ¶
type GeolocationResult struct { // Location is the predicted location Location LatLng // Accuracy is the accuracy of the provided location in meters Accuracy float64 }
GeolocationResult is an approximate location and accuracy
type LatLng ¶
LatLng represents a location on the Earth.
func DecodePolyline ¶
DecodePolyline converts a polyline encoded string to an array of LatLng objects.
func ParseLatLng ¶
ParseLatLng will parse a string representation of a Lat,Lng pair.
func ParseLatLngList ¶
ParseLatLngList will parse a string of | separated Lat,Lng pairs.
func (*LatLng) AlmostEqual ¶
AlmostEqual returns whether this LatLng is almost equal (below epsilon) to the other LatLng.
type LatLngBounds ¶
type LatLngBounds struct { NorthEast LatLng `json:"northeast"` SouthWest LatLng `json:"southwest"` }
LatLngBounds represents a bounded square area on the Earth.
func (*LatLngBounds) String ¶
func (b *LatLngBounds) String() string
type Leg ¶
type Leg struct { // Steps contains an array of steps denoting information about each separate step of the // leg of the journey. Steps []*Step `json:"steps"` // Distance indicates the total distance covered by this leg. Distance `json:"distance"` // Duration indicates total time required for this leg. Duration time.Duration `json:"duration"` // DurationInTraffic indicates the total duration of this leg. This value is an estimate of the time in traffic based on current and historical traffic conditions. DurationInTraffic time.Duration `json:"duration_in_traffic"` // ArrivalTime contains the estimated time of arrival for this leg. This property is only // returned for transit directions. ArrivalTime time.Time `json:"arrival_time"` // DepartureTime contains the estimated time of departure for this leg. This property is // only returned for transit directions. DepartureTime time.Time `json:"departure_time"` // StartLocation contains the latitude/longitude coordinates of the origin of this leg. StartLocation LatLng `json:"start_location"` // EndLocation contains the latitude/longitude coordinates of the destination of this leg. EndLocation LatLng `json:"end_location"` // StartAddress contains the human-readable address (typically a street address) // reflecting the start location of this leg. StartAddress string `json:"start_address"` // EndAddress contains the human-readable address (typically a street address) // reflecting the end location of this leg. EndAddress string `json:"end_address"` }
Leg represents a single leg of a route.
func (*Leg) MarshalJSON ¶
MarshalJSON implements json.Marshaler for Leg. This encodes Go types back to the API representation.
func (*Leg) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for Leg. This decodes the API representation into types useful for Go developers.
type MapStyle ¶
type MapStyle struct { }
MapStyle defines a custom style to alter the presentation of a specific feature (roads, parks, and other features) of the map.
type MapType ¶
type MapType string
MapType (optional) defines the type of map to construct. There are several possible maptype values, including roadmap, satellite, hybrid, and terrain
type Marker ¶
type Marker struct { //Color specifies a 24-bit color (example: color=0xFFFFCC) or a predefined color from the set {black, brown, green, purple, yellow, blue, gray, orange, red, white}. Color string //Label specifies a single uppercase alphanumeric character from the set {A-Z, 0-9} Label string //MarkerSize specifies the size of marker from the set {tiny, mid, small} Size string //CustomIcon replace the default Map Pin CustomIcon CustomIcon //Location is the Marker position Location []LatLng }
Marker is a Map pin
type MarkerSize ¶
type MarkerSize string
MarkerSize specifies the size of marker from the set {tiny, mid, small}
type NearbySearchRequest ¶
type NearbySearchRequest struct { // Location is the latitude/longitude around which to retrieve place information. If you specify a location parameter, you must also specify a radius parameter. Location *LatLng // Radius defines the distance (in meters) within which to bias place results. The maximum allowed radius is 50,000 meters. Results inside of this region will be ranked higher than results outside of the search circle; however, prominent results from outside of the search radius may be included. Radius uint // Keyword is a term to be matched against all content that Google has indexed for this place, including but not limited to name, type, and address, as well as customer reviews and other third-party content. Keyword string // Language specifies the language in which to return results. Optional. Language string // MinPrice restricts results to only those places within the specified price level. Valid values are in the range from 0 (most affordable) to 4 (most expensive), inclusive. MinPrice PriceLevel // MaxPrice restricts results to only those places within the specified price level. Valid values are in the range from 0 (most affordable) to 4 (most expensive), inclusive. MaxPrice PriceLevel // Name is one or more terms to be matched against the names of places, separated with a space character. Name string // OpenNow returns only those places that are open for business at the time the query is sent. Places that do not specify opening hours in the Google Places database will not be returned if you include this parameter in your query. OpenNow bool // RankBy specifies the order in which results are listed. RankBy // Type restricts the results to places matching the specified type. Type PlaceType // PageToken returns the next 20 results from a previously run search. Setting a PageToken parameter will execute a search with the same parameters used previously — all parameters other than PageToken will be ignored. PageToken string }
NearbySearchRequest is the functional options struct for NearbySearch
type NearestRoadsRequest ¶
type NearestRoadsRequest struct { // Points is the list of points to be snapped. Points []LatLng }
NearestRoadsRequest is the request structure for the Nearest Roads API.
type NearestRoadsResponse ¶
type NearestRoadsResponse struct {
SnappedPoints []SnappedPoint `json:"snappedPoints"`
}
NearestRoadsResponse is an array of snapped points.
type OpeningHours ¶
type OpeningHours struct { // OpenNow is a boolean value indicating if the place is open at the current time. Please note, this field will be null if it isn't present in the response. OpenNow *bool `json:"open_now,omitempty"` // Periods is an array of opening periods covering seven days, starting from Sunday, in chronological order. Periods []OpeningHoursPeriod `json:"periods,omitempty"` // weekdayText is an array of seven strings representing the formatted opening hours for each day of the week, for example "Monday: 8:30 am – 5:30 pm". WeekdayText []string `json:"weekday_text,omitempty"` // PermanentlyClosed indicates that the place has permanently shut down. Please note, this field will be null if it isn't present in the response. PermanentlyClosed *bool `json:"permanently_closed,omitempty"` }
OpeningHours describes the opening hours for a Place Details result.
type OpeningHoursOpenClose ¶
type OpeningHoursOpenClose struct { // Day is a number from 0–6, corresponding to the days of the week, starting on Sunday. For example, 2 means Tuesday. Day time.Weekday `json:"day"` // Time contains a time of day in 24-hour hhmm format. Values are in the range 0000–2359. The time will be reported in the place’s time zone. Time string `json:"time"` }
OpeningHoursOpenClose describes when the place is open.
type OpeningHoursPeriod ¶
type OpeningHoursPeriod struct { // Open is when the place opens. Open OpeningHoursOpenClose `json:"open"` // Close is when the place closes. Close OpeningHoursOpenClose `json:"close"` }
OpeningHoursPeriod is a single OpeningHours day describing when the place opens and closes.
type Path ¶
type Path struct { //Weight (optional) specifies the thickness of the path in pixels. Weight int //Color (optional) specifies a color in HEX Color string //Fillcolor (optional) indicates both that the path marks off a polygonal area and specifies the fill color to use as an overlay within that area. FillColor string //Geodesic (optional) indicates that the requested path should be interpreted as a geodesic line that follows the curvature of the earth. Geodesic bool //Location two or more connected points to overlay on the image at specified locations Location []LatLng }
Path defines a single path of two or more connected points to overlay on the image at specified locations
type Photo ¶
type Photo struct { // PhotoReference is used to identify the photo when you perform a Photo request. PhotoReference string `json:"photo_reference"` // Height is the maximum height of the image. Height int `json:"height"` // Width is the maximum width of the image. Width int `json:"width"` // htmlAttributions contains any required attributions. HTMLAttributions []string `json:"html_attributions"` }
Photo describes a photo available with a Search Result.
type PlaceAutocompleteRequest ¶
type PlaceAutocompleteRequest struct { // Input is the text string on which to search. The Places service will return candidate matches based on this string and order results based on their perceived relevance. Input string // Offset is the character position in the input term at which the service uses text for predictions. For example, if the input is 'Googl' and the completion point is 3, the service will match on 'Goo'. The offset should generally be set to the position of the text caret. If no offset is supplied, the service will use the entire term. Offset uint // Location is the point around which you wish to retrieve place information. Location *LatLng // Radius is the distance (in meters) within which to return place results. Note that setting a radius biases results to the indicated area, but may not fully restrict results to the specified area. Radius uint // Language is the language in which to return results. Language string // Type restricts the results to places matching the specified type. Types AutocompletePlaceType // Components is a grouping of places to which you would like to restrict your results. Currently, you can use components to filter by country. Components map[Component]string // StrictBounds return only those places that are strictly within the region defined by location and radius. StrictBounds bool }
PlaceAutocompleteRequest is the functional options struct for Place Autocomplete
type PlaceDetailsRequest ¶
type PlaceDetailsRequest struct { // PlaceID is a textual identifier that uniquely identifies a place, returned from a Place Search. PlaceID string // Language is the language code, indicating in which language the results should be returned, if possible. Language string }
PlaceDetailsRequest is the functional options struct for PlaceDetails
type PlaceDetailsResult ¶
type PlaceDetailsResult struct { // AddressComponents is an array of separate address components used to compose a given address. AddressComponents []AddressComponent `json:"address_components,omitempty"` // FormattedAddress is the human-readable address of this place. FormattedAddress string `json:"formatted_address,omitempty"` // AdrAddress is the address in the "adr" microformat. AdrAddress string `json:"adr_address,omitempty"` // FormattedPhoneNumber contains the place's phone number in its local format. For example, the formatted_phone_number for Google's Sydney, Australia office is (02) 9374 4000. FormattedPhoneNumber string `json:"formatted_phone_number,omitempty"` // InternationalPhoneNumber contains the place's phone number in international format. International format includes the country code, and is prefixed with the plus (+) sign. For example, the international_phone_number for Google's Sydney, Australia office is +61 2 9374 4000. InternationalPhoneNumber string `json:"international_phone_number,omitempty"` // Geometry contains geometry information about the result, generally including the location (geocode) of the place and (optionally) the viewport identifying its general area of coverage. Geometry AddressGeometry `json:"geometry,omitempty"` // Name contains the human-readable name for the returned result. For establishment results, this is usually the business name. Name string `json:"name,omitempty"` // Icon contains the URL of a recommended icon which may be displayed to the user when indicating this result. Icon string `json:"icon,omitempty"` // PlaceID is a textual identifier that uniquely identifies a place. PlaceID string `json:"place_id,omitempty"` // Scope indicates the scope of the PlaceID. Scope string `json:"scope,omitempty"` // Rating contains the place's rating, from 1.0 to 5.0, based on aggregated user reviews. Rating float32 `json:"rating,omitempty"` // Types contains an array of feature types describing the given result. Types []string `json:"types,omitempty"` // OpeningHours may contain whether the place is open now or not. OpeningHours *OpeningHours `json:"opening_hours,omitempty"` // Photos is an array of photo objects, each containing a reference to an image. Photos []Photo `json:"photos,omitempty"` // AltIDs — An array of zero, one or more alternative place IDs for the place, with a scope related to each alternative ID. AltIDs []AltID `json:"alt_ids,omitempty"` // PriceLevel is the price level of the place, on a scale of 0 to 4. PriceLevel int `json:"price_level,omitempty"` // Vicinity contains a feature name of a nearby location. Vicinity string `json:"vicinity,omitempty"` // PermanentlyClosed is a boolean flag indicating whether the place has permanently shut down (value true). If the place is not permanently closed, the flag is absent from the response. PermanentlyClosed bool `json:"permanently_closed,omitempty"` // Reviews is an array of up to five reviews. If a language parameter was specified in the Place Details request, the Places Service will bias the results to prefer reviews written in that language. Reviews []PlaceReview `json:"reviews,omitempty"` // UTCOffset contains the number of minutes this place’s current timezone is offset from UTC. For example, for places in Sydney, Australia during daylight saving time this would be 660 (+11 hours from UTC), and for places in California outside of daylight saving time this would be -480 (-8 hours from UTC). UTCOffset int `json:"utc_offset,omitempty"` // Website lists the authoritative website for this place, such as a business' homepage. Website string `json:"website,omitempty"` // URL contains the URL of the official Google page for this place. This will be the establishment's Google+ page if the Google+ page exists, otherwise it will be the Google-owned page that contains the best available information about the place. Applications must link to or embed this page on any screen that shows detailed results about the place to the user. URL string `json:"url,omitempty"` // HTMLAttributions contain a set of attributions about this listing which must be displayed to the user. HTMLAttributions []string `json:"html_attributions,omitempty"` }
PlaceDetailsResult is an individual Places API Place Details result
type PlacePhotoRequest ¶
type PlacePhotoRequest struct { // PhotoReference is a string used to identify the photo when you perform a Photo request. PhotoReference string // MaxHeight is the maximum height of the image. One of MaxHeight and MaxWidth is required. MaxHeight uint // MaxWidth is the maximum width of the image. One of MaxHeight and MaxWidth is required. MaxWidth uint }
PlacePhotoRequest is the functional options struct for Places Photo API
type PlacePhotoResponse ¶
type PlacePhotoResponse struct { // ContentType is the server reported type of the Image. ContentType string // Data is the server returned image data. You must close this after you are finished. Data io.ReadCloser }
PlacePhotoResponse is a response to the Place Photo request
type PlaceReview ¶
type PlaceReview struct { // Aspects contains a collection of AspectRatings, each of which provides a rating of a single attribute of the establishment. The first in the collection is considered the primary aspect. Aspects []PlaceReviewAspect `json:"aspects,omitempty"` // AuthorName the name of the user who submitted the review. Anonymous reviews are attributed to "A Google user". AuthorName string `json:"author_name,omitempty"` // AuthorURL the URL to the user's Google+ profile, if available. AuthorURL string `json:"author_url,omitempty"` // Language an IETF language code indicating the language used in the user's review. This field contains the main language tag only, and not the secondary tag indicating country or region. Language string `json:"language,omitempty"` // Rating the user's overall rating for this place. This is a whole number, ranging from 1 to 5. Rating int `json:"rating,omitempty"` // Text is the user's review. When reviewing a location with Google Places, text reviews are considered optional. Therefore, this field may by empty. Note that this field may include simple HTML markup. Text string `json:"text,omitempty"` // Time the time that the review was submitted, measured in the number of seconds since since midnight, January 1, 1970 UTC. Time int `json:"time,omitempty"` // TODO(samthor): convert this to a real time.Time }
PlaceReview is a review of a Place
type PlaceReviewAspect ¶
type PlaceReviewAspect struct { // Rating is the user's rating for this particular aspect, from 0 to 3. Rating int `json:"rating"` // Type is the name of the aspect that is being rated. The following types are supported: appeal, atmosphere, decor, facilities, food, overall, quality and service. Type string `json:"type,omitempty"` }
PlaceReviewAspect provides a rating of a single attribute of the establishment.
type PlaceType ¶
type PlaceType string
PlaceType restricts Place API search to the results to places matching the specified type.
func ParsePlaceType ¶
ParsePlaceType will parse a string representation of a PlaceType.
type PlacesSearchResponse ¶
type PlacesSearchResponse struct { // Results is the Place results for the search query Results []PlacesSearchResult // HTMLAttributions contain a set of attributions about this listing which must be displayed to the user. HTMLAttributions []string // NextPageToken contains a token that can be used to return up to 20 additional results. NextPageToken string }
PlacesSearchResponse is the response to a Places API Search request.
type PlacesSearchResult ¶
type PlacesSearchResult struct { // FormattedAddress is the human-readable address of this place FormattedAddress string `json:"formatted_address,omitempty"` // Geometry contains geometry information about the result, generally including the location (geocode) of the place and (optionally) the viewport identifying its general area of coverage. Geometry AddressGeometry `json:"geometry,omitempty"` // Name contains the human-readable name for the returned result. For establishment results, this is usually the business name. Name string `json:"name,omitempty"` // Icon contains the URL of a recommended icon which may be displayed to the user when indicating this result. Icon string `json:"icon,omitempty"` // PlaceID is a textual identifier that uniquely identifies a place. PlaceID string `json:"place_id,omitempty"` // Scope indicates the scope of the PlaceID. Scope string `json:"scope,omitempty"` // Rating contains the place's rating, from 1.0 to 5.0, based on aggregated user reviews. Rating float32 `json:"rating,omitempty"` // Types contains an array of feature types describing the given result. Types []string `json:"types,omitempty"` // OpeningHours may contain whether the place is open now or not. OpeningHours *OpeningHours `json:"opening_hours,omitempty"` // Photos is an array of photo objects, each containing a reference to an image. Photos []Photo `json:"photos,omitempty"` // AltIDs — An array of zero, one or more alternative place IDs for the place, with a scope related to each alternative ID. AltIDs []AltID `json:"alt_ids,omitempty"` // PriceLevel is the price level of the place, on a scale of 0 to 4. PriceLevel int `json:"price_level,omitempty"` // Vicinity contains a feature name of a nearby location. Vicinity string `json:"vicinity,omitempty"` // PermanentlyClosed is a boolean flag indicating whether the place has permanently shut down. PermanentlyClosed bool `json:"permanently_closed,omitempty"` }
PlacesSearchResult is an individual Places API search result
type Polyline ¶
type Polyline struct {
Points string `json:"points"`
}
Polyline represents a list of lat,lng points encoded as a byte array. See: https://developers.google.com/maps/documentation/utilities/polylinealgorithm
type QueryAutocompleteRequest ¶
type QueryAutocompleteRequest struct { // Input is the text string on which to search. The Places service will return candidate matches based on this string and order results based on their perceived relevance. Input string // Offset is the character position in the input term at which the service uses text for predictions. For example, if the input is 'Googl' and the completion point is 3, the service will match on 'Goo'. The offset should generally be set to the position of the text caret. If no offset is supplied, the service will use the entire term. Offset uint // Location is the point around which you wish to retrieve place information. Location *LatLng // Radius is the distance (in meters) within which to return place results. Note that setting a radius biases results to the indicated area, but may not fully restrict results to the specified area. Radius uint // Language is the language in which to return results. Language string }
QueryAutocompleteRequest is the functional options struct for Query Autocomplete
type RadarSearchRequest ¶
type RadarSearchRequest struct { // Location is the latitude/longitude around which to retrieve place information. If you specify a location parameter, you must also specify a radius parameter. Location *LatLng // Radius defines the distance (in meters) within which to bias place results. The maximum allowed radius is 50,000 meters. Results inside of this region will be ranked higher than results outside of the search circle; however, prominent results from outside of the search radius may be included. Radius uint // Keyword is a term to be matched against all content that Google has indexed for this place, including but not limited to name, type, and address, as well as customer reviews and other third-party content. Keyword string // MinPrice restricts results to only those places within the specified price level. Valid values are in the range from 0 (most affordable) to 4 (most expensive), inclusive. MinPrice PriceLevel // MaxPrice restricts results to only those places within the specified price level. Valid values are in the range from 0 (most affordable) to 4 (most expensive), inclusive. MaxPrice PriceLevel // Name is one or more terms to be matched against the names of places, separated with a space character. Name string // OpenNow returns only those places that are open for business at the time the query is sent. Places that do not specify opening hours in the Google Places database will not be returned if you include this parameter in your query. OpenNow bool // Type restricts the results to places matching the specified type. Type PlaceType }
RadarSearchRequest is the functional options struct for RadarSearch
type Route ¶
type Route struct { // Summary contains a short textual description for the route, suitable for // naming and disambiguating the route from alternatives. Summary string `json:"summary"` // Legs contains information about a leg of the route, between two locations within the // given route. A separate leg will be present for each waypoint or destination specified. // (A route with no waypoints will contain exactly one leg within the legs array.) Legs []*Leg `json:"legs"` // WaypointOrder contains an array indicating the order of any waypoints in the calculated route. WaypointOrder []int `json:"waypoint_order"` // OverviewPolyline contains an approximate (smoothed) path of the resulting directions. OverviewPolyline Polyline `json:"overview_polyline"` // Bounds contains the viewport bounding box of the overview polyline. Bounds LatLngBounds `json:"bounds"` // Copyrights contains the copyrights text to be displayed for this route. You must handle // and display this information yourself. Copyrights string `json:"copyrights"` // Warnings contains an array of warnings to be displayed when showing these directions. // You must handle and display these warnings yourself. Warnings []string `json:"warnings"` // Fare contains the total fare (that is, the total ticket costs) on this route. This property // is only returned for transit requests and only for routes where fare information is available // for all transit legs. *Fare `json:"fare"` }
Route represents a single route between an origin and a destination.
type SnapToRoadRequest ¶
type SnapToRoadRequest struct { // Path is the path to be snapped. Path []LatLng // Interpolate is whether to interpolate a path to include all points forming the full road-geometry. Interpolate bool }
SnapToRoadRequest is the request structure for the Roads Snap to Road API.
type SnapToRoadResponse ¶
type SnapToRoadResponse struct {
SnappedPoints []SnappedPoint `json:"snappedPoints"`
}
SnapToRoadResponse is an array of snapped points.
type SnappedPoint ¶
type SnappedPoint struct { // Location of the snapped point. Location LatLng `json:"location"` // OriginalIndex is an integer that indicates the corresponding value in the original request. Not present on interpolated points. OriginalIndex *int `json:"originalIndex"` // PlaceID is a unique identifier for a place. PlaceID string `json:"placeId"` }
SnappedPoint is the original path point snapped to a road.
func (*SnappedPoint) MarshalJSON ¶
func (sp *SnappedPoint) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler for SnappedPoint. This encodes Go types back to the API representation.
func (*SnappedPoint) UnmarshalJSON ¶
func (sp *SnappedPoint) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler for SnappedPoint. This decode the API representation into types useful for Go developers.
type SpeedLimit ¶
type SpeedLimit struct { // PlaceID is a unique identifier for a place. PlaceID string `json:"placeId"` // SpeedLimit is the speed limit for that road segment. SpeedLimit float64 `json:"speedLimit"` // Units is either KPH or MPH. Units speedLimitUnit `json:"units"` }
SpeedLimit is the speed limit for a PlaceID
type SpeedLimitsRequest ¶
type SpeedLimitsRequest struct { // Path is the path to be snapped and speed limits requested. Path []LatLng // PlaceID is the PlaceIDs to request speed limits for. PlaceID []string // Units is whether to return speed limits in `SpeedLimitKPH` or `SpeedLimitMPH`. Optional, default behavior is to return results in KPH. Units speedLimitUnit }
SpeedLimitsRequest is the request structure for the Roads Speed Limits API.
type SpeedLimitsResponse ¶
type SpeedLimitsResponse struct { SpeedLimits []SpeedLimit `json:"speedLimits"` SnappedPoints []SnappedPoint `json:"snappedPoints"` }
SpeedLimitsResponse is an array of snapped points and an array of speed limits.
type StaticMapRequest ¶
type StaticMapRequest struct { //Center focus the map at the correct location Center string //Zoom (required if markers not present) defines the zoom level of the map Zoom int //Size (required) defines the rectangular dimensions of the map image. This parameter takes a string of the form {horizontal_value}x{vertical_value} Size string //Scale (optional) affects the number of pixels that are returned. Accepted values are 2 and 4 Scale int //Format format (optional) defines the format of the resulting image. Default: PNG. Accepeted Values: There are several possible formats including GIF, JPEG and PNG types. Format Format //Language (optional) defines the language to use for display of labels on map tiles Language string //Region (optional) defines the appropriate borders to display, based on geo-political sensitivities. Region string //MapType (optional) defines the type of map to construct. MapType MapType //Markers (optional) define one or more markers to attach to the image at specified locations. Markers []Marker //Paths (optional) defines multiple paths of two or more connected points to overlay on the image at specified locations Paths []Path //Visible specifies one or more locations that should remain visible on the map, though no markers or other indicators will be displayed. Visible []LatLng }
StaticMapRequest is the functional options struct for staticMap.Get
type Step ¶
type Step struct { // HTMLInstructions contains formatted instructions for this step, presented as an HTML text string. HTMLInstructions string `json:"html_instructions"` // Distance contains the distance covered by this step until the next step. Distance `json:"distance"` // Duration contains the typical time required to perform the step, until the next step. time.Duration `json:"duration"` // StartLocation contains the location of the starting point of this step, as a single set of lat // and lng fields. StartLocation LatLng `json:"start_location"` // EndLocation contains the location of the last point of this step, as a single set of lat and // lng fields. EndLocation LatLng `json:"end_location"` // Polyline contains a single points object that holds an encoded polyline representation of the // step. This polyline is an approximate (smoothed) path of the step. Polyline `json:"polyline"` // Steps contains detailed directions for walking or driving steps in transit directions. Substeps // are only available when travel_mode is set to "transit". The inner steps array is of the same // type as steps. Steps []*Step `json:"steps"` // TransitDetails contains transit specific information. This field is only returned with travel // mode is set to "transit". TransitDetails *TransitDetails `json:"transit_details"` // TravelMode indicates the travel mode of this step. TravelMode string `json:"travel_mode"` }
Step represents a single step of a leg.
func (*Step) MarshalJSON ¶
MarshalJSON implements json.Marshaler for Step. This encodes Go types back to the API representation.
func (*Step) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for Step. This decodes the API representation into types useful for Go developers.
type TextSearchRequest ¶
type TextSearchRequest struct { // Query is the text string on which to search, for example: "restaurant". The Google Places service will return candidate matches based on this string and order the results based on their perceived relevance. Query string // Location is the latitude/longitude around which to retrieve place information. If you specify a location parameter, you must also specify a radius parameter. Location *LatLng // Radius defines the distance (in meters) within which to bias place results. The maximum allowed radius is 50,000 meters. Results inside of this region will be ranked higher than results outside of the search circle; however, prominent results from outside of the search radius may be included. Radius uint // Language specifies the language in which to return results. Optional. Language string // MinPrice restricts results to only those places within the specified price level. Valid values are in the range from 0 (most affordable) to 4 (most expensive), inclusive. MinPrice PriceLevel // MaxPrice restricts results to only those places within the specified price level. Valid values are in the range from 0 (most affordable) to 4 (most expensive), inclusive. MaxPrice PriceLevel // OpenNow returns only those places that are open for business at the time the query is sent. Places that do not specify opening hours in the Google Places database will not be returned if you include this parameter in your query. OpenNow bool // Type restricts the results to places matching the specified type. Type PlaceType // PageToken returns the next 20 results from a previously run search. Setting a PageToken parameter will execute a search with the same parameters used previously — all parameters other than PageToken will be ignored. PageToken string }
TextSearchRequest is the functional options struct for TextSearch
type TimezoneRequest ¶
type TimezoneRequest struct { // Location represents the location to look up. Location *LatLng // Timestamp specifies the desired time. Time Zone API uses the timestamp to determine whether or not Daylight Savings should be applied. Timestamp time.Time // Language in which to return results. Language string }
TimezoneRequest is the request structure for Timezone API.
type TimezoneResult ¶
type TimezoneResult struct { // DstOffset is the offset for daylight-savings time in seconds. DstOffset int `json:"dstOffset"` // RawOffset is the offset from UTC for the given location. RawOffset int `json:"rawOffset"` // TimeZoneID is a string containing the "tz" ID of the time zone. TimeZoneID string `json:"timeZoneId"` // TimeZoneName is a string containing the long form name of the time zone. TimeZoneName string `json:"timeZoneName"` }
TimezoneResult is a single timezone result.
type TrafficModel ¶
type TrafficModel string
TrafficModel specifies traffic prediction model when requesting future directions.
type TransitAgency ¶
type TransitAgency struct { // Name contains the name of the transit agency Name string `json:"name"` // URL contains the URL for the transit agency URL *url.URL `json:"url"` // Phone contains the phone number of the transit agency Phone string `json:"phone"` }
TransitAgency contains information about the operator of the line
func (*TransitAgency) MarshalJSON ¶
func (transitAgency *TransitAgency) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler for TransitAgency. This encodes Go types back to the API representation.
func (*TransitAgency) UnmarshalJSON ¶
func (transitAgency *TransitAgency) UnmarshalJSON(data []byte) error
UnmarshalJSON imlpements json.Unmarshaler for TransitAgency. This decodes the API representation into types useful for Go developers.
type TransitDetails ¶
type TransitDetails struct { // ArrivalStop contains information about the stop/station for this part of the trip. ArrivalStop TransitStop `json:"arrival_stop"` // DepartureStop contains information about the stop/station for this part of the trip. DepartureStop TransitStop `json:"departure_stop"` // ArrivalTime contains the arrival time for this leg of the journey ArrivalTime time.Time `json:"arrival_time"` // DepartureTime contains the departure time for this leg of the journey DepartureTime time.Time `json:"departure_time"` // Headsign specifies the direction in which to travel on this line, as it is marked on the vehicle or at the departure stop. Headsign string `json:"headsign"` // Headway specifies the expected number of seconds between departures from the same stop at this time Headway time.Duration `json:"headway"` // NumStops contains the number of stops in this step, counting the arrival stop, but not the departure stop NumStops uint `json:"num_stops"` // Line contains information about the transit line used in this step Line TransitLine `json:"line"` }
TransitDetails contains additional information about the transit stop, transit line and transit agency.
func (*TransitDetails) MarshalJSON ¶
func (transitDetails *TransitDetails) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler for TransitDetails. This encodes Go types back to the API representation.
func (*TransitDetails) UnmarshalJSON ¶
func (transitDetails *TransitDetails) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler for TransitDetails. This decodes the API representation into types useful for Go developers.
type TransitLine ¶
type TransitLine struct { // Name contains the full name of this transit line. eg. "7 Avenue Express". Name string `json:"name"` // ShortName contains the short name of this transit line. ShortName string `json:"short_name"` // Color contains the color commonly used in signage for this transit line. Color string `json:"color"` // Agencies contains information about the operator of the line Agencies []*TransitAgency `json:"agencies"` // URL contains the URL for this transit line as provided by the transit agency URL *url.URL `json:"url"` // Icon contains the URL for the icon associated with this line Icon *url.URL `json:"icon"` // TextColor contains the color of text commonly used for signage of this line TextColor string `json:"text_color"` // Vehicle contains the type of vehicle used on this line Vehicle TransitLineVehicle `json:"vehicle"` }
TransitLine contains information about the transit line used in this step
func (*TransitLine) MarshalJSON ¶
func (transitLine *TransitLine) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler for TransitLine. This encodes Go types back to the API representation.
func (*TransitLine) UnmarshalJSON ¶
func (transitLine *TransitLine) UnmarshalJSON(data []byte) error
UnmarshalJSON imlpements json.Unmarshaler for TransitLine. This decodes the API representation into types useful for Go developers.
type TransitLineVehicle ¶
type TransitLineVehicle struct { // Name contains the name of the vehicle on this line Name string `json:"name"` // Type contains the type of vehicle that runs on this line Type string `json:"type"` // Icon contains the URL for an icon associated with this vehicle type Icon *url.URL `json:"icon"` }
TransitLineVehicle contains the type of vehicle used on this line
func (*TransitLineVehicle) MarshalJSON ¶
func (transitLineVehicle *TransitLineVehicle) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler for TransitLineVehicle. This encodes Go types back to the API representation.
func (*TransitLineVehicle) UnmarshalJSON ¶
func (transitLineVehicle *TransitLineVehicle) UnmarshalJSON(data []byte) error
UnmarshalJSON imlpements json.Unmarshaler for TransitLineVehicle. This decodes the API representation into types useful for Go developers.
type TransitMode ¶
type TransitMode string
TransitMode is for specifying a transit mode for a request
type TransitRoutingPreference ¶
type TransitRoutingPreference string
TransitRoutingPreference biases which routes are returned
type TransitStop ¶
type TransitStop struct { // Location of the transit station/stop. Location LatLng `json:"location"` // Name of the transit station/stop. eg. "Union Square". Name string `json:"name"` }
TransitStop contains information about the stop/station for this part of the trip.
type Units ¶
type Units string
Units specifies which units system to return human readable results in.
type WiFiAccessPoint ¶
type WiFiAccessPoint struct { // MacAddress is the MAC address of the WiFi node. Separators must be : (colon). MACAddress string `json:"macAddress,omitempty"` // SignalStrength is the current signal strength measured in dBm. SignalStrength float64 `json:"signalStrength,omitempty"` // Age is the number of milliseconds since this access point was detected. Age uint64 `json:"age,omitempty"` // Channel is the channel over which the client is communicating with the access point. Channel int `json:"channel,omitempty"` // SignalToNoiseRatio is the current signal to noise ratio measured in dB. SignalToNoiseRatio float64 `json:"signalToNoiseRatio,omitempty"` }
WiFiAccessPoint is a WiFi access point object for localisation requests
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
directions/cmdline
Package main contains a simple command line tool for Directions API Directions docs: https://developers.google.com/maps/documentation/directions/
|
Package main contains a simple command line tool for Directions API Directions docs: https://developers.google.com/maps/documentation/directions/ |
distancematrix/cmdline
Package main contains a simple command line tool for DistanceMatrix Directions docs: https://developers.google.com/maps/documentation/distancematrix/
|
Package main contains a simple command line tool for DistanceMatrix Directions docs: https://developers.google.com/maps/documentation/distancematrix/ |
elevation/cmdline
Package main contains a simple command line tool for Elevation API Directions docs: https://developers.google.com/maps/documentation/distancematrix/
|
Package main contains a simple command line tool for Elevation API Directions docs: https://developers.google.com/maps/documentation/distancematrix/ |
geocoding/cmdline
Package main contains a simple command line tool for Geocoding API Documentation: https://developers.google.com/maps/documentation/geocoding/
|
Package main contains a simple command line tool for Geocoding API Documentation: https://developers.google.com/maps/documentation/geocoding/ |
places/nearbysearch
Package main contains a simple command line tool for Places API Text Search Documentation: https://developers.google.com/places/web-service/search#TextSearchRequests
|
Package main contains a simple command line tool for Places API Text Search Documentation: https://developers.google.com/places/web-service/search#TextSearchRequests |
places/photo
Package main contains a simple command line tool for Places Photos API Documentation: https://developers.google.com/places/web-service/photos
|
Package main contains a simple command line tool for Places Photos API Documentation: https://developers.google.com/places/web-service/photos |
places/placeautocomplete
Package main contains a simple command line tool for Places API Query Autocomplete Documentation: https://developers.google.com/places/web-service/query
|
Package main contains a simple command line tool for Places API Query Autocomplete Documentation: https://developers.google.com/places/web-service/query |
places/placedetails
Package main contains a simple command line tool for Places API Text Search Documentation: https://developers.google.com/places/web-service/search#TextSearchRequests
|
Package main contains a simple command line tool for Places API Text Search Documentation: https://developers.google.com/places/web-service/search#TextSearchRequests |
places/queryautocomplete
Package main contains a simple command line tool for Places API Query Autocomplete Documentation: https://developers.google.com/places/web-service/query
|
Package main contains a simple command line tool for Places API Query Autocomplete Documentation: https://developers.google.com/places/web-service/query |
places/radarsearch
Package main contains a simple command line tool for Places API Text Search Documentation: https://developers.google.com/places/web-service/search#TextSearchRequests
|
Package main contains a simple command line tool for Places API Text Search Documentation: https://developers.google.com/places/web-service/search#TextSearchRequests |
places/textsearch
Package main contains a simple command line tool for Places API Text Search Documentation: https://developers.google.com/places/web-service/search#TextSearchRequests
|
Package main contains a simple command line tool for Places API Text Search Documentation: https://developers.google.com/places/web-service/search#TextSearchRequests |
roads/snaptoroad
Package main contains a simple command line tool for Timezone API Directions docs: https://developers.google.com/maps/documentation/timezone/
|
Package main contains a simple command line tool for Timezone API Directions docs: https://developers.google.com/maps/documentation/timezone/ |
roads/speedlimits
Package main contains a simple command line tool for Timezone API Directions docs: https://developers.google.com/maps/documentation/timezone/
|
Package main contains a simple command line tool for Timezone API Directions docs: https://developers.google.com/maps/documentation/timezone/ |
staticmap/cmdline
Package main contains a simple command line tool for Static Maps API Documentation: https://developers.google.com/maps/documentation/static-maps/
|
Package main contains a simple command line tool for Static Maps API Documentation: https://developers.google.com/maps/documentation/static-maps/ |
timezone/cmdline
Package main contains a simple command line tool for Timezone API Directions docs: https://developers.google.com/maps/documentation/timezone/
|
Package main contains a simple command line tool for Timezone API Directions docs: https://developers.google.com/maps/documentation/timezone/ |