> Explore Qdrant's agent skills catalog at https://skills.qdrant.tech/
> Search the documentation at https://search.qdrant.tech/md/documentation?q=your+query+here
> Use this file for an index of the main pages: https://qdrant.tech/llms.txt
> Content inside `<only-applies-to>` tags applies only to the named products, or only as of the named version, and never to products it says it does not apply to. All other content applies to every Qdrant product. If you know which product the user is on, ignore tagged content for other products.


# Geo-Filtered Vector Search

Combine vector similarity with radius, bounding box, and polygon filters in one query, and see why a geo filter needs more than a filter on top of a vector index.

- [Try the demo](#demo)
- [Read the Geo Search docs](https://qdrant.tech/documentation/search/geo-search/index.md)



**Query with a geo filter**

- Meaning: “quiet café to work from”
- Location: 1.5 km around central Berlin



```python
from qdrant_client import QdrantClient, models

results = client.query_points(
    collection_name="venues",
    query=models.Document(
        text="quiet café to work from",
        model="sentence-transformers/all-minilm-l6-v2",
    ),
    query_filter=models.Filter(
        must=[
            models.FieldCondition(
                key="location",
                geo_radius=models.GeoRadius(
                    center=models.GeoPoint(
                        lon=13.403683,
                        lat=52.520711,
                    ),
                    radius=1500.0,
                ),
            )
        ]
    ),
    limit=5,
)
```

> This snippet is also available in Typescript, Rust, Java, Csharp, Go, and Http. See the [full snippet](https://qdrant.tech/documentation/snippets/geo-search/semantic-query/index.md).






## Two Kinds of “Near” in One Query

Every venue has a place on the map and a place in embedding space, and the two are unrelated. Drag the circle on the map to see how many of the true 10 best matches each approach finds. Select an approach to see its results.



![A map of venues with a circular search area next to the same venues placed by meaning, and three search approaches compared by how many of the 10 best matches each one finds.](/docs/geo-search-tutorial-lab.png)

A simplified simulation with sample data that runs in your browser. It shows how each approach behaves, not benchmark numbers.



## Why a Geo Filter Is Not Just a Filter

Vector indexes are built to find neighbors in meaning. Location is a second, independent space, and its density varies widely.

[Filtering in Vector Search (article)](https://qdrant.tech/articles/vector-search-filtering/index.md)





### Near on the Map Is Not Near in Meaning



Of the 10 best matches for “quiet café to work from” across the whole city, only 1 is within 1.5 km of central Berlin. If you search first and filter afterward, most of the results disappear.



### The Same Radius Is a Different Filter Every Time



In the demo, a 1 km circle in the city center holds 37 venues, and the same circle in Spandau holds 1. A geo filter can match a handful of points or most of the dataset, so no single fixed strategy works for both.



### Filters Cut the Search Graph Into Islands



HNSW finds neighbors by walking a graph. Keep only the 70 venues within 1.5 km of the city center and the demo's graph splits into 48 disconnected pieces, so the walk stops before it reaches the real best matches.





**One query, two spaces.** A geo-aware index has to handle meaning and location together, so you never trade accuracy for a smaller search area.







## Extra Links Inside Each Area







A strict filter can leave the search graph in disconnected pieces, so a filtered search misses good matches. To prevent this, Qdrant adds extra links to the graph, and a geo index does the same.

**What Qdrant does.** When it builds the index, Qdrant adds links between venues that are close on the map, for each indexed payload field.

**What it means.** A geo filter no longer leaves islands, so the search walk reaches the real best matches. The geo index has to exist before you ingest data, or Qdrant cannot add the links.







![Two copies of the same search area. With regular links only, the venues inside the area form separate groups. With extra links added, the groups are connected.](/docs/geo-search-tutorial-extra-links.svg)









## Step 1: Create the Collection and the Geo Index

This tutorial uses [Cloud Inference](https://qdrant.tech/documentation/inference/index.md) to create the embeddings, so it runs against a Qdrant Cloud cluster. Refer to the [Cloud Quickstart](https://qdrant.tech/documentation/cloud-quickstart/index.md) to create one. First, create a collection for the venues. The vector size of 384 matches the embedding model.



```python
from qdrant_client import QdrantClient, models

client.create_collection(
    collection_name="venues",
    vectors_config=models.VectorParams(size=384, distance=models.Distance.COSINE),
)
```

> This snippet is also available in Typescript, Rust, Java, Csharp, Go, and Http. See the [full snippet](https://qdrant.tech/documentation/snippets/geo-search/create-collection/index.md).


Then create a `geo` payload index on the `location` field, right after you create the collection and before you upload points. Qdrant can then build the vector index with geo-aware links from the start.

```python
from qdrant_client import QdrantClient, models

client.create_payload_index(
    collection_name="venues",
    field_name="location",
    field_schema=models.PayloadSchemaType.GEO,
)
```

> This snippet is also available in Typescript, Rust, Java, Csharp, Go, and Http. See the [full snippet](https://qdrant.tech/documentation/snippets/geo-search/create-geo-index/index.md).




## Step 2: Upload Venues With Locations

Upload ten sample venues. Each venue is a point with a name, a description, and a `location` object with `lat` and `lon` in decimal degrees. Cloud Inference creates the vector from the description, so you pass the text and the model name instead of a vector.



```python
from qdrant_client import QdrantClient, models

# name, description, latitude, longitude
venues = [
    ("Kaffeehaus Linden", "Quiet café with long tables and free Wi-Fi", 52.5236, 13.3989),
    ("Roastery 12", "Specialty roastery with a calm back room", 52.5189, 13.4102),
    ("Spree Books & Coffee", "Bookstore café with armchairs and tea", 52.5254, 13.4113),
    ("Atelier Coworking", "Coworking space with silent rooms", 52.5298, 13.3984),
    ("Ramen Ichi", "Small ramen bar with counter seating", 52.5222, 13.392),
    ("Club Nachtschicht", "Loud techno club open until sunrise", 52.516, 13.4185),
    ("Skyline Bar", "Rooftop bar with cocktails and live DJs", 52.5232, 13.416),
    ("Kreuzberg Corner Café", "Cozy café with strong espresso and cake", 52.4985, 13.403),
    ("Café Tempelhof", "Spacious café, quiet in the mornings", 52.473, 13.4034),
    ("Charlottenburg Tea House", "Calm tea house with a garden terrace", 52.516, 13.304),
]

client.upsert(
    collection_name="venues",
    points=[
        models.PointStruct(
            id=i,
            vector=models.Document(text=description, model="sentence-transformers/all-minilm-l6-v2"),
            payload={
                "name": name,
                "description": description,
                "location": {"lat": lat, "lon": lon},
            },
        )
        for i, (name, description, lat, lon) in enumerate(venues)
    ],
)
```

> This snippet is also available in Typescript, Rust, Java, Csharp, Go, and Http. See the [full snippet](https://qdrant.tech/documentation/snippets/geo-search/upload-venues/index.md).


For a venue with several locations, use a list of these objects. The point matches a geo filter when at least one location satisfies the condition.



## Choose a Shape

Qdrant lets you filter by different shapes: a radius, a bounding box, or a polygon. Each one is a regular filter condition, so you can combine it with keyword, range, full-text, and other payload conditions in the same request. The cards show each condition as JSON.





### Radius



Use it for “within a 15-minute walk of me”. The radius is in meters.



![A circle around a center point, with a dashed line marking the radius.](/docs/geo-search-tutorial-shape-radius.svg)



```json
{
  "key": "location",
  "geo_radius": {
    "center": {
      "lon": 13.403683,
      "lat": 52.520711
    },
    "radius": 1500.0
  }
}
```




### Bounding Box



Use it for whatever is visible on the user's map right now.



![A rectangle with two opposite corners marked.](/docs/geo-search-tutorial-shape-bounding-box.svg)



```json
{
  "key": "location",
  "geo_bounding_box": {
    "top_left": {
      "lon": 13.37,
      "lat": 52.53
    },
    "bottom_right": {
      "lon": 13.44,
      "lat": 52.50
    }
  }
}
```




### Polygon



Use it for delivery zones, districts, or a city minus its airport. Holes are supported.



![A polygon with a smaller interior shape cut out of it.](/docs/geo-search-tutorial-shape-polygon.svg)



```json
{
  "key": "location",
  "geo_polygon": {
    "exterior": {
      "points": [
        { "lon": 13.37, "lat": 52.53 },
        { "lon": 13.44, "lat": 52.53 },
        { "lon": 13.44, "lat": 52.50 },
        { "lon": 13.37, "lat": 52.50 },
        { "lon": 13.37, "lat": 52.53 }
      ]
    }
  }
}
```








## A Plan for Every Query







A geo filter can match a handful of points or most of the dataset, and no single search strategy suits both.

**What Qdrant does.** The query planner estimates how many points match the filter, using the payload index. With few matches, it checks each one exactly. With many, it walks the graph and applies the filter during the walk.

**What it means.** You write the same filter either way, from a single block to a whole region. The collection's `full_scan_threshold` sets where the planner switches.







![Few matching venues are checked one by one. With many matching venues, the search walks the graph.](/docs/geo-search-tutorial-query-planner.svg)









## Step 3: Filter by Location

Send meaning and location in one request. The query ranks venues by meaning, and a geo filter keeps only the venues inside a shape.



```python
from qdrant_client import QdrantClient, models

results = client.query_points(
    collection_name="venues",
    query=models.Document(
        text="quiet café to work from",
        model="sentence-transformers/all-minilm-l6-v2",
    ),
    query_filter=models.Filter(
        must=[
            models.FieldCondition(
                key="location",
                geo_radius=models.GeoRadius(
                    center=models.GeoPoint(
                        lon=13.403683,
                        lat=52.520711,
                    ),
                    radius=1500.0,
                ),
            )
        ]
    ),
    limit=5,
)
```

> This snippet is also available in Typescript, Rust, Java, Csharp, Go, and Http. See the [full snippet](https://qdrant.tech/documentation/snippets/geo-search/semantic-query/index.md).


The example uses a radius. To filter by a bounding box or a polygon instead, replace the `geo_radius` condition with a `geo_bounding_box` or `geo_polygon` condition, as shown in Choose a Shape.



## Tune It if You Need To



The defaults work for most collections. Two HNSW settings matter for geo filters:

- `full_scan_threshold` sets where the planner switches from graph search to an exact search over the matching points.
- `payload_m` sets how many extra links the index adds for each payload field.

Refer to [Vector Index](https://qdrant.tech/documentation/manage-data/indexing/index.md#vector-index) for both.



## Keep Going

The Geo Search docs cover every shape, distance-based ranking, and how to combine filters and formulas.





### Geo Search



The reference for geo filters, `geo_distance` scoring, and combining filtering with ranking. [Read the Geo Search docs](https://qdrant.tech/documentation/search/geo-search/index.md).



### Filtering



Combine a geo condition with `must`, `should`, and `must_not` clauses and conditions on other payload fields. [Read the Filtering docs](https://qdrant.tech/documentation/search/filtering/index.md).



### How Filtered Search Works



A deeper look at why filters break vector search and how filterable HNSW fixes it. [Read the article](https://qdrant.tech/articles/vector-search-filtering/index.md).






