> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# aroundLatLng

> Coordinates around which to search

export const Setting = ({type, default: defaultValue, defaultNote, scope, min, max, formerly}) => {
  const renderedDefault = defaultValue === '' ? '""' : defaultValue;
  const renderedNote = defaultNote ? `(${defaultNote})` : '';
  return <ul>
      <li><strong>Type:</strong> <code>{type}</code></li>
      <li><strong>Default:</strong> <code>{renderedDefault}</code>{renderedNote}</li>
      {min && <li><strong>Min:</strong> <code>{min}</code></li>}
      {max && <li><strong>Max:</strong> <code>{max}</code></li>}
      <li><strong>Scope:</strong> <a href="/doc/api-reference/api-parameters"><code>{scope}</code></a></li>
      {formerly && <li>
          <strong>Deprecated name:</strong> <code>{formerly}</code>
        </li>}
    </ul>;
};

<Setting type="string" default="null" scope="search" />

The `aroundLatLng` parameter defines a center for geo-based search.
Only records within a computed radius of this location are returned, ranked by proximity.

Format: `"latitude, longitude"` (for example, `"40.71, -74.01"`)

To learn more, see [Geo location](/doc/guides/managing-results/refine-results/geolocation).

## Usage

* The radius of the search area is controlled by:

  * [`aroundRadius`](/doc/api-reference/api-parameters/aroundRadius): sets the **maximum radius**
  * [`minimumAroundRadius`](/doc/api-reference/api-parameters/minimumAroundRadius): sets the **minimum radius**

* The actual radius is computed dynamically based on record density:

  * Denser areas = smaller radius
  * Sparser areas = larger radius

* Setting [`getRankingInfo`](/doc/api-reference/api-parameters/getRankingInfo) to `true` adds the distance from the center to each result.

* This parameter is **ignored** if [`insideBoundingBox`](/doc/api-reference/api-parameters/insideBoundingBox) or [`insidePolygon`](/doc/api-reference/api-parameters/insidePolygon) is used.

* To use the user's IP location as the center, see [`aroundLatLngViaIP`](/doc/api-reference/api-parameters/aroundLatLngViaIP).

## Example

<AccordionGroup>
  <Accordion title="Current API clients" defaultOpen="true">
    <CodeGroup>
      ```cs C# theme={"system"}
      var response = await client.SearchSingleIndexAsync<Hit>(
        "INDEX_NAME",
        new SearchParams(new SearchParamsObject { AroundLatLng = "40.71, -74.01" })
      );
      ```

      ```dart Dart theme={"system"}
      final response = await client.searchSingleIndex(
        indexName: "INDEX_NAME",
        searchParams: SearchParamsObject(
          aroundLatLng: "40.71, -74.01",
        ),
      );
      ```

      ```go Go theme={"system"}
      response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(
        "INDEX_NAME").WithSearchParams(search.SearchParamsObjectAsSearchParams(
        search.NewEmptySearchParamsObject().SetAroundLatLng("40.71, -74.01"))))
      if err != nil {
        // handle the eventual error
        panic(err)
      }
      ```

      ```java Java theme={"system"}
      SearchResponse response = client.searchSingleIndex(
        "INDEX_NAME",
        new SearchParamsObject().setAroundLatLng("40.71, -74.01"),
        Hit.class
      );
      ```

      ```js JavaScript theme={"system"}
      const response = await client.searchSingleIndex({
        indexName: 'indexName',
        searchParams: { aroundLatLng: '40.71, -74.01' },
      });
      ```

      ```kotlin Kotlin theme={"system"}
      var response =
        client.searchSingleIndex(
          indexName = "INDEX_NAME",
          searchParams = SearchParamsObject(aroundLatLng = "40.71, -74.01"),
        )
      ```

      ```php PHP theme={"system"}
      $response = $client->searchSingleIndex(
          'INDEX_NAME',
          ['aroundLatLng' => '40.71, -74.01',
          ],
      );
      ```

      ```python Python theme={"system"}
      response = client.search_single_index(
          index_name="INDEX_NAME",
          search_params={
              "aroundLatLng": "40.71, -74.01",
          },
      )
      ```

      ```ruby Ruby theme={"system"}
      response = client.search_single_index(
        "INDEX_NAME",
        Algolia::Search::SearchParamsObject.new(around_lat_lng: "40.71, -74.01")
      )
      ```

      ```scala Scala theme={"system"}
      val response = Await.result(
        client.searchSingleIndex(
          indexName = "INDEX_NAME",
          searchParams = Some(
            SearchParamsObject(
              aroundLatLng = Some("40.71, -74.01")
            )
          )
        ),
        Duration(100, "sec")
      )
      ```

      ```swift Swift theme={"system"}
      let response: SearchResponse<Hit> = try await client.searchSingleIndex(
          indexName: "INDEX_NAME",
          searchParams: SearchSearchParams
              .searchSearchParamsObject(SearchSearchParamsObject(aroundLatLng: "40.71, -74.01"))
      )
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Legacy API clients">
    <CodeGroup>
      ```cs C# theme={"system"}
      index.Search(new Query("query")
      {
          AroundLatLng = "40.71, -74.01"
      });
      ```

      ```go Go theme={"system"}
      res, err := index.Search(
      	"query",
      	opt.AroundLatLng("40.71, -74.01"),
      )
      ```

      ```java Java theme={"system"}
      index.search(
        new Query("query")
          .setAroundLatLng("40.71, -74.01")
      );
      ```

      ```js JavaScript theme={"system"}
      index
        .search("query", {
          aroundLatLng: "40.71, -74.01",
        })
        .then(({ hits }) => {
          console.log(hits);
        });
      ```

      ```php PHP theme={"system"}
      $results = $index->search('query', [
        'aroundLatLng' => '40.71, -74.01'
      ]);
      ```

      ```python Python theme={"system"}
      results = index.search("query", {"aroundLatLng": "40.71, -74.01"})
      ```

      ```ruby Ruby theme={"system"}
      results = index.search(
        "query",
        {
          aroundLatLng: "40.71, -74.01"
        }
      )
      ```

      ```scala Scala theme={"system"}
      client.execute {
        search into "myIndex" query Query(
          query = Some("query"),
          aroundLatLng = Some(
            AroundLatLng("40.71, -74.01")
          )
        )
      }
      ```

      ```swift Swift theme={"system"}
      let query = Query("query")
        .set(\.aroundLatLng, to: Point(latitude: 40.71, longitude: -74.01))

      index.search(query: query) { result in
        if case .success(let response) = result {
          print("Response: \(response)")
        }
      }
      ```
    </CodeGroup>
  </Accordion>
</AccordionGroup>
