# Location finder

## Options

| **How many results to show**          | Number of results and pins to return. Default is 100                                                                                                                                                                                                                                                         |
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Distance unit of measurement**      | Which unit to use to calculating distance from the visitor. Options are "miles" or "km"                                                                                                                                                                                                                      |
| **Disable Geolocation prompt**        | Don't prompt the visitor for their location in the browser, requiring them to enter a search manually                                                                                                                                                                                                        |
| **Geocoder components**               | Pass a series of valid geocoder components to pass on geocoder requests to influence results. Must match a specific format from google. Example: `country:US\|administrative_area:FL`                                                                                                                        |
| **Geocode Region Hint**               | For non-US finders, you can give the finder a hint of the visitor geography so that Google returns more relevant results                                                                                                                                                                                     |
| **Search input type**                 | <p>Custom search field types.<br>- <strong>5 digit US zip code:</strong> only US zip codes (numbers only)</p>                                                                                                                                                                                                |
| **Distance threshold of results**     | How far the bounds of the search should show locations. Default is 4000 units (miles or km)                                                                                                                                                                                                                  |
| **Redirect one result**               | If a single location is found and it has a location URL, it will automatically redirect the visitor in the browser                                                                                                                                                                                           |
| **Default location (Latitude)**       | This location is used for the initial map center point and is also used if "Search on load" is enabled. Example: `47.258728`                                                                                                                                                                                 |
| **Default location (Longitude)**      | This location is used for the initial map center point and is also used if "Search on load" is enabled. Example `-122.465973`                                                                                                                                                                                |
| **Search on load**                    | Automatically search locations when the location finder loads (uses the "Default location" point)                                                                                                                                                                                                            |
| **Initial search distance threshold** | Only apply to the initial loading of locations, this option overrides the normal "Distance threshold of results" to show a wider or shorter distance of locations. Good to use if you want to show "All locations" on initial load, but less (only the closest) locations when someone is entering a search. |
| **Show infowindow on search**         | This will automatically expand the infowindow pin for the first result after a search is entered                                                                                                                                                                                                             |

## Geolocation

Browser-based geolocation requires that the page is served under https (secure).

Currently preview URLs are not served under HTTPS, so a manual search is required for testing on the preview.

## URL parameters

Our location finder supports passing URL parameters the location finder page to pre-populate location search queries, filters and other parameters.

```
https://www.yourdomain.com/location-finder/?
    near_location=98121&
    services__in=atm,branch-location
```

| Parameter       |                                                                                                       |
| --------------- | ----------------------------------------------------------------------------------------------------- |
| `near_location` | Location search (zip code, address, city/state)                                                       |
| `services__in`  | Comma separated list of services tags if your location finder is configured for filtering the results |

### Form example

Here is an example of creating a simple form to link to the Location Finder that takes a visitor search location and passes that to the finder.&#x20;

```markup
<form action="https://www.yourdomain.com/location-finder/" method="get">
  <input type="text" name="near_location" placeholder="Enter your location">
  <button type="submit">Search</button>
</form>
```

The form code above can be updated as desired. The only required/important elements are:

* Action set to the URL of your location finder - `action="https://www.yourdomain.com/location-finder/"`
* Form should use GET - `method="get"`
* `<input>` with name of `near_location`

## Styling the finder

More information on themes and templates for the location finder:

{% content-ref url="/pages/-LrnxIHtQquaci3nVTyS" %}
[Store locator theme example](/themes-and-custom-templates/example-themes/store-locator-theme-example.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.devhub.com/maps/location-finder.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
