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

# ST_DWithin

Tests whether two geographies are within a given geodesic distance (in meters) of each other on the sphere. The minimum great-circle distance between any two points on the two geographies is compared against the threshold; the test is inclusive (returns true when the minimum distance equals the threshold).

<img src="https://mintcdn.com/wherobots/rE_Ak061k3dknbDZ/images/sql-functions/ST_DWithin_geography/ST_DWithin_geography_true.svg?fit=max&auto=format&n=rE_Ak061k3dknbDZ&q=85&s=72ce3f321d58195ebd77fafedfc46230" alt="ST_DWithin returning true" width="500" height="300" data-path="images/sql-functions/ST_DWithin_geography/ST_DWithin_geography_true.svg" />

<img src="https://mintcdn.com/wherobots/rE_Ak061k3dknbDZ/images/sql-functions/ST_DWithin_geography/ST_DWithin_geography_false.svg?fit=max&auto=format&n=rE_Ak061k3dknbDZ&q=85&s=a73199f9f1ad97564a688884291feeec" alt="ST_DWithin returning false" width="500" height="300" data-path="images/sql-functions/ST_DWithin_geography/ST_DWithin_geography_false.svg" />

## Signatures

```sql theme={"system"}
ST_DWithin (A: Geography, B: Geography, distance: Double)
```

## Parameters

<ParamField body="A" type="Geography" required>
  The first geography.
</ParamField>

<ParamField body="B" type="Geography" required>
  The second geography.
</ParamField>

<ParamField body="distance" type="Double" required>
  The maximum geodesic distance, in meters.
</ParamField>

## Return type

<ResponseField type="Boolean">
  `true` if A and B are within `distance` meters of each other.
</ResponseField>

## Example

```sql theme={"system"}
SELECT ST_DWithin(
  ST_GeogFromWKT('POINT (0 0)', 4326),
  ST_GeogFromWKT('POINT (0 1)', 4326),
  200000.0
);
```

```
true
```

The same pair of points with a tighter threshold:

```sql theme={"system"}
SELECT ST_DWithin(
  ST_GeogFromWKT('POINT (0 0)', 4326),
  ST_GeogFromWKT('POINT (0 1)', 4326),
  100000.0
);
```

```
false
```
