Place IDs

Place IDs uniquely identify a place in the Google Places database and on Google Maps.

Find the ID of a particular place

Are you looking for the place ID of a specific place? Use the place ID finder below to search for a place and get its ID:

Alternatively, you can view the place ID finder with its code in the Maps JavaScript API documentation.

Overview

A place ID is a textual identifier that uniquely identifies a place. The length of the identifier may vary. Examples:

  • ChIJrTLr-GyuEmsRBfy61i59si0
    
  • EisxMyBNYXJrZXQgU3RyZWV0LCBXaWxtaW5ndG9uLCBOQyAyODQwMSwgVVNB
    

Place IDs are available for most locations, including businesses, landmarks, parks, and intersections.

You can use the same place ID across the Places API and a number of Google Maps Platform APIs. For example, you can use the same place ID to reference a place in the Places API, the Maps JavaScript API, the Maps Geocoding API, the Maps Embed API and the Roads API.

Retrieve place details using the place ID

Place IDs are exempt from the caching restrictions stated in Section 3.2.4(a) of the Google Maps Platform Terms of Service. Once you've identified the place ID for a place, you may reuse that value the next time you look up that place. For more information, see Save place IDs for later use below.

A common way of using place IDs is to search for a place (using the Places API or the Places library in the Maps JavaScript API, for example) then use the returned place ID to retrieve place details. You can store the place ID and use it to retrieve the same place details later. Read about saving place IDs below.

Example using the Places SDK for iOS

A place ID is a textual identifier that uniquely identifies a place. In the Places SDK for iOS, you can retrieve the ID of a place from a GMSPlace object. You can store the place ID and use it to retrieve the GMSPlace object again later.

To get a place by ID, call GMSPlacesClient fetchPlaceFromPlaceID:, passing the following parameters:

  • A string containing a Place ID.
  • One or more GMSPlaceFields, specifying the data types to return.
  • A session token if the call is made to conclude an autocomplete query. Otherwise, pass nil.
  • A GMSPlaceResultCallback to handle the result.

The API invokes the specified callback method, passing in a GMSPlace object. If the place is not found, the place object is nil.

Swift

// A hotel in Saigon with an attribution.
let placeID = "ChIJV4k8_9UodTERU5KXbkYpSYs"

// Specify the place data types to return.
let fields: GMSPlaceField = GMSPlaceField(rawValue: UInt(GMSPlaceField.name.rawValue) |
  UInt(GMSPlaceField.placeID.rawValue))!

placesClient?.fetchPlace(fromPlaceID: placeId, placeFields: fields, sessionToken: nil, callback: {
  (place: GMSPlace?, error: Error?) in
  if let error = error {
    print("An error occurred: \(error.localizedDescription)")
    return
  }
  if let place = place {
    self.lblName?.text = place.name
    print("The selected place is: \(place.name)")
  }
})

Objective-C

// A hotel in Saigon with an attribution.
NSString *placeId = @"ChIJV4k8_9UodTERU5KXbkYpSYs";

// Specify the place data types to return.
GMSPlaceField fields = (GMSPlaceFieldName | GMSPlaceFieldPlaceID);

[_placesClient fetchPlaceFromPlaceID:placeId placeFields:fields sessionToken:nil callback:^(GMSPlace * _Nullable place, NSError * _Nullable error) {
  if (error != nil) {
    NSLog(@"An error occurred %@", [error localizedDescription]);
    return;
  }
  if (place != nil) {
    NSLog(@"The selected place is: %@", [place name]);
  }
}];

Save place IDs for later use

Place IDs are exempt from the caching restrictions stated in Section 3.2.4(a) of the Google Maps Platform Terms of Service. You can therefore store place ID values for later use.

You may occasionally receive a NOT_FOUND status code when you use a saved place ID. Best practice is to refresh your stored place IDs periodically. You can refresh Place IDs free of charge, by making a Place Details request, specifying only the ID field in the fields parameter. This will trigger the Places Details - ID Refresh SKU. However, this request might also return NOT_FOUND status code. One strategy is to store the original request that returned each place ID. If a place ID becomes invalid, you can re-issue that request to get fresh results. These results may or may not include the original place. The request is chargeable.

A place ID may become obsolete if a business closes or moves to a new location.

Place IDs may change due to large-scale updates on the Google Maps database. In such cases, a place may receive a new place ID, and the old ID returns a NOT_FOUND response.

In particular, some types of place IDs may sometimes cause a NOT_FOUND response, or the API may return a different place ID in the response. These place ID types include:

  • Street addresses that do not exist in Google Maps as precise addresses, but are inferred from a range of addresses.
  • Segments of a long route, where the request also specifies a city or locality.
  • Intersections.
  • Places with an address component of type subpremise.

These IDs often take the form of a long string. Example:

ElMxNjIsIExhbmUgTnVtYmVyIDcsIEJsb2NrIEgsIE5lYiBTYXJhaSwgU2FpbmlrIEZhcm0sIE5ldyBEZWxoaSwgRGVsaGkgMTEwMDYyLCBJbmRpYQ