Geolocation Utilities

Calculate Bearing

Calculates the compass bearing (0-360°) from one geographic coordinate to another. Use via MCP in Cursor or Windsurf for navigation calculations, or call GET /v1/geo/bearing with lat/lng pairs. Returns precise directional headings for mapping, routing, and location-based applications. Essential for GPS navigation and spatial analysis.

API Endpoint

GET /v1/geo/bearing

Code Examples

curl "https://tinyfn.io/v1/geo/bearing" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/geo/bearing', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/geo/bearing',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's geolocation tools:

{
  "mcpServers": {
    "tinyfn-geo": {
      "url": "https://tinyfn.io/mcp/geo",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How do I calculate bearing between two GPS coordinates?

Provide start and end coordinates as latitude/longitude pairs. The tool returns bearing in degrees (0-360°) where 0° is North, 90° is East, 180° is South, and 270° is West.

What's the difference between bearing and distance calculation?

Bearing gives you the compass direction (which way to head), while distance tells you how far to travel. Use both together for complete navigation between two points.

Can MCP tools like Cursor access this bearing calculator?

Yes, all MCP-compatible editors (Cursor, Claude Code, Windsurf, Cline, Zed, OpenClaw) can call this tool directly for geographic calculations in your code.

Does bearing calculation account for Earth's curvature?

Yes, it uses great circle calculations on the WGS84 ellipsoid, providing accurate bearings for any distance including intercontinental routes.

What happens with coordinates at the poles or dateline?

The calculation handles edge cases like polar coordinates and international dateline crossings correctly, returning valid bearings for all valid lat/lng inputs.

Try Calculate Bearing Now

Get your free API key and start using Calculate Bearing in seconds.

Get Free API Key