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
- func ExperienceIdContext(ctx context.Context, experienceIds ...string) context.Context
- func ExperienceIdFromContext(ctx context.Context) []string
- type AddressComponent
- type AddressGeometry
- type AddressPlusCode
- 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) FindPlaceFromText(ctx context.Context, r *FindPlaceFromTextRequest) (FindPlaceFromTextResponse, 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) 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 WithAPIKeyAndSignature(apiKey, signature string) ClientOption
- func WithBaseURL(baseURL string) ClientOption
- func WithChannel(channel string) ClientOption
- func WithClientIDAndSignature(clientID, signature string) ClientOption
- func WithExperienceId(ids ...string) ClientOption
- func WithHTTPClient(c *http.Client) ClientOption
- func WithMetricReporter(reporter metrics.Reporter) 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 FindPlaceFromTextInputType
- type FindPlaceFromTextLocationBiasType
- type FindPlaceFromTextRequest
- type FindPlaceFromTextResponse
- type Format
- type GeocodeAccuracy
- type GeocodedWaypoint
- type GeocodingRequest
- type GeocodingResult
- type GeolocationError
- type GeolocationRequest
- type GeolocationResult
- type LatLng
- type LatLngBounds
- type Leg
- 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 PlaceAutocompleteSessionToken
- type PlaceDetailsFieldMask
- type PlaceDetailsRequest
- type PlaceDetailsResult
- type PlaceEditorialSummary
- type PlacePhotoRequest
- type PlacePhotoResponse
- type PlaceReview
- type PlaceReviewAspect
- type PlaceSearchFieldMask
- type PlaceType
- type PlacesSearchResponse
- type PlacesSearchResult
- type Polyline
- type PriceLevel
- type QueryAutocompleteRequest
- 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 ViaWaypoint
- 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 ( FindPlaceFromTextInputTypeTextQuery = FindPlaceFromTextInputType("textquery") FindPlaceFromTextInputTypePhoneNumber = FindPlaceFromTextInputType("phonenumber") )
The types of FindPlaceFromText Input Types.
const ( FindPlaceFromTextLocationBiasIP = FindPlaceFromTextLocationBiasType("ipbias") FindPlaceFromTextLocationBiasPoint = FindPlaceFromTextLocationBiasType("point") FindPlaceFromTextLocationBiasCircular = FindPlaceFromTextLocationBiasType("circle") FindPlaceFromTextLocationBiasRectangular = FindPlaceFromTextLocationBiasType("rectangle") )
The types of FindPlaceFromTextLocationBiasType
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") PlaceTypeDrugstore = PlaceType("drugstore") PlaceTypeElectrician = PlaceType("electrician") PlaceTypeElectronicsStore = PlaceType("electronics_store") PlaceTypeEmbassy = PlaceType("embassy") PlaceTypeFireStation = PlaceType("fire_station") PlaceTypeFlorist = PlaceType("florist") PlaceTypeFuneralHome = PlaceType("funeral_home") PlaceTypeFurnitureStore = PlaceType("furniture_store") PlaceTypeGasStation = PlaceType("gas_station") PlaceTypeGym = PlaceType("gym") PlaceTypeHairCare = PlaceType("hair_care") PlaceTypeHardwareStore = PlaceType("hardware_store") 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") PlaceTypeLightRailStation = PlaceType("light_rail_station") 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") PlaceTypePlumber = PlaceType("plumber") PlaceTypePolice = PlaceType("police") PlaceTypePostOffice = PlaceType("post_office") PlaceTypePrimarySchool = PlaceType("primary_school") PlaceTypeRealEstateAgency = PlaceType("real_estate_agency") PlaceTypeRestaurant = PlaceType("restaurant") PlaceTypeRoofingContractor = PlaceType("roofing_contractor") PlaceTypeRvPark = PlaceType("rv_park") PlaceTypeSchool = PlaceType("school") PlaceTypeSecondarySchool = PlaceType("secondary_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") PlaceTypeSupermarket = PlaceType("supermarket") PlaceTypeSynagogue = PlaceType("synagogue") PlaceTypeTaxiStand = PlaceType("taxi_stand") PlaceTypeTouristAttraction = PlaceType("tourist_attraction") PlaceTypeTrainStation = PlaceType("train_station") PlaceTypeTransitStation = PlaceType("transit_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
const ( PlaceDetailsFieldMaskAddressComponent = PlaceDetailsFieldMask("address_component") PlaceDetailsFieldMaskADRAddress = PlaceDetailsFieldMask("adr_address") PlaceDetailsFieldMaskBusinessStatus = PlaceDetailsFieldMask("business_status") PlaceDetailsFieldMaskCurbsidePickup = PlaceDetailsFieldMask("curbside_pickup") PlaceDetailsFieldMaskDelivery = PlaceDetailsFieldMask("delivery") PlaceDetailsFieldMaskDineIn = PlaceDetailsFieldMask("dine_in") PlaceDetailsFieldMaskEditorialSummary = PlaceDetailsFieldMask("editorial_summary") PlaceDetailsFieldMaskFormattedAddress = PlaceDetailsFieldMask("formatted_address") PlaceDetailsFieldMaskFormattedPhoneNumber = PlaceDetailsFieldMask("formatted_phone_number") PlaceDetailsFieldMaskGeometry = PlaceDetailsFieldMask("geometry") PlaceDetailsFieldMaskGeometryLocation = PlaceDetailsFieldMask("geometry/location") PlaceDetailsFieldMaskGeometryLocationLat = PlaceDetailsFieldMask("geometry/location/lat") PlaceDetailsFieldMaskGeometryLocationLng = PlaceDetailsFieldMask("geometry/location/lng") PlaceDetailsFieldMaskGeometryViewport = PlaceDetailsFieldMask("geometry/viewport") PlaceDetailsFieldMaskGeometryViewportNortheast = PlaceDetailsFieldMask("geometry/viewport/northeast") PlaceDetailsFieldMaskGeometryViewportNortheastLat = PlaceDetailsFieldMask("geometry/viewport/northeast/lat") PlaceDetailsFieldMaskGeometryViewportNortheastLng = PlaceDetailsFieldMask("geometry/viewport/northeast/lng") PlaceDetailsFieldMaskGeometryViewportSouthwest = PlaceDetailsFieldMask("geometry/viewport/southwest") PlaceDetailsFieldMaskGeometryViewportSouthwestLat = PlaceDetailsFieldMask("geometry/viewport/southwest/lat") PlaceDetailsFieldMaskGeometryViewportSouthwestLng = PlaceDetailsFieldMask("geometry/viewport/southwest/lng") PlaceDetailsFieldMaskIcon = PlaceDetailsFieldMask("icon") PlaceDetailsFieldMaskID = PlaceDetailsFieldMask("id") PlaceDetailsFieldMaskInternationalPhoneNumber = PlaceDetailsFieldMask("international_phone_number") PlaceDetailsFieldMaskName = PlaceDetailsFieldMask("name") PlaceDetailsFieldMaskOpeningHours = PlaceDetailsFieldMask("opening_hours") PlaceDetailsFieldMaskCurrentOpeningHours = PlaceDetailsFieldMask("current_opening_hours") PlaceDetailsFieldMaskSecondaryOpeningHours = PlaceDetailsFieldMask("secondary_opening_hours") PlaceDetailsFieldMaskPermanentlyClosed = PlaceDetailsFieldMask("permanently_closed") PlaceDetailsFieldMaskPhotos = PlaceDetailsFieldMask("photos") PlaceDetailsFieldMaskPlaceID = PlaceDetailsFieldMask("place_id") PlaceDetailsFieldMaskPriceLevel = PlaceDetailsFieldMask("price_level") PlaceDetailsFieldMaskRatings = PlaceDetailsFieldMask("rating") PlaceDetailsFieldMaskUserRatingsTotal = PlaceDetailsFieldMask("user_ratings_total") PlaceDetailsFieldMaskReservable = PlaceDetailsFieldMask("reservable") PlaceDetailsFieldMaskReviews = PlaceDetailsFieldMask("reviews") PlaceDetailsFieldMaskServesBeer = PlaceDetailsFieldMask("serves_beer") PlaceDetailsFieldMaskServesBreakfast = PlaceDetailsFieldMask("serves_breakfast") PlaceDetailsFieldMaskServesBrunch = PlaceDetailsFieldMask("serves_brunch") PlaceDetailsFieldMaskServesDinner = PlaceDetailsFieldMask("serves_dinner") PlaceDetailsFieldMaskServesLunch = PlaceDetailsFieldMask("serves_lunch") PlaceDetailsFieldMaskServesVegetarianFood = PlaceDetailsFieldMask("serves_vegetarian_food") PlaceDetailsFieldMaskServesWine = PlaceDetailsFieldMask("serves_wine") PlaceDetailsFieldMaskTakeout = PlaceDetailsFieldMask("takeout") PlaceDetailsFieldMaskTypes = PlaceDetailsFieldMask("types") PlaceDetailsFieldMaskURL = PlaceDetailsFieldMask("url") PlaceDetailsFieldMaskUTCOffset = PlaceDetailsFieldMask("utc_offset") PlaceDetailsFieldMaskVicinity = PlaceDetailsFieldMask("vicinity") PlaceDetailsFieldMaskWebsite = PlaceDetailsFieldMask("website") PlaceDetailsFieldMaskWheelchairAccessibleEntrance = PlaceDetailsFieldMask("wheelchair_accessible_entrance") )
The individual Place Details Field Masks.
const ( PlaceSearchFieldMaskBusinessStatus = PlaceSearchFieldMask("business_status") PlaceSearchFieldMaskFormattedAddress = PlaceSearchFieldMask("formatted_address") PlaceSearchFieldMaskGeometry = PlaceSearchFieldMask("geometry") PlaceSearchFieldMaskGeometryLocation = PlaceSearchFieldMask("geometry/location") PlaceSearchFieldMaskGeometryLocationLat = PlaceSearchFieldMask("geometry/location/lat") PlaceSearchFieldMaskGeometryLocationLng = PlaceSearchFieldMask("geometry/location/lng") PlaceSearchFieldMaskGeometryViewport = PlaceSearchFieldMask("geometry/viewport") PlaceSearchFieldMaskGeometryViewportNortheast = PlaceSearchFieldMask("geometry/viewport/northeast") PlaceSearchFieldMaskGeometryViewportNortheastLat = PlaceSearchFieldMask("geometry/viewport/northeast/lat") PlaceSearchFieldMaskGeometryViewportNortheastLng = PlaceSearchFieldMask("geometry/viewport/northeast/lng") PlaceSearchFieldMaskGeometryViewportSouthwest = PlaceSearchFieldMask("geometry/viewport/southwest") PlaceSearchFieldMaskGeometryViewportSouthwestLat = PlaceSearchFieldMask("geometry/viewport/southwest/lat") PlaceSearchFieldMaskGeometryViewportSouthwestLng = PlaceSearchFieldMask("geometry/viewport/southwest/lng") PlaceSearchFieldMaskIcon = PlaceSearchFieldMask("icon") PlaceSearchFieldMaskID = PlaceSearchFieldMask("id") PlaceSearchFieldMaskName = PlaceSearchFieldMask("name") PlaceSearchFieldMaskOpeningHours = PlaceSearchFieldMask("opening_hours") PlaceSearchFieldMaskOpeningHoursOpenNow = PlaceSearchFieldMask("opening_hours/open_now") PlaceSearchFieldMaskPermanentlyClosed = PlaceSearchFieldMask("permanently_closed") PlaceSearchFieldMaskPhotos = PlaceSearchFieldMask("photos") PlaceSearchFieldMaskPlaceID = PlaceSearchFieldMask("place_id") PlaceSearchFieldMaskPriceLevel = PlaceSearchFieldMask("price_level") PlaceSearchFieldMaskRating = PlaceSearchFieldMask("rating") PlaceSearchFieldMaskUserRatingsTotal = PlaceSearchFieldMask("user_ratings_total") PlaceSearchFieldMaskReference = PlaceSearchFieldMask("reference") PlaceSearchFieldMaskTypes = PlaceSearchFieldMask("types") PlaceSearchFieldMaskVicinity = PlaceSearchFieldMask("vicinity") )
The individual Place Search Field Masks.
const (
ExperienceIdHeaderName = "X-GOOG-MAPS-EXPERIENCE-ID"
)
Variables ¶
This section is empty.
Functions ¶
func ExperienceIdContext ¶ added in v1.3.0
ExperienceIdContext injects the experienceIds in the context, from where they will be pull out in the post/get handlers. Useful if a customer uses one client instance per different experiences calls
func ExperienceIdFromContext ¶ added in v1.3.0
ExperienceIdFromContext returns experienceIds from context if presented
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 AddressPlusCode ¶
type AddressPlusCode struct {
// GlobalCode is a 4 character area code and 6 character or longer local code (849VCWC8+R9).
GlobalCode string `json:"global_code"`
// CompoundCode is a 6 character or longer local code with an explicit location (CWC8+R9, Mountain View, CA, USA).
CompoundCode string `json:"compound_code"`
}
AddressPlusCode (see https://en.wikipedia.org/wiki/Open_Location_Code and https://plus.codes/) is an encoded location reference, derived from latitude and longitude coordinates, that represents an area: 1/8000th of a degree by 1/8000th of a degree (about 14m x 14m at the equator) or smaller.
Plus codes can be used as a replacement for street addresses in places where they do not exist (where buildings are not numbered or streets are not named). The plus code is formatted as a global code and a compound code: Typically, both the global code and compound code are returned. However, if the result is in a remote location (for example, an ocean or desert) only the global code may be returned.
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)
ParseAutocompletePlaceType will parse a string representation of a AutocompletePlaceTypes.
type AutocompletePrediction ¶
type AutocompletePrediction struct {
// Description of the matched prediction.
Description string `json:"description,omitempty"`
// DistanceMeters is the straight-line distance from the prediction to the
// Origin if Origin was passed in the Query
DistanceMeters int `json:"distance_meters,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) FindPlaceFromText ¶
func (c *Client) FindPlaceFromText(ctx context.Context, r *FindPlaceFromTextRequest) (FindPlaceFromTextResponse, error)
FindPlaceFromText takes a text input, and returns a place. The text input can be any kind of Places data, for example, a name, address, or phone number.
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) 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 WithAPIKeyAndSignature ¶
func WithAPIKeyAndSignature(apiKey, signature string) ClientOption
WithAPIKeyAndSignature configures a Maps API client with an API Key and signature. The signature is assumed to be URL modified Base64 encoded.
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 WithExperienceId ¶
func WithExperienceId(ids ...string) ClientOption
WithExperienceId configures the client with an initial experience id that can be changed with the `setExperienceId` method.
func WithHTTPClient ¶
func WithHTTPClient(c *http.Client) ClientOption
WithHTTPClient configures a Maps API client with a http.Client to make requests over.
func WithMetricReporter ¶ added in v1.2.0
func WithMetricReporter(reporter metrics.Reporter) ClientOption
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
// Scale is the custom icon scale
Scale int
}
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 FindPlaceFromTextInputType ¶
type FindPlaceFromTextInputType string
FindPlaceFromTextInputType is the different types of inputs.
type FindPlaceFromTextLocationBiasType ¶
type FindPlaceFromTextLocationBiasType string
FindPlaceFromTextLocationBiasType is the type of location bias for this request
func ParseFindPlaceFromTextLocationBiasType ¶
func ParseFindPlaceFromTextLocationBiasType(locationBias string) (FindPlaceFromTextLocationBiasType, error)
ParseFindPlaceFromTextLocationBiasType will parse a string to a FindPlaceFromTextLocationBiasType
type FindPlaceFromTextRequest ¶
type FindPlaceFromTextRequest struct {
// The text input specifying which place to search for (for example, a name,
// address, or phone number). Required.
Input string
// The type of input. Required.
InputType FindPlaceFromTextInputType
// Fields allows you to select which parts of the returned details structure
// should be filled in.
Fields []PlaceSearchFieldMask
// Language specifies the language in which to return results. Optional.
Language string
// LocationBias is the type of location bias to apply to this request
LocationBias FindPlaceFromTextLocationBiasType
// LocationBiasPoint is the point for LocationBias type Point
LocationBiasPoint *LatLng
// LocationBiasCenter is the center for LocationBias type Circle
LocationBiasCenter *LatLng
// LocationBiasRadius is the radius for LocationBias type Circle
LocationBiasRadius int
// LocationBiasSouthWest is the South West boundary for LocationBias type Rectangle
LocationBiasSouthWest *LatLng
// LocationBiasSouthWest is the North East boundary for LocationBias type Rectangle
LocationBiasNorthEast *LatLng
}
FindPlaceFromTextRequest is the options struct for Find Place From Text API
type FindPlaceFromTextResponse ¶
type FindPlaceFromTextResponse struct {
Candidates []PlacesSearchResult
HTMLAttributions []string
}
FindPlaceFromTextResponse is a response to the Find Place From Text request
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"`
// 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.
// You may wish to examine the original request for misspellings and/or an incomplete address.
// Partial matches most often occur for street addresses that do not exist within the
// locality you pass in the request.
// Partial matches may also be returned when a request matches two or more locations in
// the same locality. For example, "21 Henr St, Bristol, UK" will return a partial match
// for both Henry Street and Henrietta Street.
// Note that if a request includes a misspelled address component, the geocoding service may
// suggest an alternative address.
// Suggestions triggered in this way will also be marked as a partial match.
PartialMatch bool `json:"partial_match"`
// PlusCode (see https://en.wikipedia.org/wiki/Open_Location_Code and https://plus.codes/)
// is an encoded location reference, derived from latitude and longitude coordinates,
// that represents an area: 1/8000th of a degree by 1/8000th of a degree (about 14m x 14m at the equator)
// or smaller.
//
// Plus codes can be used as a replacement for street addresses in places where they do not exist
// (where buildings are not numbered or streets are not named).
// The plus code is formatted as a global code and a compound code:
// Typically, both the global code and compound code are returned.
// However, if the result is in a remote location (for example, an ocean or desert)
// only the global code may be returned.
PlusCode AddressPlusCode `json:"plus_code"`
}
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"`
// ViaWaypoint contains info about points through which the route was laid.
ViaWaypoint []*ViaWaypoint `json:"via_waypoint"`
}
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 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
// LocationAddress is the Marker position as a postal address or other geocodable location.
LocationAddress string
}
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
// Origin is the point from which to calculate the straight-line distance to the
// destination (returned as distance_meters).
Origin *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
// SessionToken is a token that means you will get charged by autocomplete session
// instead of by character for Autocomplete
SessionToken PlaceAutocompleteSessionToken
}
PlaceAutocompleteRequest is the functional options struct for Place Autocomplete
type PlaceAutocompleteSessionToken ¶
PlaceAutocompleteSessionToken is a session token for Place Autocomplete.
func NewPlaceAutocompleteSessionToken ¶
func NewPlaceAutocompleteSessionToken() PlaceAutocompleteSessionToken
NewPlaceAutocompleteSessionToken constructs a new Place Autocomplete session token.
type PlaceDetailsFieldMask ¶
type PlaceDetailsFieldMask string
PlaceDetailsFieldMask allows you to specify which fields are to be returned with a place details request. Please see the following URL for more detail: https://developers.google.com/maps/documentation/places/web-service/details#fields
func ParsePlaceDetailsFieldMask ¶
func ParsePlaceDetailsFieldMask(placeDetailsFieldMask string) (PlaceDetailsFieldMask, error)
ParsePlaceDetailsFieldMask will parse a string representation of PlaceDetailsFieldMask.
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
// Fields allows you to select which parts of the returned details structure
// should be filled in. For more detail, please see the following URL:
// https://developers.google.com/maps/documentation/places/web-service/details#fields
Fields []PlaceDetailsFieldMask
// SessionToken is a token that marks this request as part of a Place Autocomplete
// Session. Optional.
SessionToken PlaceAutocompleteSessionToken
// Region is the region code, specified as a ccTLD (country code top-level domain)
// two-character value. Most ccTLD codes are identical to ISO 3166-1 codes, with
// some exceptions. This parameter will only influence, not fully restrict, results.
Region string
// ReviewsNoTranslations specifies whether to translate reviews. Specify
// ReviewsNoTranslations=true to disable translation of reviews; specify
// ReviewsNoTranslations=false to enable translation of reviews. Reviews
// are returned in their original language.
//
// If omitted, or passed with no value, translation of reviews is enabled. If
// the language parameter was specified in the request, use the specified
// language as the preferred language for translation. If language is
// omitted, the API attempts to use the Accept-Language header as the
// preferred language.
ReviewsNoTranslations bool
// ReviewsSort specifies the sorting method to use when returning reviews.
// Can be set to most_relevant (default) or newest.
//
//For most_relevant (default), reviews are sorted by relevance; the service
// will bias the results to return reviews originally written in the
// preferred language.
// For newest, reviews are sorted in chronological order; the preferred
// language does not affect the sort order.
// Google recommends that you display how the reviews are being sorted to the
// end user.
ReviewsSort 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"`
// BusinessStatus is a string indicating the operational status of the
// place, if it is a business.
BusinessStatus string `json:"business_status,omitempty"`
// CurbsidePickup specifies if the business supports curbside pickup.
CurbsidePickup bool `json:"curbside_pickup,omitempty"`
// Delivery specifies if the business supports delivery.
Delivery bool `json:"delivery,omitempty"`
// DineIn specifies if the business supports seating options.
DineIn bool `json:"dine_in,omitempty"`
// EditorialSummary contains a summary of the place. A summary is comprised
// of a textual overview, and also includes the language code for these if
// applicable. Summary text must be presented as-is and can not be modified
// or altered.
EditorialSummary *PlaceEditorialSummary `json:"editorial_summary,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"`
// Icon contains the URL of a recommended icon which may be displayed to the user
// when indicating this result.
Icon string `json:"icon,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"`
// OpeningHours may contain whether the place is open now or not.
OpeningHours *OpeningHours `json:"opening_hours,omitempty"`
// CurrentOpeningHours may contain the hours of operation for the next seven
// days (including today). The time period starts at midnight on the date of
// the request and ends at 11:59 pm six days later. This field includes the
// special_days subfield of all hours, set for dates that have exceptional
// hours.
CurrentOpeningHours *OpeningHours `json:"current_opening_hours,omitempty"`
// SecondaryOpeningHours may contain an array of entries for the next seven
// days including information about secondary hours of a business. Secondary
// hours are different from a business's main hours. For example, a
// restaurant can specify drive through hours or delivery hours as its
// secondary hours. This field populates the type subfield, which draws from
// a predefined list of opening hours types (such as DRIVE_THROUGH, PICKUP,
// or TAKEOUT) based on the types of the place. This field includes the
// special_days subfield of all hours, set for dates that have exceptional
// hours.
SecondaryOpeningHours []OpeningHours `json:"secondary_opening_hours,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.
//
// Deprecated: Use BusinessStatus instead.
PermanentlyClosed bool `json:"permanently_closed,omitempty"`
// Photos is an array of photo objects, each containing a reference to an image.
Photos []Photo `json:"photos,omitempty"`
// PlaceID is a textual identifier that uniquely identifies a place.
PlaceID string `json:"place_id,omitempty"`
// PriceLevel is the price level of the place, on a scale of 0 to 4.
PriceLevel int `json:"price_level,omitempty"`
// Rating contains the place's rating, from 1.0 to 5.0, based on aggregated user
// reviews.
Rating float32 `json:"rating,omitempty"`
// Reservable specifies if the place supports reservations.
Reservable bool `json:"reservable,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"`
// ServesBeer specifies if the place serves beer.
ServesBeer bool `json:"serves_beer,omitempty"`
// ServesBreakfast specifies if the place serves breakfast.
ServesBreakfast bool `json:"serves_breakfast,omitempty"`
// ServesBrunch specifies if the place serves brunch.
ServesBrunch bool `json:"serves_brunch,omitempty"`
// ServesDinner specifies if the place serves dinner.
ServesDinner bool `json:"serves_dinner,omitempty"`
// ServesLunch specifies if the place serves lunch.
ServesLunch bool `json:"serves_lunch,omitempty"`
// ServesVegetarianFood specifies if the place serves vegetarian food.
ServesVegetarianFood bool `json:"serves_vegetarian_food,omitempty"`
// ServesWine specifies if the place serves wine.
ServesWine bool `json:"serves_wine,omitempty"`
// Takeout specifies if the business supports takeout.
Takeout bool `json:"takeout,omitempty"`
// Types contains an array of feature types describing the given result.
Types []string `json:"types,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"`
// UserRatingsTotal contains total number of the place's ratings
UserRatingsTotal int `json:"user_ratings_total,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"`
// Vicinity contains a feature name of a nearby location.
Vicinity string `json:"vicinity,omitempty"`
// Website lists the authoritative website for this place, such as a business'
// homepage.
Website string `json:"website,omitempty"`
// WheelchairAccessibleEntrance specifies if the place has an entrance that
// is wheelchair-accessible.
WheelchairAccessibleEntrance bool `json:"wheelchair_accessible_entrance,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 PlaceEditorialSummary ¶ added in v1.4.0
type PlaceEditorialSummary struct {
// Language is the language of the previous fields. May not always be present.
Language string `json:"language,omitempty"`
// Overview is a medium-length textual summary of the place.
Overview string `json:"overview,omitempty"`
}
PlaceEditorialSummary contains a summary of the place. A summary is comprised of a textual overview, and also includes the language code for these if applicable. Summary text must be presented as-is and can not be modified or altered.
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"`
// AuthorPhoto the Google+ profile photo url of the user who submitted the review, if available.
AuthorProfilePhoto string `json:"profile_photo_url"`
// 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"`
// RelativeTimeDescription the time that the review was submitted in text, relative
// to the current time.
RelativeTimeDescription string `json:"relative_time_description,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 PlaceSearchFieldMask ¶
type PlaceSearchFieldMask string
PlaceSearchFieldMask allows you to specify which fields are to be returned with a place search request. Please see the following URL for more detail: https://cloud.google.com/maps-platform/user-guide/product-changes/#places
func ParsePlaceSearchFieldMask ¶
func ParsePlaceSearchFieldMask(placeSearchFieldMask string) (PlaceSearchFieldMask, error)
ParsePlaceSearchFieldMask will parse a string representation of PlaceSearchFieldMask.
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"`
// Rating contains the place's rating, from 1.0 to 5.0, based on aggregated user
// reviews.
Rating float32 `json:"rating,omitempty"`
// UserRatingsTotal contains total number of the place's ratings
UserRatingsTotal int `json:"user_ratings_total,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"`
// 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"`
// BusinessStatus is a string indicating the operational status of the
// place, if it is a business.
BusinessStatus string `json:"business_status,omitempty"`
// ID is an identifier.
ID string `json:"id,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 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.
// Accepted 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
// MapId (optional) defines the identifier for a specific map.
MapId string
// 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
// MapStyles (optional) contains map styles.
MapStyles []string
}
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
// The region code, specified as a ccTLD (country code top-level domain) two-character
// value. Most ccTLD codes are identical to ISO 3166-1 codes, with some exceptions.
// This parameter will only influence, not fully restrict, search results. If more
// relevant results exist outside of the specified region, they may be included. When
// this parameter is used, the country name is omitted from the resulting formatted_address
// for results in the specified region.
Region 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"`
// TripShortName contains additional information for this part of the
// trip.
TripShortName string `json:"trip_short_name"`
}
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 ViaWaypoint ¶
type ViaWaypoint struct {
Location LatLng `json:"location"`
StepIndex int `json:"step_index"`
StepInterpolation float64 `json:"step_interpolation"`
}
ViaWaypoint handles waypoints.
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
command
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
command
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
command
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
command
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/findplacefromtext
command
Package main contains a simple command line tool for Find Place From Text API
|
Package main contains a simple command line tool for Find Place From Text API |
|
places/nearbysearch
command
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
command
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
command
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
command
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
command
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/textsearch
command
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
command
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
command
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
command
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
command
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/ |