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 AddressMetadata
- type AddressPlusCode
- type AddressValidationAddress
- type AddressValidationAddressComponentConfirmationLevel
- type AddressValidationComponent
- type AddressValidationComponentName
- type AddressValidationGeocode
- type AddressValidationLatLng
- type AddressValidationPlusCode
- type AddressValidationRequest
- type AddressValidationResult
- type AddressValidationViewport
- 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)
- func (c *Client) ValidateAddress(ctx context.Context, r *AddressValidationRequest) (*AddressValidationResult, 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 ErrorResponse
- 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 LanguageOptions
- 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 PostalAddress
- 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 ValidationResult
- type Verdict
- type VerdictGranularity
- type ViaWaypoint
- type WiFiAccessPoint
Constants ¶
const ( // Default value. This value is unused. VerdictGranularityGranularityUnspecified = VerdictGranularity("GRANULARITY_UNSPECIFIED") // Below-building level result, such as an apartment. VerdictGranularitySubPremise = VerdictGranularity("SUB_PREMISE") // Building-level result. VerdictGranularityPremise = VerdictGranularity("PREMISE") // A geocode that should be very close to the building-level location of // the address. VerdictGranularityPremiseProximity = VerdictGranularity("PREMISE_PROXIMITY") // The address or geocode indicates a block. Only used in regions which // have block-level addressing, such as Japan. VerdictGranularityBlock = VerdictGranularity("BLOCK") // The geocode or address is granular to route, such as a street, road, or // highway. VerdictGranularityRoute = VerdictGranularity("ROUTE") // All other granularities, which are bucketed together since they are not // deliverable. VerdictGranularityOther = VerdictGranularity("OTHER") )
const ( // Default value. This value is unused. AddressComponentConfirmationLevelConfirmationLevelUnspecified = AddressValidationAddressComponentConfirmationLevel("CONFIRMATION_LEVEL_UNSPECIFIED") // We were able to verify that this component exists and makes sense in the // context of the rest of the address. AddressComponentConfirmationLevelConfirmed = AddressValidationAddressComponentConfirmationLevel("CONFIRMED") // This component could not be confirmed, but it is plausible that it // exists. For example, a street number within a known valid range of // numbers on a street where specific house numbers are not known. AddressComponentConfirmationLevelUnconfirmedButPlausible = AddressValidationAddressComponentConfirmationLevel("UNCONFIRMED_BUT_PLAUSIBLE") // This component was not confirmed and is likely to be wrong. For // example, a neighborhood that does not fit the rest of the address. AddressComponentConfirmationLevelUnconfirmedAndSuspicous = AddressValidationAddressComponentConfirmationLevel("UNCONFIRMED_AND_SUSPICIOUS") )
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") 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") 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") PlaceTypeRealEstateAgency = PlaceType("real_estate_agency") PlaceTypeRestaurant = PlaceType("restaurant") PlaceTypeRoofingContractor = PlaceType("roofing_contractor") PlaceTypeRvPark = PlaceType("rv_park") PlaceTypeSchool = PlaceType("school") PlaceTypeShoeStore = PlaceType("shoe_store") PlaceTypeShoppingMall = PlaceType("shopping_mall") PlaceTypeSpa = PlaceType("spa") PlaceTypeStadium = PlaceType("stadium") PlaceTypeStorage = PlaceType("storage") PlaceTypeStore = PlaceType("store") PlaceTypeSubwayStation = PlaceType("subway_station") PlaceTypeSupermarket = PlaceType("supermarket") PlaceTypeSynagogue = PlaceType("synagogue") PlaceTypeTaxiStand = PlaceType("taxi_stand") PlaceTypeTrainStation = PlaceType("train_station") PlaceTypeTravelAgency = PlaceType("travel_agency") PlaceTypeUniversity = PlaceType("university") PlaceTypeVeterinaryCare = PlaceType("veterinary_care") PlaceTypeZoo = PlaceType("zoo") )
Place Types for the Places API.
const ( AutocompletePlaceTypeGeocode = AutocompletePlaceType("geocode") AutocompletePlaceTypeAddress = AutocompletePlaceType("address") AutocompletePlaceTypeEstablishment = AutocompletePlaceType("establishment") AutocompletePlaceTypeRegions = AutocompletePlaceType("(regions)") AutocompletePlaceTypeCities = AutocompletePlaceType("(cities)") )
https://developers.google.com/places/web-service/autocomplete#place_types
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 ¶
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 ¶
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 AddressMetadata ¶
type AddressMetadata struct { // Indicates that this is the address of a business. // If unset, indicates that the value is unknown. Business *bool `json:"business,omitempty"` // Indicates that the address of a PO box. // If unset, indicates that the value is unknown. PoBox *bool `json:"poBox,omitempty"` // Indicates that this is the address of a residence. // If unset, indicates that the value is unknown. Residential *bool `json:"residential,omitempty"` }
The metadata for the address. `metadata` is not guaranteed to be fully populated for every address sent to the Address Validation API.
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 AddressValidationAddress ¶
type AddressValidationAddress struct { // The post-processed address, formatted as a single-line address following // the address formatting rules of the region where the address is located. FormattedAddress string `json:"formattedAddress"` // The post-processed address represented as a postal address. PostalAddress *PostalAddress `json:"postalAddress"` // Unordered list. The individual address components of the formatted and // corrected address, along with validation information. This provides // information on the validation status of the individual components. // // Address components are not ordered in a particular way. Do not make any // assumptions on the ordering of the address components in the list. AddressComponents []*AddressValidationComponent `json:"addressComponents"` // The types of components that were expected to be present in a correctly // formatted mailing address but were not found in the input AND could // not be inferred. Components of this type are not present in // `formattedAddress`, `postalAddress`, or `addressComponents`. An // example might be `['streetNumber', 'route']` for an input like // "Boulder, Colorado, 80301, USA". The list of possible types can be found // [here](https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types). MissingComponentTypes []string `json:"missingComponentTypes"` // The types of the components that are present in the `address_components` // but could not be confirmed to be correct. This field is provided for the // sake of convenience: its contents are equivalent to iterating through the // `addressComponents` to find the types of all the components where the // confirmationLevel is not CONFIRMED or the inferred flag is not set to `true`. // The list of possible types can be found // [here](https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types). UnconfirmedComponentTypes []string `json:"unconfirmedComponentTypes"` // Any tokens in the input that could not be resolved. This might be an // input that was not recognized as a valid part of an address (for example // in an input like "123235253253 Main St, San Francisco, CA, 94105", the // unresolved tokens may look like `["123235253253"]` since that does not // look like a valid street number. UnresolvedTokens []string `json:"unresolvedTokens"` }
Details of the post-processed address. Post-processing includes correcting misspelled parts of the address, replacing incorrect parts, and inferring missing parts.
type AddressValidationAddressComponentConfirmationLevel ¶
type AddressValidationAddressComponentConfirmationLevel string
The different possible values for confirmation levels.
type AddressValidationComponent ¶
type AddressValidationComponent struct { // The name for this component. ComponentName *AddressValidationComponentName `json:"componentName"` // The type of the address component. See // [Table 2: Additional types returned by the Places // service](https://developers.google.com/places/web-service/supported_types#table2) // for a list of possible types. ComponentType string `json:"componentType"` // Indicates the level of certainty that we have that the component // is correct. ConfirmationLevel AddressValidationAddressComponentConfirmationLevel `json:"confirmationLevel"` // Indicates that the component was not part of the input, but we // inferred it for the address location and believe it should be provided // for a complete address. Inferred bool `json:"inferred"` // Indicates the spelling of the component name was corrected in a minor way, // for example by switching two characters that appeared in the wrong order. // This indicates a cosmetic change. SpellCorrected bool `json:"spellCorrected"` // Indicates the name of the component was replaced with a completely // different one, for example a wrong postal code being replaced with one that // is correct for the address. This is not a cosmetic change, the input // component has been changed to a different one. Replaced bool `json:"replaced"` // Indicates an address component that is not expected to be present in a // postal address for the given region. We have retained it only because it // was part of the input. Unexpected bool `json:"unexpected"` }
Represents an address component, such as a street, city, or state.
type AddressValidationComponentName ¶
type AddressValidationComponentName struct { // The name text. For example, "5th Avenue" for a street name or "1253" for a // street number. Text string `json:"text"` // The BCP-47 language code. This will not be present if the component name is // not associated with a language, such as a street number. LanguageCode string `json:"languageCode"` }
A wrapper for the name of the component.
type AddressValidationGeocode ¶
type AddressValidationGeocode struct { // The geocoded location of the input. // // Using place IDs is preferred over using addresses, // latitude/longitude coordinates, or plus codes. Using coordinates when // routing or calculating driving directions will always result in the point // being snapped to the road nearest to those coordinates. This may not be a // road that will quickly or safely lead to the destination and may not be // near an access point to the property. Additionally, when a location is // reverse geocoded, there is no guarantee that the returned address will // match the original. Location *AddressValidationLatLng `json:"location"` // The plus code corresponding to the `location`. PlusCode *AddressValidationPlusCode `json:"plusCode"` // The bounds of the geocoded place. Bounds *AddressValidationViewport `json:"bounds"` // The size of the geocoded place, in meters. This is another measure of the // coarseness of the geocoded location, but in physical size rather than in // semantic meaning. FeatureSizeMeters float32 `json:"featureSizeMeters"` // The PlaceID of the place this input geocodes to. // // For more information about Place IDs see // [here](https://developers.google.com/maps/documentation/places/web-service/place-id). PlaceId string `json:"placeId"` // The type(s) of place that the input geocoded to. For example, // `['locality', 'political']`. The full list of types can be found // [here](https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types). PlaceTypes []string `json:"placeTypes"` }
Contains information about the place the input was geocoded to.
type AddressValidationLatLng ¶
type AddressValidationLatLng struct { // The latitude in degrees. It must be in the range [-90.0, +90.0]. Latitude float64 `json:"latitude,omitempty"` // The longitude in degrees. It must be in the range [-180.0, +180.0]. Longitude float64 `json:"longitude,omitempty"` }
An object that represents a latitude/longitude pair. This is expressed as a pair of doubles to represent degrees latitude and degrees longitude. Unless specified otherwise, this must conform to the <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84 standard</a>. Values must be within normalized ranges.
type AddressValidationPlusCode ¶
type AddressValidationPlusCode struct { // Place's global (full) code, such as "9FWM33GV+HQ", representing an // 1/8000 by 1/8000 degree area (~14 by 14 meters). GlobalCode string `json:"globalCode"` // Place's compound code, such as "33GV+HQ, Ramberg, Norway", containing // the suffix of the global code and replacing the prefix with a formatted // name of a reference entity. CompoundCode string `json:"compoundCode"` }
Plus code (http://plus.codes) is a location reference with two formats: global code defining a 14mx14m (1/8000th of a degree) or smaller rectangle, and compound code, replacing the prefix with a reference location.
type AddressValidationRequest ¶
type AddressValidationRequest struct { // Required. The address being validated. Unformatted addresses should be submitted via // addressLines. // The total length of the fields in this input must not exceed 280 characters. // Supported regions can be found [here](https://developers.google.com/maps/documentation/address-validation/coverage). // The languageCode value in the input address is reserved for future uses and is ignored today. The // validated address result will be populated based on the preferred language for the given address, as // identified by the system. // The Address Validation API ignores the values in recipients and organization. Any values in // those fields will be discarded and not returned. Please do not set them. Address *PostalAddress `json:"address,omitempty"` // This field must be empty for the first address validation request. If // more requests are necessary to fully validate a single address (for // example if the changes the user makes after the initial validation need to // be re-validated), then each followup request must populate this field with // the response_id from the very first response in the validation sequence. PreviousResponseId string `json:"previousResponse_id,omitempty"` // Optional. Preview: This feature is in Preview (pre-GA). Pre-GA products and features might have // limited support, and changes to pre-GA products and features might not be compatible With Other // pre-GA versions. Pre-GA Offerings are covered by the Google Maps Platform Service Specific Terms. // For more information, see the launch stage descriptions. // Enables the Address Validation API to include additional information in the response. LanguageOptions LanguageOptions `json:"languageOptions,omitempty"` }
AddressValidationRequest is the request format for the Address Validation API.
type AddressValidationResult ¶
type AddressValidationResult struct { // The result of the address validation. Result *ValidationResult `json:"result"` // The UUID that identifies this response. If the address needs to be re-validated, this UUID must accompany the new request. ResponseId string `json:"responseId"` }
AddressValidationResult is the result format for the Address Validation API.
type AddressValidationViewport ¶
type AddressValidationViewport struct { // Required. The low point of the viewport. Low *AddressValidationLatLng `json:"low,omitempty"` // Required. The high point of the viewport. High *AddressValidationLatLng `json:"high,omitempty"` }
A latitude-longitude viewport, represented as two diagonally opposite `low` and `high` points. A viewport is considered a closed region, i.e. it includes its boundary. The latitude bounds must range between -90 to 90 degrees inclusive, and the longitude bounds must range between -180 to 180 degrees inclusive. Various cases include:
If `low` = `high`, the viewport consists of that single point.
If `low.longitude` > `high.longitude`, the longitude range is inverted (the viewport crosses the 180 degree longitude line).
If `low.longitude` = -180 degrees and `high.longitude` = 180 degrees, the viewport includes all longitudes.
If `low.longitude` = 180 degrees and `high.longitude` = -180 degrees, the longitude range is empty.
If `low.latitude` > `high.latitude`, the latitude range is empty.
Both `low` and `high` must be populated, and the represented box cannot be empty (as specified by the definitions above). An empty viewport will result in an error.
For example, this viewport fully encloses New York City:
{ "low": { "latitude": 40.477398, "longitude": -74.259087 }, "high": { "latitude": 40.91618, "longitude": -73.70018 } }
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
func (*Client) ValidateAddress ¶
func (c *Client) ValidateAddress(ctx context.Context, r *AddressValidationRequest) (*AddressValidationResult, error)
ValidateAddress makes a Address Validation 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 ¶
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 ErrorResponse ¶
type ErrorResponse struct { Err *struct { Code int `json:"code"` Message string `json:"message"` Status string `json:"status"` Details []struct { Type string `json:"@type"` Reason string `json:"reason"` Domain string `json:"domain"` Metadata struct { Service string `json:"service"` } `json:"metadata"` } `json:"details"` } `json:"error"` }
The Error object represents a general error returned by the API.
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
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 LanguageOptions ¶
type LanguageOptions struct { // Preview: Return a Address in English. ReturnEnglishLatinAddress bool `json:"returnEnglishLatinAddress,omitempty"` }
LanguageOptions is the language options for the Address Validation API.
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 ¶
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"` // 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 PostalAddress ¶
type PostalAddress struct { // The schema revision of the `PostalAddress`. This must be set to 0, which is // the latest revision. // // All new revisions **must** be backward compatible with old revisions. Revision int32 `json:"revision,omitempty"` // Optional. CLDR region code of the country/region of the address. See https://cldr.unicode.org/ and // https://www.unicode.org/cldr/charts/30/supplemental/territory_information.html for details. // Example "CH" for Switzerland. If the region code is not provided, it will be inferred from the address. // For best performance, it is recommended to include the region code if you know it. Having // inconsistent or repeated regions can lead to poor performance, for example, if the addressLines // already includes the region, do not provide the region code again in this field. Supported regions can // be found in the FAQ. RegionCode string ` json:"regionCode,omitempty"` // Optional. BCP-47 language code of the contents of this address (if // known). This is often the UI language of the input form or is expected // to match one of the languages used in the address' country/region, or their // transliterated equivalents. // This can affect formatting in certain countries, but is not critical // to the correctness of the data and will never affect any validation or // other non-formatting related operations. // // If this value is not known, it should be omitted (rather than specifying a // possibly incorrect default). // // Examples: "zh-Hant", "ja", "ja-Latn", "en". LanguageCode string ` json:"languageCode,omitempty"` // Optional. Postal code of the address. Not all countries use or require // postal codes to be present, but where they are used, they may trigger // additional validation with other parts of the address (e.g. state/zip // validation in the U.S.A.). PostalCode string ` json:"postalCode,omitempty"` // Optional. Additional, country-specific, sorting code. This is not used // in most regions. Where it is used, the value is either a string like // "CEDEX", optionally followed by a number (e.g. "CEDEX 7"), or just a number // alone, representing the "sector code" (Jamaica), "delivery area indicator" // (Malawi) or "post office indicator" (e.g. Côte d'Ivoire). SortingCode string ` json:"sortingCode,omitempty"` // Optional. Highest administrative subdivision which is used for postal // addresses of a country or region. // For example, this can be a state, a province, an oblast, or a prefecture. // Specifically, for Spain this is the province and not the autonomous // community (e.g. "Barcelona" and not "Catalonia"). // Many countries don't use an administrative area in postal addresses. E.g. // in Switzerland this should be left unpopulated. AdministrativeArea string ` json:"administrativeArea,omitempty"` // Optional. Generally refers to the city/town portion of the address. // Examples: US city, IT comune, UK post town. // In regions of the world where localities are not well defined or do not fit // into this structure well, leave locality empty and use address_lines. Locality string ` json:"locality,omitempty"` // Optional. Sublocality of the address. // For example, this can be neighborhoods, boroughs, districts. Sublocality string ` json:"sublocality,omitempty"` // Unstructured address lines describing the lower levels of an address. // // Because values in address_lines do not have type information and may // sometimes contain multiple values in a single field (e.g. // "Austin, TX"), it is important that the line order is clear. The order of // address lines should be "envelope order" for the country/region of the // address. In places where this can vary (e.g. Japan), address_language is // used to make it explicit (e.g. "ja" for large-to-small ordering and // "ja-Latn" or "en" for small-to-large). This way, the most specific line of // an address can be selected based on the language. // // The minimum permitted structural representation of an address consists // of a region_code with all remaining information placed in the // address_lines. It would be possible to format such an address very // approximately without geocoding, but no semantic reasoning could be // made about any of the address components until it was at least // partially resolved. // // Creating an address only containing a region_code and address_lines, and // then geocoding is the recommended way to handle completely unstructured // addresses (as opposed to guessing which parts of the address should be // localities or administrative areas). AddressLines []string ` json:"addressLines,omitempty"` // Optional. The recipient at the address. // This field may, under certain circumstances, contain multiline information. // For example, it might contain "care of" information. Recipients []string ` json:"recipients,omitempty"` // Optional. The name of the organization at the address. Organization string ` json:"organization,omitempty"` }
Represents a postal address, e.g. for postal delivery or payments addresses. Given a postal address, a postal service can deliver items to a premise, P.O. Box or similar. It is not intended to model geographical locations (roads, towns, mountains).
In typical usage an address would be created via user input or from importing existing data, depending on the type of process.
Advice on address input / editing:
- Use an i18n-ready address widget such as https://github.com/google/libaddressinput)
- Users should not be presented with UI elements for input or editing of fields outside countries where that field is used.
For more guidance on how to use this schema, please see: https://support.google.com/business/answer/6397478
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 ValidationResult ¶
type ValidationResult struct { // Overall verdict flags Verdict *Verdict `json:"verdict"` // Information about the address itself as opposed to the geocode. Address *AddressValidationAddress `json:"address"` // Information about the location and place that the address geocoded to. Geocode *AddressValidationGeocode ` json:"geocode"` // Other information relevant to deliverability. `metadata` is not guaranteed // to be fully populated for every address sent to the Address Validation API. Metadata *AddressMetadata ` json:"metadata"` }
The result of validating an address.
type Verdict ¶
type Verdict struct { // The granularity of the **input** address. This is the result of parsing the // input address and does not give any validation signals. For validation // signals, refer to `validationGranularity` below. // // For example, if the input address includes a specific apartment number, // then the `inputGranularity` here will be `SUB_PREMISE`. If we cannot match // the apartment number in the databases or the apartment number is invalid, // the `validationGranularity` will likely be `PREMISE` or below. InputGranularity VerdictGranularity `json:"inputGranularity"` // The granularity level that the API can fully **validate** the address to. // For example, an `validationGranularity` of `PREMISE` indicates all address // components at the level of `PREMISE` or more coarse can be validated. ValidationGranularity VerdictGranularity `json:"validationGranularity"` // Information about the granularity of the `geocode` // This can be understood as the semantic meaning of how coarse or fine the // geocoded location is. // // This can differ from the `validationGranularity` above occasionally. For // example, our database might record the existence of an apartment number but // do not have a precise location for the apartment within a big apartment // complex. In that case, the `validationGranularity` will be `SUB_PREMISE` // but the `geocodeGranularity` will be `PREMISE`. GeocodeGranularity VerdictGranularity `json:"geocodeGranularity"` // The address is considered complete if there are no unresolved tokens, no // unexpected or missing address components. AddressComplete bool `json:"addressComplete"` // At least one address component cannot be categorized or validated. HasUnconfirmedComponents bool `json:"hasUnconfirmedComponents"` // At least one address component was inferred (added) that wasn't in the input HasInferredComponents bool `json:"hasInferredComponents"` // At least one address component was replaced HasReplacedComponents bool `json:"hasReplacedComponents"` }
High level overview of the address validation result and geocode.
type VerdictGranularity ¶
type VerdictGranularity string
The various granularities that an address or a geocode can have. When used to indicate granularity for an *address*, these values indicate with how fine a granularity the address identifies a mailing destination. For example, an address such as "123 Main Street, Redwood City, CA, 94061" identifies a `PREMISE` while something like "Redwood City, CA, 94061" identifies a `LOCALITY`. However, if we are unable to find a geocode for "123 Main Street" in Redwood City, the geocode returned might be of `LOCALITY` granularity even though the address is more granular.
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
Package main contains a simple command line tool for Directions API Directions docs: https://developers.google.com/maps/documentation/directions/
|
Package main contains a simple command line tool for Directions API Directions docs: https://developers.google.com/maps/documentation/directions/ |
distancematrix/cmdline
Package main contains a simple command line tool for DistanceMatrix Directions docs: https://developers.google.com/maps/documentation/distancematrix/
|
Package main contains a simple command line tool for DistanceMatrix Directions docs: https://developers.google.com/maps/documentation/distancematrix/ |
elevation/cmdline
Package main contains a simple command line tool for Elevation API Directions docs: https://developers.google.com/maps/documentation/distancematrix/
|
Package main contains a simple command line tool for Elevation API Directions docs: https://developers.google.com/maps/documentation/distancematrix/ |
geocoding/cmdline
Package main contains a simple command line tool for Geocoding API Documentation: https://developers.google.com/maps/documentation/geocoding/
|
Package main contains a simple command line tool for Geocoding API Documentation: https://developers.google.com/maps/documentation/geocoding/ |
places/findplacefromtext
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
Package main contains a simple command line tool for Places API Text Search Documentation: https://developers.google.com/places/web-service/search#TextSearchRequests
|
Package main contains a simple command line tool for Places API Text Search Documentation: https://developers.google.com/places/web-service/search#TextSearchRequests |
places/photo
Package main contains a simple command line tool for Places Photos API Documentation: https://developers.google.com/places/web-service/photos
|
Package main contains a simple command line tool for Places Photos API Documentation: https://developers.google.com/places/web-service/photos |
places/placeautocomplete
Package main contains a simple command line tool for Places API Query Autocomplete Documentation: https://developers.google.com/places/web-service/query
|
Package main contains a simple command line tool for Places API Query Autocomplete Documentation: https://developers.google.com/places/web-service/query |
places/placedetails
Package main contains a simple command line tool for Places API Text Search Documentation: https://developers.google.com/places/web-service/search#TextSearchRequests
|
Package main contains a simple command line tool for Places API Text Search Documentation: https://developers.google.com/places/web-service/search#TextSearchRequests |
places/queryautocomplete
Package main contains a simple command line tool for Places API Query Autocomplete Documentation: https://developers.google.com/places/web-service/query
|
Package main contains a simple command line tool for Places API Query Autocomplete Documentation: https://developers.google.com/places/web-service/query |
places/textsearch
Package main contains a simple command line tool for Places API Text Search Documentation: https://developers.google.com/places/web-service/search#TextSearchRequests
|
Package main contains a simple command line tool for Places API Text Search Documentation: https://developers.google.com/places/web-service/search#TextSearchRequests |
roads/snaptoroad
Package main contains a simple command line tool for Timezone API Directions docs: https://developers.google.com/maps/documentation/timezone/
|
Package main contains a simple command line tool for Timezone API Directions docs: https://developers.google.com/maps/documentation/timezone/ |
roads/speedlimits
Package main contains a simple command line tool for Timezone API Directions docs: https://developers.google.com/maps/documentation/timezone/
|
Package main contains a simple command line tool for Timezone API Directions docs: https://developers.google.com/maps/documentation/timezone/ |
staticmap/cmdline
Package main contains a simple command line tool for Static Maps API Documentation: https://developers.google.com/maps/documentation/static-maps/
|
Package main contains a simple command line tool for Static Maps API Documentation: https://developers.google.com/maps/documentation/static-maps/ |
timezone/cmdline
Package main contains a simple command line tool for Timezone API Directions docs: https://developers.google.com/maps/documentation/timezone/
|
Package main contains a simple command line tool for Timezone API Directions docs: https://developers.google.com/maps/documentation/timezone/ |