# Nearest stations

> Find the SNOTEL stations nearest a latitude and longitude, or nearest another station, ranked by great-circle distance, with limit and radius filters.

`GET /api/v1/stations/nearest` ranks stations by distance from a point.

| Parameter  | Meaning                                                            |
| ---------- | ------------------------------------------------------------------ |
| `lat`      | Latitude in degrees north, -90 to 90. Required.                    |
| `lng`      | Longitude in degrees east, -180 to 180. Required.                  |
| `limit`    | Stations to return, 1 to 25. Default 5.                            |
| `radiusKm` | Only stations within this distance, up to 500. Default 500.        |
| `network`  | Network code. Default `SNTL`.                                      |
| `active`   | `true` (default) for active stations only, `false` to include all. |
| `provider` | Which provider's stations to rank, by code. Default `nrcs`.        |

```bash
curl 'https://opensnotel.com/api/v1/stations/nearest?lat=44.31&lng=-115.2&limit=1'
```

```json
{
  "data": [
    {
      "station": {
        "id": "312:ID:SNTL",
        "name": "Banner Summit",
        "stateCode": "ID",
        "networkCode": "SNTL",
        "latitude": 44.30342,
        "longitude": -115.23447,
        "elevationFt": 7040,
        "utcOffsetMinutes": -480,
        "isActive": true,
        "periodOfRecord": { "start": "1979-10-01", "end": null }
      },
      "distanceKm": 2.839
    }
  ],
  "query": { "lat": 44.31, "lng": -115.2, "limit": 1, "radiusKm": 500 },
  "meta": { "generatedAt": "2026-10-23T21:20:00.000Z" }
}
```

## Near a station

`GET /api/v1/stations/{station}/nearby` ranks the stations around a station you already have, so you don't need its coordinates. It returns active SNTL stations in any state, never the station itself, each with its `distanceKm` from it.

| Parameter  | Meaning                                                     |
| ---------- | ----------------------------------------------------------- |
| `limit`    | Stations to return, 1 to 25. Default 5.                     |
| `radiusKm` | Only stations within this distance, up to 500. Default 500. |

```bash
curl 'https://opensnotel.com/api/v1/stations/312:ID:SNTL/nearby?limit=1&radiusKm=80'
```

```json
{
  "station": "312:ID:SNTL",
  "data": [
    {
      "station": {
        "id": "550:ID:SNTL",
        "name": "Jackson Peak",
        "stateCode": "ID",
        "networkCode": "SNTL",
        "latitude": 44.05092,
        "longitude": -115.44322,
        "elevationFt": 7060,
        "utcOffsetMinutes": -480,
        "isActive": true,
        "periodOfRecord": { "start": "1979-10-01", "end": null }
      },
      "distanceKm": 32.641
    }
  ],
  "query": { "limit": 1, "radiusKm": 80 },
  "meta": { "generatedAt": "2026-10-23T21:20:00.000Z" }
}
```

`data` is empty when no station is within the radius, or when the station has no coordinates to measure from. An unknown station is a `404` (`station_not_found`). A different station at the same coordinates is a neighbor, 0 km away.

## How distance is measured

`distanceKm` is the great-circle distance in kilometres on a spherical Earth (the haversine formula), from the point you gave (or the station you named) to the station's coordinates. It is a straight line over the surface, not a travel distance and not a measure of whether the station is on the same side of a ridge. Stations without coordinates are left out.

Results are deterministic: nearest first, and stations at the same distance order by triplet. The ranking covers every station of the network, so a station never drops out because of how the catalog is paged.

Use the returned `id` with [observations](https://opensnotel.com/docs/api/observations.md) to read what each station is measuring now.

## Next

- [Observations](https://opensnotel.com/docs/api/observations.md): Get the latest reading of each sensor with a freshness verdict, or daily or hourly readings over a date range, with units, quality flags, plausibility flags, original values and revisions.
- [Stations](https://opensnotel.com/docs/api/stations.md): List or search stations by name, state or network, and get one station by its triplet: location, elevation, UTC offset, period of record and the measurements it reports.

Canonical page: https://opensnotel.com/docs/api/nearest
