Geolocation Utilities

Sun Position

Calculates the sun's azimuth and elevation angles for any location and time. Use via MCP in Cursor or Windsurf for solar panel optimization, photography planning, or astronomical calculations. Returns precise angular measurements — azimuth from north (0-360°) and elevation above horizon (-90 to 90°). Essential for solar energy applications and time-dependent geospatial analysis.

API Endpoint

GET /v1/geo/sun-position

Code Examples

curl "https://tinyfn.io/v1/geo/sun-position" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/geo/sun-position', {
  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/sun-position',
    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

What coordinate system does sun position use for azimuth and elevation?

Azimuth is measured clockwise from true north (0-360°), elevation is angle above horizon (-90° to 90°). Negative elevation means sun is below horizon.

How can MCP agents use sun position for solar panel calculations?

AI agents can optimize panel angles by calculating sun position throughout the day, determining peak solar hours, and estimating energy output based on elevation angles.

What timezone handling does the sun position API use?

Accepts UTC timestamps or local time with timezone offset. Always specify timezone to avoid calculation errors, especially near sunrise/sunset.

How accurate is the sun position calculation compared to astronomical data?

Provides approximate positions suitable for most applications. For precision astronomy or navigation, use dedicated ephemeris data sources.

Can I calculate sun position for historical dates or future predictions?

Yes, works for any date/time combination. Useful for historical solar irradiance analysis or planning future solar installations.

Try Sun Position Now

Get your free API key and start using Sun Position in seconds.

Get Free API Key