Skip to main content

Location search

This articles explains how Location search works in Sharetribe.

Sharetribe Team avatar
Written by Sharetribe Team
Updated this week

Location search allows users to find listings based on their location. Users can search by specific addresses or areas, such as a neighborhood, city, or region.

Location search is enabled at Console > Build > Listings > Listing search.

Location searches are powered by Google Maps or Mapbox. Your Test environment has a test Mapbox account configured. When you go Live, you need to connect Google Maps or Mapbox to power your location services in your Live environment. Learn more about connecting location services.

How are search results found and sorted

When you search for a location, such as a specific address or broad region, only listings within the searched area are displayed. This type of search is called "search by bounds."

With code customization, you can change the location search in different ways. For example, you could implement a "point of origin search," which looks for results based on the starting point location and filters them based on their proximity to the starting location.

How to display a map on my search page

"Map view" is one of the default search page layout options. When enabled, a map showing listing locations appears on the right side of the search page.

Using the Map view layout with location search provides an intuitive location search experience. Users can search by location and see their results displayed on a map. Moving the map automatically refreshes the search to match the display area.

You do not need to have location search enabled to use the Map view.

How to search by a user's current location

Users can type in the location they want to search or their current location. Searching by current location starts by clicking in the search bar. After clicking "Current location," users must give your website permission to access the browser's location. Giving permission automatically populates the search bar with their current location and initiates the search.

How to use location and keyword search together

If your marketplace uses location search, you can choose to display a "keyword" filter on its search page. Learn more about configuring your search settings.

How to limit search to a particular or specific location

You can build an experience where location search is limited to only a particular location, like a city or state. This is done by limiting the search options for users by directing them to search pages with the desired location already applied as a filter.

The key mechanism is that search parameters are stored in the search page URL.
A location is one example of such a parameter. When you search by location, your browser’s address bar updates to include the coordinates and bounds of that area.
Opening the same URL again will always display search results for that specific location.

Let’s say you are launching in Finland’s capital region, which is made up of two main cities: Helsinki and Espoo. You want users to search only in Helsinki or Espoo.

Searching for Helsinki generates the following search results page URL: /s?address=Helsinki%2C%20Uusimaa%2C%20Finland&bounds=60.297839%2C25.33773%2C60.061968%2C24.807446

Searching for Espoo generates the following search results page URL: /s?address=Espoo%2C%20Uusimaa%2C%20Finland&bounds=60.363153%2C24.850832%2C60.036433%2C24.476187

With these URLs in hand, you can start adding CTA buttons that open up to search results page for Helsinki or Espoo only. Placing these buttons in common pages lets you shape the experience to direct people to only search for listings in your target areas. One place you’ll likely want to create such buttons is on your landing page. Here is how to create a button to point to a specific search results page:

  • In a section or content block, create an internal link button

  • Fill the button text

  • Paste the search results page URL: /s?address…

You can also create clickable links using markdown to similarly direct a user’s search behavior.

  • In a content block, fill in block text

  • Use Markdown to hyperlink the text. Use the search page URL inside the parentheses)

  • For example: [Helsinki](/s?address…)

Even if you set up location-specific search pages, users can still, enter any location supported by your map provider (Google Maps or Mapbox), and move or zoom the map to view other areas. Because of this, you can’t completely restrict searches to your selected areas if location search and/or map view are enabled. If you want to fully prevent users from changing the location, consider the following approaches:

  • Build specific search pages for your desired locations.

  • Disable location search in your marketplace settings.

  • Enable keyword search instead.

Did this answer your question?