Observer location

Calculating local horizontal coordinates with respect to an observer

To calculate local horizontal coordinates (topocentric) for an observer located at an arbitrary location on (or above) the Earth's surface, include a suitable value for the obs query parameter:

 axios({
	"method": "GET",
	"url": "https://api.radiantdrift.com/body-position/DATE_TIME_FROM",
 	"params": {
		"body": "[BODIES]",
		"obs": "LAT,LNG,HEIGHT"
	},
})
curl "https://api.radiantdrift.com/body-position/DATE_TIME_FROM/?obs=LAT,LNG,HEIGHT&body=BODIES"

LAT is the observer latitude in decimal degrees and LNG is the longitude (negative west). HEIGHT is the observer elevation above mean sea level, given in meters. If no elevation value is available, use zero (0m).

Example

The following query calculates the position of the Moon for March 21 2025 at 13:04:30 UTC as observed in Boulder, Colorado, USA:

GET https://api.radiantdrift.com/body-position/2025-03-21T13:04:30Z/?obs=40.009728,-105.237709,1612&body=moon

A localHorizontal object is included in the response, giving true and apparent azimuth/altitude coordinates for the observer, together with parallax and the effect of estimated refraction.

{
  "query": {
    "name": "body-position",
    "start-date": "2025-03-21T13:04:30.000Z",
    "obs": {
      "lat": 40.009728,
      "lng": -105.237709,
      "height": 1612
    },
    "alg": "standard",
    "high-accuracy": false,
    "body": [
      "moon"
    ],
    "ra-decl": null,
    "extras": [],
    "interval": 60
  },
  "response": {
    "2025-03-21T13:04:30.000Z": {
      "moon": {
        "dateTD": "2025-03-21T13:05:39.073Z",
        "jde": 2460756.04559112,
        "eclipticCoordinates": {
          "λ": 260.52729877,
          "β": -5.25429849
        },
        "geocentricSphericalCoordinates": {
          "λ": 260.52729877,
          "β": -5.25429849,
          "Δ": 398136.53563773
        },
        "apparentCoordinates": {
          "ra": -100.73114387,
          "decl": -28.34079256
        },
        "apparentLongitude": 260.52750373,
        "obliquityOfEcliptic": 23.43866925,
        "radiusVector": 13135.97563773,
        "nutationInLongitude": 0.00020496,
        "nutationInObliquity": 0.00265718,
        "equatorialHorizontalParallax": 0.91791617,
        "meanElongation": 267.39595465,
        "meanAnomalySun": 75.93822925,
        "meanAnomalyMoon": 237.2096644,
        "argOfLatitude": 269.42006603,
        "localHorizontal": {
          "true": {
            "azimuth": 190.28208172,
            "altitude": 20.04241573
          },
          "apparent": {
            "azimuth": 190.28208172,
            "altitude": 20.08140602
          },
          "parallax": {
            "azimuth": 0,
            "altitude": 0.85634116
          },
          "refraction": 0.0389903
        }
      }
    }
  }
}

The effect of atmospheric refraction is generally to increase the altitude of the body for the observer, as seen in the example above. The effect is more pronounced near the horizon.

Last updated