Place class
google.maps.places.Place
class
Access by calling const {Place} = await google.maps.importLibrary("places")
. See Libraries in the Maps JavaScript API.
Constructor | |
---|---|
Place |
Place(options) Parameters:
|
Static Methods | |
---|---|
|
findPlaceFromPhoneNumber(request) Parameters:
Searches for a place based on the given phone number. Returns an array due to rare cases where multiple places may share a phone number. |
|
findPlaceFromQuery(request) Parameters:
Searches for a place based on the given text query. Returns an array due to cases where the query is mildly ambiguous, and more than one place gets returned. This method is not intended for searches where multiple results are expected. |
Properties | |
---|---|
addressComponents |
Type:
Array<AddressComponent> optional The collection of address components for this Place’s location. Empty object if there is no known address data. undefined if the address data has not been called for from the server. |
adrFormatAddress |
Type:
string optional The representation of the Place’s address in the adr microformat. |
attributions |
Type:
Array<Attribution> optional Attribution text to be displayed for this Place result. |
businessStatus |
Type:
BusinessStatus optional The location's operational status. null if there is no known status. undefined if the status data has not been loaded from the server. |
displayName |
Type:
string optional The location's display name. null if there is no name. undefined if the name data has not been loaded from the server. |
formattedAddress |
Type:
string optional The locations’s full address. |
googleMapsURI |
Type:
string optional URL of the official Google page for this place. This is the Google-owned page that contains the best available information about the Place. |
hasCurbsidePickup |
Type:
boolean optional Whether a place has curbside pickup. Returns 'true' or 'false' if the value is known. Returns 'null' if the value is unknown. Returns 'undefined' if this field has not yet been requested. |
hasDelivery |
Type:
boolean optional Whether a place has delivery. Returns 'true' or 'false' if the value is known. Returns 'null' if the value is unknown. Returns 'undefined' if this field has not yet been requested. |
hasDineIn |
Type:
boolean optional Whether a place has dine in. Returns 'true' or 'false' if the value is known. Returns 'null' if the value is unknown. Returns 'undefined' if this field has not yet been requested. |
hasTakeout |
Type:
boolean optional Whether a place has takeout. Returns 'true' or 'false' if the value is known. Returns 'null' if the value is unknown. Returns 'undefined' if this field has not yet been requested. |
hasWheelchairAccessibleEntrance |
Type:
boolean optional Whether a place has a wheelchair accessible entrance. Returns 'true' or 'false' if the value is known. Returns 'null' if the value is unknown. Returns 'undefined' if this field has not yet been requested. |
iconBackgroundColor |
Type:
string optional The default HEX color code for the place's category. |
id |
Type:
string The unique place id. |
internationalPhoneNumber |
Type:
string optional The Place’s phone number in international format. International format includes the country code, and is prefixed with the plus (+) sign. |
isReservable |
Type:
boolean optional Whether a place is reservable. Returns 'true' or 'false' if the value is known. Returns 'null' if the value is unknown. Returns 'undefined' if this field has not yet been requested. |
location |
Type:
LatLng optional The Place’s position. |
nationalPhoneNumber |
Type:
string optional The Place’s phone number, formatted according to the number's regional convention. |
openingHours |
Type:
OpeningHours optional |
photos |
Photos of this Place. The collection will contain up to ten Photo objects. |
plusCode |
Type:
PlusCode optional |
priceLevel |
Type:
PriceLevel optional The price level of the Place. This property can return any of the following values
|
rating |
Type:
number optional A rating, between 1.0 to 5.0, based on user reviews of this Place. |
requestedLanguage |
Type:
string optional The requested language for this place. |
requestedRegion |
Type:
string optional The requested region for this place. |
reviews |
A list of reviews for this Place. |
servesBeer |
Type:
boolean optional Whether a place serves beer. Returns 'true' or 'false' if the value is known. Returns 'null' if the value is unknown. Returns 'undefined' if this field has not yet been requested. |
servesBreakfast |
Type:
boolean optional Whether a place serves breakfast. Returns 'true' or 'false' if the value is known. Returns 'null' if the value is unknown. Returns 'undefined' if this field has not yet been requested. |
servesBrunch |
Type:
boolean optional Whether a place serves brunch. Returns 'true' or 'false' if the value is known. Returns 'null' if the value is unknown. Returns 'undefined' if this field has not yet been requested. |
servesDinner |
Type:
boolean optional Whether a place serves dinner. Returns 'true' or 'false' if the value is known. Returns 'null' if the value is unknown. Returns 'undefined' if this field has not yet been requested. |
servesLunch |
Type:
boolean optional Whether a place serves lunch. Returns 'true' or 'false' if the value is known. Returns 'null' if the value is unknown. Returns 'undefined' if this field has not yet been requested. |
servesVegetarianFood |
Type:
boolean optional Whether a place serves vegetarian food. Returns 'true' or 'false' if the value is known. Returns 'null' if the value is unknown. Returns 'undefined' if this field has not yet been requested. |
servesWine |
Type:
boolean optional Whether a place serves wine. Returns 'true' or 'false' if the value is known. Returns 'null' if the value is unknown. Returns 'undefined' if this field has not yet been requested. |
svgIconMaskURI |
Type:
string optional URI to the svg image mask resource that can be used to represent a place’s category. |
types |
Type:
Array<string> optional An array of types for this Place (for example, ["political", "locality"] or ["restaurant", "establishment"] ). |
userRatingCount |
Type:
number optional The number of user ratings which contributed to this Place’s Place.rating . |
utcOffsetMinutes |
Type:
number optional The offset from UTC of the Place’s current timezone, in minutes. For example, Austrialian Eastern Standard Time (GMT+10) in daylight savings is 11 hours ahead of UTC, so the utc_offset_minutes will be 660 . For timezones behind UTC, the offset is negative. For example, the utc_offset_minutes is -60 for Cape Verde. |
viewport |
Type:
LatLngBounds optional The preferred viewport when displaying this Place on a map. |
websiteURI |
Type:
string optional The authoritative website for this Place, such as a business' homepage. |
Methods | |
---|---|
|
fetchFields(options) Parameters:
|
|
getNextOpeningTime([date]) Parameters:
Calculates the Date representing the next OpeningHoursTime. Returns undefined if the data is insufficient to calculate the result, or this place is not operational. |
|
isOpen([date]) Parameters:
Return Value:
Promise<boolean optional> Check if the place is open at the given datetime. Resolves with undefined if the known data for the location is insufficient to calculate this, e.g. if the opening hours are unregistered. |
toJSON |
toJSON() Parameters: None
Return Value:
Object a JSON object with all the requested Place properties. |
PlaceOptions interface
google.maps.places.PlaceOptions
interface
Options for constructing a Place.
Properties | |
---|---|
id |
Type:
string The unique place id. |
requestedLanguage optional |
Type:
string optional A language identifier for the language in which details should be returned. See the list of supported languages. |
requestedRegion optional |
Type:
string optional A region code of the user's region. This can affect which photos may be returned, and possibly other things. The region code accepts a ccTLD ("top-level domain") two-character value. Most ccTLD codes are identical to ISO 3166-1 codes, with some notable exceptions. For example, the United Kingdom's ccTLD is "uk" ( .co.uk ) while its ISO 3166-1 code is "gb" (technically for the entity of "The United Kingdom of Great Britain and Northern Ireland"). |
AddressComponent class
google.maps.places.AddressComponent
class
Access by calling const {AddressComponent} = await google.maps.importLibrary("places")
. See Libraries in the Maps JavaScript API.
Properties | |
---|---|
longText |
Type:
string optional The full text of the address component. |
shortText |
Type:
string optional The abbreviated, short text of the given address component. |
types |
Type:
Array<string> An array of strings denoting the type of this address component. A list of valid types can be found here. |
Attribution class
google.maps.places.Attribution
class
Access by calling const {Attribution} = await google.maps.importLibrary("places")
. See Libraries in the Maps JavaScript API.
Properties | |
---|---|
provider |
Type:
string optional Attribution text to be displayed for this Place result. |
providerURI |
Type:
string optional |
FetchFieldsRequest interface
google.maps.places.FetchFieldsRequest
interface
Options for fetching Place fields.
Properties | |
---|---|
fields |
Type:
Array<string> List of fields to be fetched. |
sessionToken optional |
Type:
AutocompleteSessionToken optional Unique reference used to bundle the details request with an autocomplete session. |
OpeningHours class
google.maps.places.OpeningHours
class
Access by calling const {OpeningHours} = await google.maps.importLibrary("places")
. See Libraries in the Maps JavaScript API.
Properties | |
---|---|
periods |
Type:
Array<OpeningHoursPeriod> Opening periods covering each day of the week, starting from Sunday, in chronological order. Does not include days where the Place is not open. |
weekdayDescriptions |
Type:
Array<string> An array of seven strings representing the formatted opening hours for each day of the week. The Places Service will format and localize the opening hours appropriately for the current language. The ordering of the elements in this array depends on the language. Some languages start the week on Monday, while others start on Sunday. |
OpeningHoursPeriod class
google.maps.places.OpeningHoursPeriod
class
Access by calling const {OpeningHoursPeriod} = await google.maps.importLibrary("places")
. See Libraries in the Maps JavaScript API.
Properties | |
---|---|
close |
Type:
OpeningHoursPoint optional The closing time for the Place. |
open |
Type:
OpeningHoursPoint The opening time for the Place. |
OpeningHoursPoint class
google.maps.places.OpeningHoursPoint
class
Access by calling const {OpeningHoursPoint} = await google.maps.importLibrary("places")
. See Libraries in the Maps JavaScript API.
Properties | |
---|---|
day |
Type:
number The day of the week, as a number in the range [0, 6], starting on Sunday. For example, 2 means Tuesday. |
hour |
Type:
number The hour of the OpeningHoursPoint.time as a number, in the range [0, 23]. This will be reported in the Place’s time zone. |
minute |
Type:
number The minute of the OpeningHoursPoint.time as a number, in the range [0, 59]. This will be reported in the Place’s time zone. |
Photo class
google.maps.places.Photo
class
Access by calling const {Photo} = await google.maps.importLibrary("places")
. See Libraries in the Maps JavaScript API.
Properties | |
---|---|
authorAttributions |
Type:
Array<AuthorAttribution> Attribution text to be displayed for this photo. |
heightPx |
Type:
number The height of the photo in pixels. |
widthPx |
Type:
number The width of the photo in pixels. |
Methods | |
---|---|
getURI |
getURI([options]) Parameters:
Return Value:
string Returns the image URL corresponding to the specified options. |
AuthorAttribution class
google.maps.places.AuthorAttribution
class
Access by calling const {AuthorAttribution} = await google.maps.importLibrary("places")
. See Libraries in the Maps JavaScript API.
Properties | |
---|---|
displayName |
Type:
string Author's name for this result. |
photoURI |
Type:
string optional Author's photo URI for this result. This may not always be available. |
uri |
Type:
string optional Author's profile URI for this result. |
PlusCode class
google.maps.places.PlusCode
class
Access by calling const {PlusCode} = await google.maps.importLibrary("places")
. See Libraries in the Maps JavaScript API.
Properties | |
---|---|
compoundCode |
Type:
string optional A plus code with a 1/8000th of a degree by 1/8000th of a degree area where the first four characters (the area code) are dropped and replaced with a locality description. For example, "9G8F+5W Zurich, Switzerland". |
globalCode |
Type:
string optional A plus code with a 1/8000th of a degree by 1/8000th of a degree area. For example, "8FVC9G8F+5W". |
Review class
google.maps.places.Review
class
Access by calling const {Review} = await google.maps.importLibrary("places")
. See Libraries in the Maps JavaScript API.
Properties | |
---|---|
authorAttribution |
Type:
AuthorAttribution optional The reviewer. |
publishTime |
Type:
Date optional |
rating |
Type:
number optional The rating of this review, a number between 1.0 and 5.0 (inclusive). |
relativePublishTimeDescription |
Type:
string optional A string of formatted recent time, expressing the review time relative to the current time in a form appropriate for the language and country. For example `"a month ago"'. |
text |
Type:
string optional The text of a review. |
textLanguageCode |
Type:
string optional An IETF language code indicating the language in which this review is written. Note that this code includes only the main language tag without any secondary tag indicating country or region. For example, all the English reviews are tagged as 'en' rather than 'en-AU' or 'en-UK'. |
PriceLevel constants
google.maps.places.PriceLevel
constants
Price level enum for Place objects.
Access by calling const {PriceLevel} = await google.maps.importLibrary("places")
. See Libraries in the Maps JavaScript API.
Constants | |
---|---|
EXPENSIVE |
|
FREE |
|
INEXPENSIVE |
|
MODERATE |
|
VERY_EXPENSIVE |