You're all set!

To start developing, please head over to our developer documentation.

Activate the Google Maps JavaScript API

To get you started we'll guide you through the Google Developers Console to do a few things first:

  1. Create or choose a project
  2. Activate the Google Maps JavaScript API and related services
  3. Create appropriate keys
Continue

Places Service

PlaceAspectRating interface

google.maps.places.PlaceAspectRating interface

Defines information about an aspect of the place that users have reviewed.

Library

places

Properties
rating
Type:  number
The 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:  string
The aspect type, e.g. "food", "decor", "service", "overall".

PlaceDetailsRequest interface

google.maps.places.PlaceDetailsRequest interface

A Place details query to be sent to the PlacesService.

Library

places

Properties
placeId
Type:  string
The Place ID of the Place for which details are being requested.

PlaceGeometry interface

google.maps.places.PlaceGeometry interface

Defines information about the geometry of a Place.

Library

places

Properties
location
Type:  LatLng
The Place's position.
viewport
Type:  LatLngBounds
The preferred viewport when displaying this Place on a map. This property will be null if the preferred viewport for the Place is not known.

PlacePhoto interface

google.maps.places.PlacePhoto interface

Represents a photo element of a Place.

Library

places

Methods
getUrl
getUrl(opts)
Parameters: 
Return Value:  string
Returns the image URL corresponding to the specified options. You must include a PhotoOptions object with at least one of maxWidth or maxHeight specified.
Properties
height
Type:  number
The height of the photo in pixels.
html_attributions
Type:  Array<string>
Attribution text to be displayed for this photo.
width
Type:  number
The width of the photo in pixels.

PhotoOptions interface

google.maps.places.PhotoOptions interface

Defines photo-requesting options.

Library

places

Properties
maxHeight
Type:  number
The maximum height in pixels of the returned image.
maxWidth
Type:  number
The maximum width in pixels of the returned image.

PlaceResult interface

google.maps.places.PlaceResult interface

Defines information about a Place.

Library

places

Properties
address_components
The collection of address components for this Place's location.
aspects
Type:  Array<PlaceAspectRating>
The rated aspects of this Place, based on Google and Zagat user reviews. The ratings are on a scale of 0 to 30.
formatted_address
Type:  string
The Place's full address.
formatted_phone_number
Type:  string
The Place's phone number, formatted according to the number's regional convention.
geometry
The Place's geometry-related information.
html_attributions
Type:  Array<string>
Attribution text to be displayed for this Place result.
icon
Type:  string
URL to an image resource that can be used to represent this Place's category.
international_phone_number
Type:  string
The Place's phone number in international format. International format includes the country code, and is prefixed with the plus (+) sign.
name
Type:  string
The 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).
permanently_closed
Type:  boolean
A flag indicating whether the Place is permanently closed. If the place is not permanently closed, the flag is not present in search or details responses.
photos
Type:  Array<PlacePhoto>
Photos of this Place. The collection will contain up to ten PlacePhoto objects.
place_id
Type:  string
A unique identifier for a place.
price_level
Type:  number
The price level of the Place, on a scale of 0 to 4. Price levels are interpreted as follows:
  • 0: Free
  • 1: Inexpensive
  • 2: Moderate
  • 3: Expensive
  • 4: Very Expensive
rating
Type:  number
A rating, between 1.0 to 5.0, based on user reviews of this Place.
reviews
Type:  Array<PlaceReview>
A list of reviews of this Place.
types
Type:  Array<string>
An array of types for this Place (e.g., ["political", "locality"] or ["restaurant", "establishment"]).
url
Type:  string
URL of the official Google page for this place. This is the Google-owned page that contains the best available information about the place.
utc_offset
Type:  number
The 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 be 660. For timezones behind UTC, the offset is negative. For example, utc_offest is -60 for Cape Verde.
vicinity
Type:  string
A fragment of the Place's address for disambiguation (usually street name and locality).
website
Type:  string
The authoritative website for this Place, such as a business' homepage.

PlaceReview interface

google.maps.places.PlaceReview interface

Represents a single review of a place.

Library

places

Properties
aspects
Type:  Array<PlaceAspectRating>
The aspects rated by the review. The ratings on a scale of 0 to 3.
author_name
Type:  string
The name of the reviewer.
author_url
Type:  string
A link to the reviewer's profile. This will be undefined when the reviewer's profile is unavailable.
language
Type:  string
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'.
text
Type:  string
The text of a review.

PlaceSearchPagination interface

google.maps.places.PlaceSearchPagination interface

An object used to fetch additional pages of Places results.

Library

places

Methods
nextPage
nextPage()
Parameters:  None
Return Value:  None
Fetches the next page of results. Uses the same callback function that was provided to the first search request.
Properties
hasNextPage
Type:  boolean
Indicates if further results are available. true when there is an additional results page.

PlaceSearchRequest interface

google.maps.places.PlaceSearchRequest interface

A Place search query to be sent to the PlacesService.

Library

places

Properties
bounds
The bounds within which to search for Places. Both location and radius will be ignored if bounds is set.
keyword
Type:  string
A 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.
location
The location around which to search for Places.
maxPriceLevel
Type:  number
Restricts 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.
minPriceLevel
Type:  number
Restricts 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.
name
Type:  string
Restricts the Place search results to Places that include this text in the name.
openNow
Type:  boolean
Restricts results to only those places that are open right now.
radius
Type:  number
The distance from the given location within which to search for Places, in meters. The maximum allowed value is 50 000.
rankBy
Type:  RankBy
Specifies the ranking method to use when returning results. Defaults to PROMINENCE. Note that when rankBy is set to DISTANCE, you must specify a location but you cannot specify a radius or bounds.
type
Type:  string
Searches 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 given here.

PlacesService class

google.maps.places.PlacesService class

Contains methods related to searching for places and retrieving details about a place.

Library

places

Constructor
PlacesService
PlacesService(attrContainer)
Parameters: 
  • attrContainerHTMLDivElement|Map
Creates a new instance of the PlacesService that renders attributions in the specified container.
Methods
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, or location and radius parameters. The PlaceResults passed to the callback are subsets of the full PlaceResult. Your app can get a more detailed PlaceResult for each place by sending a Place Details request passing the reference value for the desired place. The PlaceSearchPagination 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).
radarSearch
radarSearch(request, callback)
Parameters: 
Return Value:  None
Similar to the nearbySearch function, with the following differences: the search response will include up to 200 places, identified only by their geographic coordinates and place_id.
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 region 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. The PlaceSearchPagination 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).

PlacesServiceStatus constants

google.maps.places.PlacesServiceStatus constants

The status returned by the PlacesService on the completion of its searches. Specify these by value, or by using the constant's name. For example, 'OK' or google.maps.places.PlacesServiceStatus.OK.

Library

places

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 the PlacesService.
UNKNOWN_ERROR The PlacesService 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.

Send feedback about...

Google Maps JavaScript API
Google Maps JavaScript API
Need help? Visit our support page.