Select platform: [Android](https://developers.google.com/maps/documentation/places/android-sdk/nearby-search.md.txt "View this page for the Android platform docs.") [iOS](https://developers.google.com/maps/documentation/places/ios-sdk/nearby-search.md.txt "View this page for the iOS platform docs.") [JavaScript](https://developers.google.com/maps/documentation/javascript/nearby-search.md.txt "View this page for the JavaScript platform docs.") [Web Service](https://developers.google.com/maps/documentation/places/web-service/nearby-search.md.txt "View this page for the Web Service platform docs.") **European Economic Area (EEA) developers**

> [!NOTE]
> If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](https://developers.google.com/maps/comms/eea/faq.md.txt).

> [!NOTE]
> This feature requires that you enable Places API (New), the next generation of the Places API. For more information, see [Enable APIs](https://developers.google.com/maps/documentation/places/ios-sdk/cloud-setup#enabling-apis).

A Nearby Search (New) request takes as input the region to search
specified as a circle, defined by the latitude and longitude coordinates of the center point of the
circle and the radius in meters. The request returns a list of matching places, each represented by a
[`GMSPlace`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlace.md.txt)
object, within the specified search area.

By default, the response contains places of all types within the search area. You can optionally
filter the response by specifying a list of place types to explicitly include in or exclude from the
response. For example, you can specify to include only those places in the response that are of type
"restaurant", "bakery", and "cafe", or exclude all places of type "school".

## Nearby Search (New) requests

Make a Nearby Search request by calling
[`GMSPlacesClient searchNearbyWithRequest:`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient.md.txt#-searchnearbywithrequest:callback:),
passing a
[`GMSPlaceSearchNearbyRequest`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceSearchNearbyRequest.md.txt)
object that defines the request parameters and a callback method, of type
[`GMSPlaceSearchNearbyResultCallback`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions.md.txt#/c:GMSPlacesClient.h@T@GMSPlaceSearchNearbyResultCallback),
to handle the response.

The `GMSPlaceSearchNearbyRequest` object specifies all of the
[required](https://developers.google.com/maps/documentation/places/ios-sdk/nearby-search.md.txt#required-parameters) and [optional](https://developers.google.com/maps/documentation/places/ios-sdk/nearby-search.md.txt#optional-parameters)
parameters for the request. The required parameters include:

- The list of fields to return in the `GMSPlace` object, also called the *field mask* , as defined by [`GMSPlaceProperty`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Constants.md.txt). If you don't specify at least one field in the field list, or if you omit the field list, then the call returns an error.
- The [location restriction](https://developers.google.com/maps/documentation/places/ios-sdk/nearby-search.md.txt#locationrestriction), meaning the circle defining the search area.

This example nearby search request specifies that the response `GMSPlace` objects
contain the place name (`GMSPlacePropertyName`) and place coordinates
(`GMSPlacePropertyCoordinate`) for each `GMSPlace` object in the search
results. It also filters the response to only return places of type "restaurant" and "cafe".

### Places Swift SDK

```swift
let restriction = CircularCoordinateRegion(center: CLLocationCoordinate2DMake(37.7937, -122.3965), radius: 500)
let searchNearbyRequest = SearchNearbyRequest(
  locationRestriction: restriction,
  placeProperties: [ .name, .coordinate],
  includedTypes: [ .restaurant, .cafe ],
)
switch await placesClient.searchNearby(with: searchNearbyRequest) {
case .success(let places):
  // Handle places
case .failure(let placesError):
  // Handle error
}
```

### Swift

```swift
// Array to hold the places in the response
var placeResults: [GMSPlace] = []

// Define the search area as a 500 meter diameter circle in San Francisco, CA.
let circularLocationRestriction = GMSPlaceCircularLocationOption(CLLocationCoordinate2DMake(37.7937, -122.3965), 500)

// Specify the fields to return in the GMSPlace object for each place in the response.
let placeProperties = [GMSPlaceProperty.name, GMSPlaceProperty.coordinate].map {$0.rawValue}

// Create the GMSPlaceSearchNearbyRequest, specifying the search area and GMSPlace fields to return.
var request = GMSPlaceSearchNearbyRequest(locationRestriction: circularLocationRestriction, placeProperties: placeProperties)
let includedTypes = ["restaurant", "cafe"]
request.includedTypes = includedTypes

let callback: GMSPlaceSearchNearbyResultCallback = { [weak self] results, error in
  guard let self, error == nil else {
    if let error {
      print(error.localizedDescription)
    }
    return
  }
  guard let results = results as? [GMSPlace] else {
    return
  }
  placeResults = results
}

GMSPlacesClient.shared().searchNearby(with: request, callback: callback)
```

### Objective-C

```objective-c
// Array to hold the places in the response
_placeResults = [NSArray array];

// Define the search area as a 500 meter diameter circle in San Francisco, CA.
id<GMSPlaceLocationRestriction> circularLocation = GMSPlaceCircularLocationOption(CLLocationCoordinate2DMake(37.7937, -122.3965), 500);

// Create the GMSPlaceSearchNearbyRequest, specifying the search area and GMSPlace fields to return.
GMSPlaceSearchNearbyRequest *request = [[GMSPlaceSearchNearbyRequest alloc]
  initWithLocationRestriction:circularLocation
              placeProperties:@[ GMSPlacePropertyName, GMSPlacePropertyCoordinate ]];

// Set the place types to filter on.
NSArray<NSString *> *includedTypes = @[ @"restaurant", @"cafe" ];
request.includedTypes = [[NSMutableArray alloc] initWithArray:includedTypes];

[_placesClient searchNearbyWithRequest:request
  callback:^(NSArray<GMSPlace *> *_Nullable places, NSError *_Nullable error) {
    if (error != nil) {
      NSLog(@"An error occurred %@", [error localizedDescription]);
      return;
    } else {
        // Get list of places.
        _placeResults = places;
    }
  }
];
```

### Nearby Search responses

The Nearby Search API returns an array of matches in the form of [`GMSPlace`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlace.md.txt) objects, with one `GMSPlace` object per matching place.

> [!NOTE]
> **Note:** Fields of the response `GMSPlace` object cannot be empty. For example, if the field list includes `GMSPlacePropertyPhotos` to request the `photos` field in response, and the `photos` field in the response is empty, it is omitted from the response `GMSPlace` object.

### Get open status


The [`GMSPlacesClient`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient.md.txt) object contains a member function called [`isOpenWithRequest`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient.md.txt#-isopenwithrequest:callback:) (`isOpenRequest` in Swift and [`isPlaceOpenRequest`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/IsPlaceOpenRequest.md.txt) in GooglePlacesSwift) that returns a response indicating whether the place is currently open, based on the time specified in the call.

> [!NOTE]
> **Note:** The deprecated `GMSPlace isOpen:` and `GMSPlace isOpenAtDate:` functions may be inaccurate and are not meant to be used with Places API (New).


This method takes a single argument of type `GMSPlaceIsOpenWithRequest` that contains:

- A [`GMSPlace` object](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlace.md.txt), or a string specifying a place ID. For more information on creating the Place object with the necessary fields, see [Place details](https://developers.google.com/maps/documentation/places/ios-sdk/place-details#place-details).  

  > [!NOTE]
  > **Note:** The Place object must contain a valid place ID.

- An optional `NSDate` (Obj-C) or `Date` (Swift) object specifying the time you would like to check. If no time is specified, the default is now.
- A [`GMSPlaceOpenStatusResponseCallback`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions.md.txt#/c:GMSPlacesClient.h@T@GMSPlaceOpenStatusCallback) method to handle the response.
\>


The `GMSPlaceIsOpenWithRequest` method requires the following fields to be set in the `GMSPlace` object:

- `GMSPlacePropertyUTCOffsetMinutes`
- `GMSPlacePropertyBusinessStatus`
- `GMSPlacePropertyOpeningHours`
- `GMSPlacePropertyCurrentOpeningHours`
- `GMSPlacePropertySecondaryOpeningHours`


If these fields are not provided in the Place object, or if you pass a place ID, the method uses [`GMSPlacesClient GMSFetchPlaceRequest:`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSFetchPlaceRequest.md.txt) to fetch them.

#### `isOpenWithRequest` response


`isOpenWithRequest` returns a `GMSPlaceIsOpenResponse` object containing a boolean value named `status` that indicates whether the business is open, closed, or if the status is unknown.

| Language | Value if open | Value if closed | Value if status unknown |
|---|---|---|---|
| Places Swift | `true` | `false` | `nil` |
| Swift | `.open` | `.closed` | `.unknown` |
| Objective-C | `GMSPlaceOpenStatusOpen` | `GMSPlaceOpenStatusClosed` | `GMSPlaceOpenStatusUnknown` |

#### Billing for `isOpenWithRequest`

- The `GMSPlacePropertyUTCOffsetMinutes` and `GMSPlacePropertyBusinessStatus` fields are charged under the [Basic Data SKU](https://developers.google.com/maps/documentation/places/ios-sdk/usage-and-billing.md.txt#basic-data-ess-sku). The rest of the Opening Hours are charged under the [Place Details Enterprise SKU.](https://developers.google.com/maps/documentation/places/ios-sdk/usage-and-billing.md.txt#place-details-ent-sku)
- If your `GMSPlace` object *already* has these fields from a previous request, you won't be charged again.
-

  > [!WARNING]
  > **Warning** If your `GMSPlace` object does not have these fields, you will be charged *again* for the [Basic Data SKU](https://developers.google.com/maps/documentation/places/ios-sdk/usage-and-billing.md.txt#basic-data-ess-sku). The rest of the Opening Hours are charged under the [Place Details Enterprise SKU.](https://developers.google.com/maps/documentation/places/ios-sdk/usage-and-billing.md.txt#place-details-ent-sku) If your project will use `isOpenWithRequest`, we recommend ensuring you fetch the necessary place details.

#### Example: Make a `GMSPlaceIsOpenWithRequest` request

The following example shows how to initialize a `GMSPlaceIsOpenWithRequest` within an existing `GMSPlace` object.

### Places Swift SDK

```swift
        let isOpenRequest = IsPlaceOpenRequest(place: place)
        switch await placesClient.isPlaceOpen(with: isOpenRequest) {
          case .success(let isOpenResponse):
            switch isOpenResponse.status {
              case true:
                // Handle open
              case false:
                // Handle closed
              case nil:
                // Handle unknown
          case .failure(let placesError):
            // Handle error
        }
        
```

### Swift

```swift
    let isOpenRequest = GMSPlaceIsOpenRequest(place: place, date: nil)
      GMSPlacesClient.shared().isOpen(with: isOpenRequest) { response, error in
        if let error = error {
          // Handle Error
        }
        switch response.status {
          case .open:
            // Handle open
          case .closed:
            // Handle closed
          case .unknown:
            // Handle unknown
        }
      }
        
```

### Objective-C

```objective-c
          GMSPlaceIsOpenRequest *isOpenRequest = [[GMSPlaceIsOpenRequest alloc] initWithPlace:place date:nil];

          [[GMSPlacesClient sharedClient] isOpenWithRequest:isOpenRequest callback:^(GMSPlaceIsOpenResponse response, NSError *_Nullable error) {
            if (error) {
              // Handle error
            }

            switch (response.status) {
              case GMSPlaceOpenStatusOpen:
                // Handle open
              case GMSPlaceOpenStatusClosed:
                // Handle closed
              case GMSPlaceOpenStatusUnknown:
                // Handle unknown
            }
          }];
          
```

## Required parameters

Use the `GMSPlaceSearchNearbyRequest` object to specify the required parameters for
the search.

-

  ### Field list

  When you request place details, you must specify the data to
  return in the `GMSPlace` object for the place as a field mask. To define the
  field mask, pass an array of values from
  `GMSPlaceProperty`
  to the `GMSPlaceSearchNearbyRequest` object.
  Field masking is a good design practice to ensure that you don't request unnecessary data,
  which helps to avoid unnecessary processing time and billing charges.

  Specify one or more of the following fields:
  - The following fields trigger the
    [Nearby Search Pro SKU](https://developers.google.com/maps/documentation/places/ios-sdk/usage-and-billing.md.txt#nearby-search-pro-sku):


    `GMSPlacePropertyAddressComponents`   

    `GMSPlacePropertyBusinessStatus`   

    `GMSPlacePropertyCoordinate`   

    `GMSPlacePropertyFormattedAddress`   

    `GMSPlacePropertyName`   

    `GMSPlacePropertyIconBackgroundColor`   

    `GMSPlacePropertyIconImageURL`   

    `GMSPlacePropertyPhotos`   

    `GMSPlacePropertyPlaceID`   

    `GMSPlacePropertyPlusCode`   

    `GMSPlacePropertyTypes`   

    `GMSPlacePropertyUTCOffsetMinutes`   

    `GMSPlacePropertyViewport`   

    `GMSPlacePropertyWheelchairAccessibleEntrance`


    For a complete list of fields and their associated SKUs, see [Place Data Fields (New)](https://developers.google.com/maps/documentation/places/ios-sdk/data-fields.md.txt).

    <br />

  - The following fields trigger the
    [Nearby Search Enterprise SKU](https://developers.google.com/maps/documentation/places/ios-sdk/usage-and-billing.md.txt#nearby-search-ent-sku):


    `GMSPlacePropertyCurrentOpeningHours`   

    `GMSPlacePropertySecondaryOpeningHours`   

    `GMSPlacePropertyPhoneNumber`   

    `GMSPlacePropertyPriceLevel`   

    `GMSPlacePropertyRating`   

    `GMSPlacePropertyOpeningHours`   

    `GMSPlacePropertyUserRatingsTotal`   

    `GMSPlacePropertyWebsite`


    For a complete list of fields and their associated SKUs, see [Place Data Fields (New)](https://developers.google.com/maps/documentation/places/ios-sdk/data-fields.md.txt).

    <br />

  - The following fields trigger the
    [Nearby Search Enterprise Plus SKU](https://developers.google.com/maps/documentation/places/ios-sdk/usage-and-billing.md.txt#nearby-search-ent-plus-skuh):


    `GMSPlacePropertyCurbsidePickup`   

    `GMSPlacePropertyDelivery`   

    `GMSPlacePropertyDineIn`   

    `GMSPlacePropertyEditorialSummary`   

    `GMSPlacePropertyReservable`   

    `GMSPlacePropertyReviews`   

    `GMSPlacePropertyServesBeer`   

    `GMSPlacePropertyServesBreakfast`   

    `GMSPlacePropertyServesBrunch`   

    `GMSPlacePropertyServesDinner`   

    `GMSPlacePropertyServesLunch`   

    `GMSPlacePropertyServesVegetarianFood`   

    `GMSPlacePropertyServesWine`   

    `GMSPlacePropertyTakeout`


    For a complete list of fields and their associated SKUs, see [Place Data Fields (New)](https://developers.google.com/maps/documentation/places/ios-sdk/data-fields.md.txt).

    <br />

  The following example passes a list of two
  [field values](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions.md.txt#/c:GMSPlaceProperty.h@T@GMSPlaceProperty)
  to specify that the `GMSPlace` object returned by a request contains the
  `name` and `placeID` fields:

  ### Places Swift SDK

  ```swift
  // Specify the place data types to return.
  let fields: [PlaceProperty] = [.placeID, .displayName]
          
  ```

  ### Swift

  ```swift
  // Specify the place data types to return.
  let fields: [GMSPlaceProperty] = [.placeID, .name]
          
  ```

  ### Objective-C

  ```objective-c
  // Specify the place data types to return.
  NSArray<GMSPlaceProperty *> *fields = @[GMSPlacePropertyPlaceID, GMSPlacePropertyName];
          
  ```
-

  ### locationRestriction

  A [`GMSPlaceLocationRestriction`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Protocols/GMSPlaceLocationRestriction.md.txt)
  object that defines the region to search specified as a circle, defined by center point and
  radius in meters. The radius must be between 0.0 and 50000.0, inclusive. The default radius is
  0.0. You must set it in your request to a value greater than 0.0.

## Optional parameters

Use the `GMSPlaceSearchNearbyRequest` object to specify the optional parameters for
the search.

-

  ### includedTypes/excludedTypes, includedPrimaryTypes/excludedPrimaryTypes

  Lets you specify a list of types from types
  [Table A](https://developers.google.com/maps/documentation/places/ios-sdk/place-types.md.txt#table-a) used to filter
  the search results. Up to 50 types can be specified in each type restriction category.

  > [!NOTE]
  > **Note:** The values in [Table B](https://developers.google.com/maps/documentation/places/ios-sdk/place-types.md.txt#table-b) are only returned in the response. You cannot use values in [Table B](https://developers.google.com/maps/documentation/places/ios-sdk/place-types.md.txt#table-b) as a filter.

  A place can only have a **single primary type** from types
  [Table A](https://developers.google.com/maps/documentation/places/ios-sdk/place-types.md.txt#table-a) associated with
  it. For example, the primary type might be
  `"mexican_restaurant"` or `"steak_house"`. Use
  `includedPrimaryTypes` and `excludedPrimaryTypes` to filter the results on
  a place's primary type.

  A place can also have **multiple type values** from types
  [Table A](https://developers.google.com/maps/documentation/places/ios-sdk/place-types.md.txt#table-a)
  associated with it. For example a restaurant might have the following types:
  `"seafood_restaurant"`, `"restaurant"`, `"food"`,
  `"point_of_interest"`, `"establishment"`. Use `includedTypes`
  and `excludedTypes` to filter the results on the list of types associated with
  a place.

  When you specify a general primary type, such as `"restaurant"` or
  `"hotel"`, the response can contain places with a more specific primary type than
  the one specified. For example, you specify to include a primary type of
  `"restaurant"`. The response can then contain places with a primary type of
  `"restaurant"`, but the response can also contain places with a more specific
  primary type, such as `"chinese_restaurant"` or `"seafood_restaurant"`.

  If a search is specified with multiple type restrictions, only places
  that satisfy all of the restrictions are returned. For example, if you specify
  `{"includedTypes": ["restaurant"], "excludedPrimaryTypes": ["steak_house"]}`, the
  returned places provide `"restaurant"` related services but don't operate primarily
  as a `"steak_house"`.

  > [!NOTE]
  > If you omit `includedTypes`, `excludedTypes`, `includedPrimaryTypes`, and `excludedPrimaryTypes` from the request, the search returns places for all types from within the location restriction bounds.

  #### includedTypes

  A list of the place types from
  [Table A](https://developers.google.com/maps/documentation/places/ios-sdk/place-types.md.txt#table-a) to search for.
  If this parameter is omitted, places of all types are returned.

  #### excludedTypes

  A list of place types from
  [Table A](https://developers.google.com/maps/documentation/places/ios-sdk/place-types.md.txt#table-a) to exclude from a
  search.

  If you specify both the `includedTypes` (such as `"school"`) and the
  `excludedTypes` (such as `"primary_school"`) in the request, then the
  response includes places that are categorized as `"school"` but not as
  `"primary_school"`. The response includes places that match **at least one** of
  the `includedTypes` and **none of** the `excludedTypes`.

  If there are any conflicting types, such as a type appearing in both `includedTypes`
  and `excludedTypes`, an `INVALID_REQUEST` error is returned.

  #### includedPrimaryTypes

  A list of primary place types from
  [Table A](https://developers.google.com/maps/documentation/places/ios-sdk/place-types.md.txt#table-a) to include
  in a search.

  #### excludedPrimaryTypes

  A list of primary place types from
  [Table A](https://developers.google.com/maps/documentation/places/ios-sdk/place-types.md.txt#table-a) to exclude
  from a search.


  If there are any conflicting primary types, such as a type appearing in both
  `includedPrimaryTypes` and `excludedPrimaryTypes`, an
  `INVALID_ARGUMENT` error is returned.
-

  ### maxResultCount

  Specifies the maximum number of place results to return. Must be between
  1 and 20 (default) inclusive.
-

  ### rankPreference

  The type of ranking to use. If this parameter is omitted, results are ranked by popularity.
  May be one of the following:
  - `.popularity` (default) Sorts results based on their popularity.
  - `.distance` Sorts results in ascending order by their distance from the specified location.
-

  ### regionCode

  The region code used to format the response, specified as a
  [two-character CLDR code](https://www.unicode.org/cldr/charts/latest/supplemental/territory_language_information.html) value. There is no default value.

  If the country name of the `formattedAddress` field in the response matches the
  `regionCode`, the country code is omitted from `formattedAddress`.
  This parameter has no effect on `adrFormatAddress`, which always includes the country
  name, or on `shortFormattedAddress`, which never includes it.

  Most CLDR 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").
  The parameter can affect results based on applicable law.

## Display attributions in your app

When your app displays information obtained from
[`GMSPlacesClient`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient.md.txt),
such as photos and reviews, the app must also display the required attributions.

For example, the `reviews` property of the `GMSPlacesClient` object
contains an array of up to five
[`GMSPlaceReview`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceReview.md.txt)
objects. Each `GMSPlaceReview` object can contain attributions and author attributions.
If you display the review in your app, then you must also display any attribution or author
attribution.

For more information, see the documentation on
[attributions](https://developers.google.com/maps/documentation/places/ios-sdk/policies.md.txt#other_attribution_requirements).