---
title: Geographical distance facets
slug: cms-12/docs/geographical-distance-facets
docTags: 
createdAt: 2026-08-10T15:55:59.000Z
---

Geographic distance facets group documents with a `GeoLocation` type property by distance from a location. Geographical distance facets are requested and extracted from search results with the `GeoDistanceFacetFor` method.

Geographic distance facets need several ranges to group documents. Use the `NumericRange` class to do this.

Assume you indexed several restaurants as an instance of this class:

```csharp
using EPiServer.Find;

public class Restaurant {
  public string Name {
    get;
    set;
  }
  public GeoLocation Location {
    get;
    set;
  }
}
```

Request the number of restaurants within 1, 5, and 10 kilometers of a location with the `GeoDistanceFacetFor` method, as shown below.

```csharp
var sergelsTorg = new GeoLocation(59.33265, 18.06468)
var ranges = new List<NumericRange> {
  new NumericRange {
    From = 0, To = 1
  },
  new NumericRange {
    From = 0, To = 5
  },
  new NumericRange {
    From = 0, To = 10
  }
};

result = client.Search<WithCoordinates>()
  .GeoDistanceFacetFor(x => x.Location, sergelsTorg, ranges.ToArray())
  .GetResult();
```

To extract the facet from the results variable, use the `GeoDistanceFor` method (same name as the method used to retrieve facets). The `GeoDistanceFor` method returns an instance of the `GeoDistanceFacet` class, which contains an instance of the `GeoDistanceRangeResult` per requested range.

```csharp
facet = result.GeoDistanceFacetFor(x => x.Location);

foreach(var range in facet) {
  Console.WriteLine("There are " + range.TotalCount +
    " restaurants within " +
    range.To +
    " of Sergels Torg");
}
```
