Places Service Stay organized with collections Save and categorize content based on your preferences.
PlacesServiceclass
google.maps.places.PlacesServiceclass
Deprecated: As of March 1st, 2025, google.maps.places.PlacesService is not available to new customers. Please usePlace instead. At this time, google.maps.places.PlacesService is not scheduled to be discontinued, butPlace is recommended over google.maps.places.PlacesService. While google.maps.places.PlacesService will continue to receive bug fixes for any major regressions, existing bugs in google.maps.places.PlacesService will not be addressed. At least 12 months notice will be given before support is discontinued. Please seehttps://developers.google.com/maps/legacy for additional details andhttps://developers.google.com/maps/documentation/javascript/places-migration-overview for the migration guide.
Contains methods related to searching for places and retrieving details about a place.
Access by callingconst {PlacesService} = await google.maps.importLibrary("places").
SeeLibraries in the Maps JavaScript API.
Constructor | |
|---|---|
PlacesService | PlacesService(attrContainer)Parameters:
Creates a new instance of the PlacesService that renders attributions in the specified container. |
Methods | |
|---|---|
findPlaceFromPhoneNumber | findPlaceFromPhoneNumber(request, callback)Parameters:
Return Value: None Retrieves a list of places based on a phone number. In most cases there should be just one item in the result list, however if the request is ambiguous more than one result may be returned. The PlaceResults passed to the callback are subsets of a fullPlaceResult. Your app can get a more detailedPlaceResult for each place by callingPlacesService.getDetails and passing thePlaceResult.place_id for the desired place. |
findPlaceFromQuery | findPlaceFromQuery(request, callback)Parameters:
Return Value: None Retrieves a list of places based on a query string. In most cases there should be just one item in the result list, however if the request is ambiguous more than one result may be returned. The PlaceResults passed to the callback are subsets of a fullPlaceResult. Your app can get a more detailedPlaceResult for each place by callingPlacesService.getDetails and passing thePlaceResult.place_id for the desired place. |
getDetails | getDetails(request, callback)Parameters:
Return Value: None Retrieves details about the place identified by the given placeId. |
nearbySearch | nearbySearch(request, callback)Parameters:
Return Value: None Retrieves a list of places near a particular location, based on keyword or type. Location must always be specified, either by passing a LatLngBounds, orlocation andradius parameters. ThePlaceResults passed to the callback are subsets of the fullPlaceResult. Your app can get a more detailedPlaceResult for each place by sending aPlace Details request passing thePlaceResult.place_id for the desired place. ThePlaceSearchPagination object can be used to fetch additional pages of results (null if this is the last page of results or if there is only one page of results). |
textSearch | textSearch(request, callback)Parameters:
Return Value: None Retrieves a list of places based on a query string (for example, "pizza in New York", or "shoe stores near Ottawa"). Location parameters are optional; when the location is specified, results are only biased toward nearby results rather than restricted to places inside the area. Use textSearch when you want to search for places using an arbitrary string, and in cases where you may not want to restrict search results to a particular location. ThePlaceSearchPagination object can be used to fetch additional pages of results (null if this is the last page of results or if there is only one page of results). |
PlaceDetailsRequestinterface
google.maps.places.PlaceDetailsRequestinterface
A Place details query to be sent to thePlacesService.
Properties | |
|---|---|
placeId | Type: stringThe Place ID of the Place for which details are being requested. |
fieldsoptional | Type: Array<string>optionalFields to be included in the details response,which will be billed for. If no fields are specified or ['ALL'] is passed in, all available fields will be returned and billed for (this is not recommended for production deployments). For a list of fields seePlaceResult. Nested fields can be specified with dot-paths (for example,"geometry.location"). |
languageoptional | Type: stringoptionalA language identifier for the language in which details should be returned. See thelist of supported languages. |
regionoptional | Type: stringoptionalA region code of the user's region. This can affect which photos may be returned, and possibly other things. The region code accepts accTLD ("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"). |
sessionTokenoptional | Type: AutocompleteSessionTokenoptionalUnique reference used to bundle the details request with an autocomplete session. |
FindPlaceFromPhoneNumberRequestinterface
google.maps.places.FindPlaceFromPhoneNumberRequestinterface
A find place from text search request to be sent toPlacesService.findPlaceFromPhoneNumber.
Properties | |
|---|---|
fields | Type: Array<string>Fields to be included in the response,which will be billed for. If ['ALL'] is passed in, all available fields will be returned and billed for (this is not recommended for production deployments). For a list of fields seePlaceResult. Nested fields can be specified with dot-paths (for example,"geometry.location"). |
phoneNumber | Type: stringThe phone number of the place to look up. Format must beE.164. |
languageoptional | Type: stringoptionalA language identifier for the language in which names and addresses should be returned, when possible. See thelist of supported languages. |
locationBiasoptional | Type: LocationBiasoptionalThe bias used when searching for Place. The result will be biased towards, but not restricted to, the given LocationBias. |
FindPlaceFromQueryRequestinterface
google.maps.places.FindPlaceFromQueryRequestinterface
A find place from text search request to be sent toPlacesService.findPlaceFromQuery.
Properties | |
|---|---|
fields | Type: Array<string>Fields to be included in the response,which will be billed for. If ['ALL'] is passed in, all available fields will be returned and billed for (this is not recommended for production deployments). For a list of fields seePlaceResult. Nested fields can be specified with dot-paths (for example,"geometry.location"). |
query | Type: stringThe request's query. For example, the name or address of a place. |
languageoptional | Type: stringoptionalA language identifier for the language in which names and addresses should be returned, when possible. See thelist of supported languages. |
locationBiasoptional | Type: LocationBiasoptionalThe bias used when searching for Place. The result will be biased towards, but not restricted to, the given LocationBias. |
PlaceSearchRequestinterface
google.maps.places.PlaceSearchRequestinterface
A Place search query to be sent to thePlacesService.
Properties | |
|---|---|
boundsoptional | Type: LatLngBounds|LatLngBoundsLiteraloptionalThe bounds within which to search for Places. Both location andradius will be ignored ifbounds is set. |
keywordoptional | Type: stringoptionalA term to be matched against all available fields, including but not limited to name, type, and address, as well as customer reviews and other third-party content. |
languageoptional | Type: stringoptionalA language identifier for the language in which names and addresses should be returned, when possible. See thelist of supported languages. |
locationoptional | Type: LatLng|LatLngLiteraloptionalThe location around which to search for Places. |
maxPriceLeveloptional | Type: numberoptionalRestricts results to only those places at the specified price level or lower. Valid values are in the range from 0 (most affordable) to 4 (most expensive), inclusive. Must be greater than or equal to minPrice, if specified. |
minPriceLeveloptional | Type: numberoptionalRestricts results to only those places at the specified price level or higher. Valid values are in the range from 0 (most affordable) to 4 (most expensive), inclusive. Must be less than or equal to maxPrice, if specified. |
| Deprecated: Use Type: stringoptionalEquivalent to keyword. Values in this field are combined with values in thekeyword field and passed as part of the same search string. |
openNowoptional | Type: booleanoptionalRestricts results to only those places that are open right now. |
radiusoptional | Type: numberoptionalThe distance from the given location within which to search for Places, in meters. The maximum allowed value is 50 000. |
rankByoptional | Type: RankByoptionalDefault: RankBy.PROMINENCESpecifies the ranking method to use when returning results. Note that when rankBy is set toDISTANCE, you must specify alocation but you cannot specify aradius orbounds. |
typeoptional | Type: stringoptionalSearches for places of the given type. The type is translated to the local language of the request's target location and used as a query string. If a query is also provided, it is concatenated to the localized type string. Results of a different type are dropped from the response. Use this field to perform language and region independent categorical searches. Valid types are givenhere. |
TextSearchRequestinterface
google.maps.places.TextSearchRequestinterface
A text search request to be sent to thePlacesService.
Properties | |
|---|---|
boundsoptional | Type: LatLngBounds|LatLngBoundsLiteraloptionalBounds used to bias results when searching for Places (optional). Both location andradius will be ignored ifbounds is set. Results will not be restricted to those inside these bounds; but, results inside it will rank higher. |
languageoptional | Type: stringoptionalA language identifier for the language in which names and addresses should be returned, when possible. See thelist of supported languages. |
locationoptional | Type: LatLng|LatLngLiteraloptionalThe center of the area used to bias results when searching for Places. |
queryoptional | Type: stringoptionalThe request's query term. For example, the name of a place ('Eiffel Tower'), a category followed by the name of a location ('pizza in New York'), or the name of a place followed by a location disambiguator ('Starbucks in Sydney'). |
radiusoptional | Type: numberoptionalThe radius of the area used to bias results when searching for Places, in meters. |
regionoptional | Type: stringoptionalA region code to bias results towards. The region code accepts accTLD ("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"). |
typeoptional | Type: stringoptionalSearches for places of the given type. The type is translated to the local language of the request's target location and used as a query string. If a query is also provided, it is concatenated to the localized type string. Results of a different type are dropped from the response. Use this field to perform language and region independent categorical searches. Valid types are givenhere. |
RankByconstants
google.maps.places.RankByconstants
Ranking options for a PlaceSearchRequest.
Access by callingconst {RankBy} = await google.maps.importLibrary("places").
SeeLibraries in the Maps JavaScript API.
Constants | |
|---|---|
DISTANCE | Ranks place results by distance from the location. |
PROMINENCE | Ranks place results by their prominence. |
LocationBiastypedef
google.maps.places.LocationBiastypedef
A LocationBias represents a soft boundary or hint to use when searching for Places. Results may come from outside the specified area. To use the current user's IP address as a bias, the string"IP_BIAS" can be specified. Note: if using aCircle the center and radius must be defined.
LatLng|LatLngLiteral|LatLngAltitude|LatLngAltitudeLiteral|LatLngBounds|LatLngBoundsLiteral|Circle|CircleLiteral|string
LocationRestrictiontypedef
google.maps.places.LocationRestrictiontypedef
A LocationRestriction represents a strict boundary to use when searching for Places.
PlacesServiceStatusconstants
google.maps.places.PlacesServiceStatusconstants
The status returned by thePlacesService on the completion of its searches. Specify these by value, or by using the constant's name. For example,'OK' orgoogle.maps.places.PlacesServiceStatus.OK.
Access by callingconst {PlacesServiceStatus} = await google.maps.importLibrary("places").
SeeLibraries in the Maps JavaScript API.
Constants | |
|---|---|
INVALID_REQUEST | This request was invalid. |
NOT_FOUND | The place referenced was not found. |
OK | The response contains a valid result. |
OVER_QUERY_LIMIT | The application has gone over its request quota. |
REQUEST_DENIED | The application is not allowed to use thePlacesService. |
UNKNOWN_ERROR | ThePlacesService request could not be processed due to a server error. The request may succeed if you try again. |
ZERO_RESULTS | No result was found for this request. |
PlaceSearchPaginationinterface
google.maps.places.PlaceSearchPaginationinterface
An object used to fetch additional pages of Places results.
Properties | |
|---|---|
hasNextPage | Type: booleanIndicates if further results are available. true when there is an additional results page. |
Methods | |
|---|---|
nextPage | nextPage()Parameters: None Return Value: voidFetches the next page of results. Uses the same callback function that was provided to the first search request. |
PlaceResultinterface
google.maps.places.PlaceResultinterface
Defines information about a Place.
Properties | |
|---|---|
address_componentsoptional | Type: Array<GeocoderAddressComponent>optionalThe collection of address components for this Place’s location. Only available with PlacesService.getDetails. |
adr_addressoptional | Type: stringoptionalThe representation of the Place’s address in theadr microformat. Only available with PlacesService.getDetails. |
aspectsoptional | Type: Array<PlaceAspectRating>optionalThe rated aspects of this Place, based on Google and Zagat user reviews. The ratings are on a scale of 0 to 30. |
business_statusoptional | Type: BusinessStatusoptionalA flag indicating the operational status of the Place, if it is a business (indicates whether the place is operational, or closed either temporarily or permanently). If no data is available, the flag is not present in search or details responses. |
formatted_addressoptional | Type: stringoptionalThe Place’s full address. |
formatted_phone_numberoptional | Type: stringoptionalThe Place’s phone number, formatted according to the number's regional convention. Only available with PlacesService.getDetails. |
geometryoptional | Type: PlaceGeometryoptionalThe Place’s geometry-related information. |
html_attributionsoptional | Type: Array<string>optionalAttribution text to be displayed for this Place result. Available html_attributions are always returned regardless of whatfields have been requested, and must be displayed. |
iconoptional | Type: stringoptionalURL to an image resource that can be used to represent this Place’s category. |
icon_background_coloroptional | Type: stringoptionalBackground color for use with a Place's icon. See also PlaceResult.icon_mask_base_uri. |
icon_mask_base_urioptional | Type: stringoptionalA truncated URL to an icon mask. Access different icon types by appending a file extension to the end (i.e. .svg or.png). |
international_phone_numberoptional | Type: stringoptionalThe Place’s phone number in international format. International format includes the country code, and is prefixed with the plus (+) sign. Only available with PlacesService.getDetails. |
nameoptional | Type: stringoptionalThe Place’s name. Note: In the case of user entered Places, this is the raw text, as typed by the user. Please exercise caution when using this data, as malicious users may try to use it as a vector for code injection attacks (See http://en.wikipedia.org/wiki/Code_injection). |
opening_hoursoptional | Type: PlaceOpeningHoursoptionalDefines when the Place opens or closes. |
| Deprecated: Type: booleanoptionalA flag indicating whether the Place is closed, either permanently or temporarily. If the place is operational, or if no data is available, the flag is absent from the response. |
photosoptional | Type: Array<PlacePhoto>optionalPhotos of this Place. The collection will contain up to ten PlacePhoto objects. |
place_idoptional | Type: stringoptionalA unique identifier for the Place. |
plus_codeoptional | Type: PlacePlusCodeoptionalDefines Open Location Codes or "plus codes" for the Place. |
price_leveloptional | Type: numberoptionalThe price level of the Place, on a scale of 0 to 4. Price levels are interpreted as follows:
|
ratingoptional | Type: numberoptionalA rating, between 1.0 to 5.0, based on user reviews of this Place. |
reviewsoptional | Type: Array<PlaceReview>optionalA list of reviews of this Place. Only available with PlacesService.getDetails. |
typesoptional | Type: Array<string>optionalAn array of types for this Place (for example, ["political", "locality"] or["restaurant", "establishment"]). |
urloptional | Type: stringoptionalURL of the official Google page for this place. This is the Google-owned page that contains the best available information about the Place. Only available with PlacesService.getDetails. |
user_ratings_totaloptional | Type: numberoptionalThe number of user ratings which contributed to this Place’s PlaceResult.rating. |
| Deprecated: Type: numberoptionalThe offset from UTC of the Place’s current timezone, in minutes. For example, Sydney, Australia in daylight savings is 11 hours ahead of UTC, so the utc_offset will be660. For timezones behind UTC, the offset is negative. For example, theutc_offset is-60 for Cape Verde. Only available withPlacesService.getDetails. |
utc_offset_minutesoptional | Type: numberoptionalThe offset from UTC of the Place’s current timezone, in minutes. For example, Sydney, Australia in daylight savings is 11 hours ahead of UTC, so the utc_offset_minutes will be660. For timezones behind UTC, the offset is negative. For example, theutc_offset_minutes is-60 for Cape Verde. Only available withPlacesService.getDetails. |
vicinityoptional | Type: stringoptionalThe simplified address for the Place, including the street name, street number, and locality, but not the province/state, postal code, or country. For example, Google's Sydney, Australia office has a vicinity value of "48 Pirrama Road, Pyrmont". Only available withPlacesService.getDetails. |
websiteoptional | Type: stringoptionalThe authoritative website for this Place, such as a business' homepage. Only available with PlacesService.getDetails. |
PlaceAspectRatinginterface
google.maps.places.PlaceAspectRatinginterface
Deprecated: This interface is no longer used.
Defines information about an aspect of the place that users have reviewed.
Properties | |
|---|---|
rating | Type: numberThe rating of this aspect. For individual reviews this is an integer from 0 to 3. For aggregated ratings of a place this is an integer from 0 to 30. |
type | Type: stringThe aspect type. For example, "food","decor","service", or"overall". |
BusinessStatusconstants
google.maps.places.BusinessStatusconstants
The operational status of the Place, if it is a business, returned in a PlaceResult (indicates whether the place is operational, or closed either temporarily or permanently). Specify these by value, or the constant's name (example:'OPERATIONAL' orgoogle.maps.places.BusinessStatus.OPERATIONAL).
Access by callingconst {BusinessStatus} = await google.maps.importLibrary("places").
SeeLibraries in the Maps JavaScript API.
Constants | |
|---|---|
CLOSED_PERMANENTLY | The business is closed permanently. |
CLOSED_TEMPORARILY | The business is closed temporarily. |
OPERATIONAL | The business is operating normally. |
PlaceGeometryinterface
google.maps.places.PlaceGeometryinterface
Defines information about the geometry of a Place.
Properties | |
|---|---|
locationoptional | Type: LatLngoptionalThe Place’s position. |
viewportoptional | Type: LatLngBoundsoptionalThe preferred viewport when displaying this Place on a map. This property will be null if the preferred viewport for the Place is not known. Only available withPlacesService.getDetails. |
PlaceOpeningHoursinterface
google.maps.places.PlaceOpeningHoursinterface
Defines information about the opening hours of a Place.
Properties | |
|---|---|
| Deprecated: Type: booleanoptionalWhether the Place is open at the current time. |
periodsoptional | Type: Array<PlaceOpeningHoursPeriod>optionalOpening periods covering for each day of the week, starting from Sunday, in chronological order. Days in which the Place is not open are not included. Only available with PlacesService.getDetails. |
weekday_textoptional | Type: Array<string>optionalAn 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. Only available with PlacesService.getDetails. Other calls may return an empty array. |
Methods | |
|---|---|
isOpen | isOpen([date])Parameters:
Return Value: boolean|undefinedCheck whether the place is open now (when no date is passed), or at the given date. If this place does not have PlaceResult.utc_offset_minutes orPlaceOpeningHours.periods thenundefined is returned (PlaceOpeningHours.periods is only available viaPlacesService.getDetails). This method does not take exceptional hours, such as holiday hours, into consideration. |
PlaceOpeningHoursPeriodinterface
google.maps.places.PlaceOpeningHoursPeriodinterface
Defines structured information about the opening hours of a Place.Note: If a Place isalways open, theclose section will be missing from the response. Clients can rely on always-open being represented as anopen period containingday with value0 andtime with value"0000", and noclose.
Properties | |
|---|---|
open | Type: PlaceOpeningHoursTimeThe opening time for the Place. |
closeoptional | Type: PlaceOpeningHoursTimeoptionalThe closing time for the Place. |
PlaceOpeningHoursTimeinterface
google.maps.places.PlaceOpeningHoursTimeinterface
Defines when a Place opens or closes.
Properties | |
|---|---|
day | Type: numberThe days of the week, as a number in the range [ 0,6], starting on Sunday. For example,2 means Tuesday. |
hours | Type: numberThe hours of the PlaceOpeningHoursTime.time as a number, in the range [0,23]. This will be reported in the Place’s time zone. |
minutes | Type: numberThe minutes of the PlaceOpeningHoursTime.time as a number, in the range [0,59]. This will be reported in the Place’s time zone. |
time | Type: stringThe 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. |
nextDateoptional | Type: numberoptionalThe timestamp (as milliseconds since the epoch, suitable for use with new Date()) representing the next occurrence of this PlaceOpeningHoursTime. It is calculated from thePlaceOpeningHoursTime.day of week, thePlaceOpeningHoursTime.time, and thePlaceResult.utc_offset_minutes. If thePlaceResult.utc_offset_minutes isundefined, thennextDate will beundefined. |
PlacePlusCodeinterface
google.maps.places.PlacePlusCodeinterface
Defines Open Location Codes or "plus codes" for a Place. 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).
Properties | |
|---|---|
global_code | Type: stringAplus code with a 1/8000th of a degree by 1/8000th of a degree area. For example, "8FVC9G8F+5W". |
compound_codeoptional | Type: stringoptionalAplus 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". If no suitable locality that can be found to shorten the code then this field is omitted. |
PlacePhotointerface
google.maps.places.PlacePhotointerface
Represents a photo element of a Place.
Properties | |
|---|---|
height | Type: numberThe height of the photo in pixels. |
html_attributions | Type: Array<string>Attribution text to be displayed for this photo. |
width | Type: numberThe width of the photo in pixels. |
Methods | |
|---|---|
getUrl | getUrl([opts])Parameters:
Return Value: stringReturns the image URL corresponding to the specified options. |
PhotoOptionsinterface
google.maps.places.PhotoOptionsinterface
Defines photo-requesting options.
Properties | |
|---|---|
maxHeightoptional | Type: numberoptionalThe maximum height in pixels of the returned image. |
maxWidthoptional | Type: numberoptionalThe maximum width in pixels of the returned image. |
PlaceReviewinterface
google.maps.places.PlaceReviewinterface
Represents a single review of a place.
Properties | |
|---|---|
author_name | Type: stringThe name of the reviewer. |
language | Type: stringAn 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'. |
profile_photo_url | Type: stringA URL to the reviwer's profile image. |
relative_time_description | Type: stringA 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: stringThe text of a review. |
time | Type: numberTimestamp for the review, expressed in seconds since epoch. |
| Deprecated: This field is no longer available. Type: Array<PlaceAspectRating>optionalThe aspects rated by the review. The ratings on a scale of 0 to 3. |
author_urloptional | Type: stringoptionalA URL to the reviewer's profile. This will be undefined when the reviewer's profile is unavailable. |
ratingoptional | Type: numberoptionalThe rating of this review, a number between 1.0 and 5.0 (inclusive). |
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-11 UTC.