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

# Use GPS for Hyper-Local Restaurant Picks

> Grant browser location access on the recommendation page to search within 5km of where you are, not just the city centre, for more accurate results.

When you search for restaurants on NaijaTaste, the app can use your device's GPS coordinates to find spots that are actually near you — not just near the centre of your city. This matters more than it sounds: Lagos city-centre coordinates (6.52°N, 3.38°E) put the search anchor in Lagos Island, which is over 20km from somewhere like Ajah. A user in Ajah deserves Ajah results.

## Why GPS gives better results

City-name searches place the search anchor at the city's geographic centre. Depending on where you are within that city, results can be anywhere from a few kilometres away to 20km or more. GPS search anchors the search at your actual position and returns restaurants within a 5km radius of where you physically are.

For example:

* A city search for "Lagos" might return a restaurant in Ikeja when you're in Lekki.
* A GPS search from Lekki returns only spots within 5km of your exact position in Lekki.

## How to enable location

<Steps>
  <Step title="Go to the recommendation page">
    Open [/recommend](https://naijataste.onrender.com/recommend). Your browser will prompt you for location access when the page loads.
  </Step>

  <Step title="Click Allow">
    In the browser permission popup, click **Allow** (or **Allow while using the app** on mobile). The app reads your GPS coordinates once and uses them for the current search.
  </Step>

  <Step title="Confirm the location indicator">
    Check the location status indicator near the search input. A **green dot** labelled "Location ready" confirms your GPS position was captured. See [location status indicator](#location-status-indicator) below.
  </Step>

  <Step title="Run your search">
    Type your craving or fill in the form and search as normal. The backend uses your GPS coordinates to search within a 5km radius of your position.
  </Step>
</Steps>

## Location status indicator

A small dot near the search input shows the current state of your location:

| Indicator                                         | Meaning                                                                    |
| ------------------------------------------------- | -------------------------------------------------------------------------- |
| Green dot — "Location ready"                      | GPS coordinates captured; your search will use them                        |
| Animated pulsing dot — "Getting your location..." | The app is currently requesting your GPS position                          |
| No dot — "Using city from your query"             | Location was not granted or is unavailable; falling back to city detection |

## What happens when location is granted

The app sends your latitude and longitude (`user_lat` and `user_lng`) to the recommendation engine. Google Places then searches within a 5km radius of your exact coordinates. Only restaurants physically close to you appear in results.

## What happens when location is denied or unavailable

If you deny location access, dismiss the prompt, or your browser does not support geolocation, the app falls back to extracting a city name from your search text. If no city name is found in your message, it defaults to Lagos.

This fallback still works well for city-level searches — it just does not give the hyper-local accuracy that GPS provides.

<Note>
  Location data is only used to search nearby restaurants. It is never stored or shared.
</Note>

## Tips

<Tip>
  For the most accurate results, grant location access before you start typing your search. This ensures the status indicator shows "Location ready" before you send your query.
</Tip>

<Tip>
  On mobile, make sure your device has location services enabled at the system level, not just in the browser. If location capture fails, the app falls back to city-based search automatically.
</Tip>
