# Set and Drift API
> Current-sailing (set and drift) navigation maths as an API, computed locally and deterministically — the course-over-ground, course-to-steer and current numbers a mariner, navigator or marine app plots a passage with. The course-made-good endpoint adds the boat's velocity through the water to the current vector to give the real track: the course over ground (COG) and speed over ground (SOG), with the drift angle the current pushes you off your nose — steering 090° through the water at 10 knots with a 2-knot current setting north comes out around 079° over the ground at 10.2 knots. The course-to-steer endpoint solves the other way: the heading to steer to make good a desired ground track, steering up-current to cancel the across-track set (sin(H−T) = −drift·sin(set−track) ÷ speed), and the resulting SOG — usually slower into a current, faster with it astern, and impossible if the current across the track beats your speed. The current endpoint finds the set and drift from the offset between a dead-reckoning position and an observed fix: the set is the bearing DR-to-fix and the drift is that distance ÷ the elapsed time, ready to carry forward. Everything is computed locally and deterministically, so it is instant and private. Ideal for marine-navigation and chartplotter apps, sailing and boating tools, and maritime-training utilities. Pure local computation — no key, no third-party service, instant. Degrees true. 3 compute endpoints. For great-circle distance use a geo-distance API; for tide times a tides API.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/setanddrift-api/..."
```

## Pricing
- **Free** (Free) — 5,450 calls/Mo, 2 req/s
- **Starter** ($13/Mo) — 54,500 calls/Mo, 6 req/s
- **Pro** ($40/Mo) — 229,500 calls/Mo, 15 req/s
- **Mega** ($122/Mo) — 1,145,000 calls/Mo, 40 req/s

## Endpoints

### Nav

#### `GET /v1/course-made-good` — Course/speed over ground

**Parameters:**
- `heading_deg` (query, required, string) — Heading through the water (°T) Example: `90`
- `speed_through_water_kt` (query, required, string) — Speed through water (knots) Example: `10`
- `set_deg` (query, required, string) — Current set — direction it flows toward (°T) Example: `0`
- `drift_kt` (query, required, string) — Current drift (knots) Example: `2`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/setanddrift-api/v1/course-made-good?heading_deg=90&speed_through_water_kt=10&set_deg=0&drift_kt=2"
```

#### `GET /v1/course-to-steer` — Heading to steer for a track

**Parameters:**
- `desired_track_deg` (query, required, string) — Desired ground track (°T) Example: `90`
- `speed_through_water_kt` (query, required, string) — Speed through water (knots) Example: `10`
- `set_deg` (query, required, string) — Current set (°T) Example: `0`
- `drift_kt` (query, required, string) — Current drift (knots) Example: `2`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/setanddrift-api/v1/course-to-steer?desired_track_deg=90&speed_through_water_kt=10&set_deg=0&drift_kt=2"
```

#### `GET /v1/current` — Set & drift from a DR-to-fix offset

**Parameters:**
- `dr_to_fix_bearing_deg` (query, required, string) — Bearing DR → fix (°T) Example: `45`
- `dr_to_fix_distance_nm` (query, required, string) — Distance DR → fix (nm) Example: `3`
- `elapsed_hours` (query, required, string) — Elapsed time (hours) Example: `2`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/setanddrift-api/v1/current?dr_to_fix_bearing_deg=45&dr_to_fix_distance_nm=3&elapsed_hours=2"
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/setanddrift-api/v1/meta"
```


---
Marketplace page: https://www.oanor.com/api/setanddrift-api
OpenAPI spec: https://www.oanor.com/api/setanddrift-api/openapi.json
