# Geo initial bearing

`geo-initial-bearing` · version 1.0.0 · Geometry, location & color · free, no key needed

Compute the initial spherical bearing from point A to point B and return degrees clockwise from true north.

**Use when you need to: bearing from point A to point B in degrees · initial bearing between coordinates · calculate compass heading between GPS points.**

## Decide before calling

Read the [versioned contract](/v1/tools/geo-initial-bearing/versions/1.0.0) and the supported scope below. Reuse `geo-initial-bearing@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `geo-initial-bearing@1.0.0` for bearing from point A to point B in degrees. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- bearing from point A to point B in degrees
- initial bearing between coordinates
- calculate compass heading between GPS points
- forward azimuth from latitude longitude
- direction from one coordinate to another
- great circle starting bearing

## Not supported

- final bearing at destination
- magnetic compass bearing

## Behavior

- Uses the spherical great-circle model, not a Karney or Vincenty ellipsoidal geodesic; Earth-model error is typically up to about 0.5%.
- Angles are decimal degrees; bearings are clockwise from true north and results are rounded to 12 decimal places.
- Initial bearing is radius-independent; no Earth-radius input is accepted.

## Input

- `lat1_deg` (number, required): min -90; max 90
- `lon1_deg` (number, required): min -180; max 180
- `lat2_deg` (number, required): min -90; max 90
- `lon2_deg` (number, required): min -180; max 180
- `precision_decimals` (number, optional): min 0; max 12

## Output

- `initial_bearing_deg` (number, required): min 0
- `standard_version` (constant "Sinnott-1984/IUGG-GRS80", required)

## Limits

- max input bytes: 512
- max output bytes: 256
- max items: 7
- max iterations: 1

## Example

Request input:

```json
{
  "lat1_deg": 0,
  "lon1_deg": 0,
  "lat2_deg": 0,
  "lon2_deg": 90
}
```

Response:

```json
{
  "result": {
    "initial_bearing_deg": 90,
    "standard_version": "Sinnott-1984/IUGG-GRS80"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "geo-initial-bearing",
  "version": "1.0.0",
  "input": {
    "lat1_deg": 0,
    "lon1_deg": 0,
    "lat2_deg": 0,
    "lon2_deg": 90
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/geo-initial-bearing/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"lat1_deg":0,"lon1_deg":0,"lat2_deg":0,"lon2_deg":90}'
```

The machine-readable contract is at [/v1/tools/geo-initial-bearing/versions/1.0.0](/v1/tools/geo-initial-bearing/versions/1.0.0).

### CLI

```sh
node cli.mjs run geo-initial-bearing 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Geo destination point](/tools/geo-destination-point): Compute the spherical destination from a start point, initial bearing, and distance; return latitude and longitude.
- [Geo haversine distance](/tools/geo-haversine-distance): Compute the spherical great-circle distance between two latitude/longitude points and return it in the requested unit.
- [Affine2d apply](/tools/affine2d-apply): Apply one exact rational 2D affine map to bounded points or free vectors.
- [Color contrast wcag](/tools/color-contrast-wcag): Compute WCAG 2.x relative luminance, contrast ratio, and AA/AAA pass flags for two opaque sRGB colors.
- [Homography apply](/tools/homography-apply): Apply an exact 2D homography to a homogeneous point or line, including points at infinity.
- [Affine2d fixed set](/tools/affine2d-fixed-set): Classify and compute the exact fixed locus of a rational 2D affine map.
