Documentation
¶
Overview ¶
Package places has been deprecated. Please use the official client: https://github.com/googlemaps/google-maps-services-go
Index ¶
- func IsInvalidRequest(err error) bool
- func IsNotFound(err error) bool
- func IsOverQueryLimit(err error) bool
- func IsRequestDenied(err error) bool
- func IsUnknown(err error) bool
- func IsZeroResults(err error) bool
- type AddressComponent
- type AltID
- type AspectRating
- type DayTime
- type DetailsCall
- type DetailsResponse
- type FeatureType
- type Geometry
- type LatLng
- type NearbyCall
- type OpeningHours
- type Period
- type Photo
- type PlaceDetails
- type PriceLevel
- type RadarSearchCall
- type RankBy
- type Review
- type SearchResponse
- type Service
- type TextSearchCall
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsInvalidRequest ¶
IsInvalidRequest returns true if the error indicates that the request is invalid. Generally this means that the query (reference) is missing.
func IsNotFound ¶
IsNotFound returns true if the error indicates that the referenced location was not found in the Places database.
func IsOverQueryLimit ¶
IsOverQueryLimit returns true if the error indicates that you are over your quota.
func IsRequestDenied ¶
IsRequestDenied returns true if the error indicates that your request was denied, generally because of lack of an invalid key parameter.
func IsUnknown ¶
IsUnknown returns true if the error indicates a server-side error and trying again may be successful.
func IsZeroResults ¶
IsZeroResults returns true if the error indicates that the search was successful but returned no results. This may occur if the search was passed a latlng in a remote location.
Types ¶
type AddressComponent ¶
type AddressComponent struct { // An array indicating the type of the address component. Types []string `json:"types"` // The full text description or name of the address component. LongName string `json:"long_name"` // An abbreviated textual name for the address component, if available. For example, an address component for the state of Alaska may have a long_name of "Alaska" and a short_name of "AK" using the 2-letter postal abbreviation. ShortName string `json:"short_name"` }
An AddressComponent is a component used to compose a given address
type AltID ¶
type AltID struct { // The most likely reason for a place to have an alternative place ID is if your application adds a place and receives an application-scoped place ID, then later receives a Google-scoped place ID after passing the moderation process. PlaceID string `json:"place_id"` // The scope of an alternative place ID will always be APP, indicating that the alternative place ID is recognised by your application only. Scope string `json:"scope"` }
AltID is an alternative place ID for a place, with a scope related to each alternative ID.
type AspectRating ¶
type AspectRating struct { // 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"` // The user's rating for this particular aspect, from 0 to 3. Rating int `json:"rating"` }
AspectRating provides a rating of a single attribute of an establishment
type DayTime ¶
type DayTime struct { // A number from 0–6, corresponding to the days of the week, starting on Sunday. For example, 2 means Tuesday. Day int `json:"day"` // May contain 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"` }
DayTime is used in Period to specify opening and closing times.
type DetailsCall ¶
type DetailsCall struct { Extensions string Language string // contains filtered or unexported fields }
func (*DetailsCall) Do ¶
func (d *DetailsCall) Do() (*DetailsResponse, error)
type DetailsResponse ¶
type DetailsResponse struct { Result PlaceDetails `json:"result"` Status string `json:"status"` ErrorMessage string `json:"error_message"` HTMLAttributions []string `json:"html_attributions"` }
type FeatureType ¶
type FeatureType string
FeatureType is a feature type describing a place.
const ( Accounting FeatureType = "accounting" Airport FeatureType = "airport" AmusementPark FeatureType = "amusement_park" Aquarium FeatureType = "aquarium" ArtGallery FeatureType = "art_gallery" Atm FeatureType = "atm" Bakery FeatureType = "bakery" Bank FeatureType = "bank" Bar FeatureType = "bar" BeautySalon FeatureType = "beauty_salon" BicycleStore FeatureType = "bicycle_store" BookStore FeatureType = "book_store" BowlingAlley FeatureType = "bowling_alley" BusStation FeatureType = "bus_station" Cafe FeatureType = "cafe" Campground FeatureType = "campground" CarDealer FeatureType = "car_dealer" CarRental FeatureType = "car_rental" CarRepair FeatureType = "car_repair" CarWash FeatureType = "car_wash" Casino FeatureType = "casino" Cemetery FeatureType = "cemetery" Church FeatureType = "church" CityHall FeatureType = "city_hall" ClothingStore FeatureType = "clothing_store" ConvenienceStore FeatureType = "convenience_store" Courthouse FeatureType = "courthouse" Dentist FeatureType = "dentist" DepartmentStore FeatureType = "department_store" Doctor FeatureType = "doctor" Electrician FeatureType = "electrician" ElectronicsStore FeatureType = "electronics_store" Embassy FeatureType = "embassy" FireStation FeatureType = "fire_station" Florist FeatureType = "florist" FuneralHome FeatureType = "funeral_home" FurnitureStore FeatureType = "furniture_store" GasStation FeatureType = "gas_station" GroceryOrSupermarket FeatureType = "grocery_or_supermarket" Gym FeatureType = "gym" HairCare FeatureType = "hair_care" HardwareStore FeatureType = "hardware_store" HinduTemple FeatureType = "hindu_temple" HomeGoodsStore FeatureType = "home_goods_store" Hospital FeatureType = "hospital" InsuranceAgency FeatureType = "insurance_agency" JewelryStore FeatureType = "jewelry_store" Laundry FeatureType = "laundry" Lawyer FeatureType = "lawyer" Library FeatureType = "library" LiquorStore FeatureType = "liquor_store" LocalGovernmentOffice FeatureType = "local_government_office" Locksmith FeatureType = "locksmith" Lodging FeatureType = "lodging" MealDelivery FeatureType = "meal_delivery" MealTakeaway FeatureType = "meal_takeaway" Mosque FeatureType = "mosque" MovieRental FeatureType = "movie_rental" MovieTheater FeatureType = "movie_theater" MovingCompany FeatureType = "moving_company" Museum FeatureType = "museum" NightClub FeatureType = "night_club" Painter FeatureType = "painter" Park FeatureType = "park" Parking FeatureType = "parking" PetStore FeatureType = "pet_store" Pharmacy FeatureType = "pharmacy" Physiotherapist FeatureType = "physiotherapist" Plumber FeatureType = "plumber" Police FeatureType = "police" PostOffice FeatureType = "post_office" RealEstateAgency FeatureType = "real_estate_agency" Restaurant FeatureType = "restaurant" RoofingContractor FeatureType = "roofing_contractor" RvPark FeatureType = "rv_park" School FeatureType = "school" ShoeStore FeatureType = "shoe_store" ShoppingMall FeatureType = "shopping_mall" Spa FeatureType = "spa" Stadium FeatureType = "stadium" Storage FeatureType = "storage" Store FeatureType = "store" SubwayStation FeatureType = "subway_station" Synagogue FeatureType = "synagogue" TaxiStand FeatureType = "taxi_stand" TrainStation FeatureType = "train_station" TravelAgency FeatureType = "travel_agency" University FeatureType = "university" VeterinaryCare FeatureType = "veterinary_care" Zoo FeatureType = "zoo" )
You can use the following values in the types filter for place searches and when adding a place.
type Geometry ¶
type Geometry struct {
Location LatLng `json:"location"`
}
Geometry contains a place's location
type NearbyCall ¶
type NearbyCall struct { // 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 // The language code, indicating in which language the results should be returned, if possible. Language string // Restricts results to only those places within the specified price level. MinPrice, MaxPrice *PriceLevel // One or more terms to be matched against the names of places, separated with a space character. Results will be restricted to those containing the passed name values. Note that a place may have additional names associated with it, beyond its listed name. The API will try to match the passed name value against all of these names. As a result, places may be returned in the results whose listed names do not match the search term, but whose associated names do. Name string // 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 // Defines the distance (in meters) within which to return place results. The maximum allowed radius is 50 000 meters. Note that radius must not be included if rankby=distance is specified. Radius float64 // Specifies the order in which results are listed RankBy RankBy // Restricts the results to places matching the specified type. Only one type may be specified (if more than one type is provided, all types following the first entry are ignored). Type FeatureType // Restricts the search to locations that are Zagat selected businesses. ZagatSelected bool // 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 // contains filtered or unexported fields }
func (*NearbyCall) Do ¶
func (n *NearbyCall) Do() (*SearchResponse, error)
type OpeningHours ¶
type OpeningHours struct { // A boolean value indicating if the place is open at the current time. OpenNow bool `json:"open_now"` // An array of opening periods covering seven days, starting from Sunday, in chronological order. Periods []Period `json:"periods"` }
OpeningHours describes when a place is open.
type Period ¶
type Period struct { // A pair of day and time objects describing when the place opens Open DayTime `json:"open"` // May contain a pair of day and time objects describing when the place closes. Close DayTime `json:"close,omitempty"` // An array of seven strings representing the formatted opening hours for each day of the week. If a language parameter was specified in the Place Details request, the Places Service will format and localize the opening hours appropriately for that language. The ordering of the elements in this array depends on the language parameter. Some languages start the week on Monday while others start on Sunday. WeekdayText []string `json:"weekday_text"` }
Period describes a time period when the place is open.
Note: If a place is always open, the close section will be missing from the response. Clients can rely on always-open being represented as an open period containing day with value 0 and time with value 0000, and no close.
type Photo ¶
type Photo struct { // A string used to identify the photo when you perform a Photo request. PhotoReference string `json:"photo_reference"` // The maximum height of the image. Height int `json:"height"` // The maximum width of the image. Width int `json:"width"` // Contains any required attributions. This field will always be present, but may be empty. HTMLAttributions []string `json:"html_attributions"` }
Photo contains related photographic content to a place
type PlaceDetails ¶
type PlaceDetails struct { // An array of separate address components used to compose a given address AddressComponents []AddressComponent `json:"address_components"` // A string containing the human-readable address of this place. Often this address is equivalent to the "postal address," which sometimes differs from country to country. FormattedAddress string `json:"formatted_address"` // The place's phone number in its local format. FormattedPhoneNumber string `json:"formatted_phone_number"` // Geometry contains a place's location Geometry Geometry `json:"geometry"` // The URL of a suggested icon which may be displayed to the user when indicating this result on a map Icon string `json:"icon"` // The place's phone number in international format InternationalPhoneNumber string `json:"international_phone_number"` // Contains the human-readable name for the returned result. For establishment results, this is usually the canonicalized business name. Name string `json:"name"` // Contains information about when the place is open. OpeningHours OpeningHours `json:"opening_hours"` // A boolean flag indicating whether the place has permanently shut down (value true). PermanentlyClosed bool `json:"permenantly_closed"` // An array of photo objects, each containing a reference to an image. A Place Details request may return up to ten photos. Photos []Photo `json:"photos"` // A textual identifier that uniquely identifies a place. PlaceID string `json:"place_id"` // Indicates the scope of the place_id Scope string `json:"scope"` // An array of zero, one or more alternative place IDs for the place, with a scope related to each alternative ID. AltIDs []AltID `json:"alt_ids"` // The price level of the place, on a scale of 0 to 4. The exact amount indicated by a specific value will vary from region to region. PriceLevel *PriceLevel `json:"price_level"` // The place's rating, from 1.0 to 5.0, based on aggregated user reviews. Rating float64 `json:"rating"` // 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 []*Review `json:"reviews"` // An array of feature types describing the given result. Types []FeatureType `json:"types"` // 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"` // The number of minutes this place’s current timezone is offset from UTC. UTCOffset int `json:"utc_offset"` // A simplified address for the place, including the street name, street number, and locality, but not the province/state, postal code, or country. Vicinity string `json:"vicinity"` // The authoritative website for this place, such as a business' homepage. Website string `json:"website"` // Contains a single AspectRating object, for the primary rating of that establishment. (Only available to Google Places API for Work customers.) Aspects []AspectRating `json:"aspects"` // Indicates that the place has been selected as a Zagat quality location. The Zagat label identifies places known for their consistently high quality or that have a special or unique character. (Only available to Google Places API for Work customers.) ZagatSelected bool `json:"zagat_selected"` }
PlaceDetails is the information returned by a place details request
type PriceLevel ¶
type PriceLevel int
PriceLevel is the price level of a place, on a scale of 0 to 4.
const ( Free PriceLevel = 0 Inexpensive PriceLevel = 1 Moderate PriceLevel = 2 Expensive PriceLevel = 3 VeryExpensive PriceLevel = 4 )
The exact amount indicated by a specific PriceLevel value will vary from region to region.
type RadarSearchCall ¶
type RadarSearchCall struct { // 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 // Restricts results to only those places within the specified price level. MinPrice, MaxPrice *PriceLevel // 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 // Restricts the results to places matching the specified type. Only one type may be specified (if more than one type is provided, all types following the first entry are ignored). Type FeatureType // Restricts the search to locations that are Zagat selected businesses. ZagatSelected bool // 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 // contains filtered or unexported fields }
func (*RadarSearchCall) Do ¶
func (r *RadarSearchCall) Do() (*SearchResponse, error)
type RankBy ¶
type RankBy string
RankBy specifies the order in which results are listed.
const ( // RankByDefault is an alias for RankByProminence RankByDefault RankBy = "" // RankByProminence sorts results based on their importance. Ranking will favor prominent places within the specified area. Prominence can be affected by a place's ranking in Google's index, global popularity, and other factors. RankByProminence RankBy = "prominence" // RankByDistance sorts results in ascending order by their distance from the specified location. RankByDistance RankBy = "distance" )
type Review ¶
type Review struct { // Contains a collection of AspectRating objects, each of which provides a rating of a single attribute of the establishment. The first object in the collection is considered the primary aspect. Aspects []AspectRating `json:"aspects"` // The name of the user who submitted the review. Anonymous reviews are attributed to "A Google user". AuthorName string `json:"author_name"` // The URL to the users Google+ profile, if available. AuthorURL string `json:"author_url"` // 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. For example, all the English reviews are tagged as 'en', and not 'en-AU' or 'en-UK' and so on. Language string `json:"language"` // The user's overall rating for this place. This is a whole number, ranging from 1 to 5. Rating int `json:"rating"` // 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. For example, the entity reference & may represent an ampersand character. Text string `json:"text"` // The time that the review was submitted, measured in the number of seconds since since midnight, January 1, 1970 UTC. Time int `json:"time"` }
Review written about a place
type SearchResponse ¶
type SearchResponse struct { // A list of results matching the query Results []PlaceDetails `json:"results"` // Contains debugging information to help you track down why the request failed Status string `json:"status"` // More detailed information about the reasons behind the given status code. ErrorMessage string `json:"error_message,omitempty"` // A set of attributions about this listing which must be displayed to the user. HTMLAttributions []string `json:"html_attributions"` // A token that can be used to return up to 20 additional results. A next_page_token will not be returned if there are no additional results to display. The maximum number of results that can be returned is 60. There is a short delay between when a next_page_token is issued, and when it will become valid. NextPageToken string `json:"next_page_token"` }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
NewService creates a new places service with the given http client and Google Plus Places API key
func (*Service) Details ¶
func (p *Service) Details(placeid string) *DetailsCall
Details returns more comprehensive information about the indicated place such as its complete address, phone number, user rating and reviews.
func (*Service) Nearby ¶
func (p *Service) Nearby(lat, lng float64) *NearbyCall
Nearby 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 (*Service) RadarSearch ¶
func (p *Service) RadarSearch(radius, lat, lng float64) *RadarSearchCall
RadarSearch returns results from up to 200 places, but with less detail than is typically returned from a Text Search or Nearby Search request.
func (*Service) TextSearch ¶
func (p *Service) TextSearch(query string) *TextSearchCall
TextSearch returns information about a set of places based on a string.
type TextSearchCall ¶
type TextSearchCall struct { // The language code, indicating in which language the results should be returned, if possible. Language string // Restricts results to only those places within the specified price level. MinPrice, MaxPrice *PriceLevel // 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 // Defines the distance (in meters) within which to return place results. The maximum allowed radius is 50 000 meters. Note that radius must not be included if rankby=distance is specified. Radius float64 // Restricts the results to places matching the specified type. Only one type may be specified (if more than one type is provided, all types following the first entry are ignored). Type FeatureType // Restricts the search to locations that are Zagat selected businesses. ZagatSelected bool // 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 // contains filtered or unexported fields }
TextSearchCall represents a call to the Text Search API.
func (*TextSearchCall) Do ¶
func (t *TextSearchCall) Do() (*SearchResponse, error)
Do performs the TextSearchCall request.