Skip to content
  • There are no suggestions because the search field is empty.

Udaya Lagna Calculator Direct

<!-- Astronomical library for precise planetary positions --> <script src="https://cdn.jsdelivr.net/npm/astronomia@4.0.2/astronomia.min.js"></script> <script> // Wait for library + DOM window.addEventListener('DOMContentLoaded', () => // Helper: Geocode city using OpenStreetMap Nominatim (free, no key) async function geocodeCity(city) if (!city.trim()) return null; try const resp = await fetch( https://nominatim.openstreetmap.org/search?q=$encodeURIComponent(city)&format=json&limit=1 ); const data = await resp.json(); if (data && data.length) return lat: parseFloat(data[0].lat), lon: parseFloat(data[0].lon) ;

// Update lat/lon fields when city changes const cityInput = document.getElementById('cityName'); const latField = document.getElementById('lat'); const lonField = document.getElementById('lon'); let currentCoords = null; Udaya Lagna Calculator

catch(e) console.warn(e); return null;

// Compute ascendant using astronomia function computeAscendant(jd, lat, lon) // Get local sidereal time (LMST) const gmst = astronomia.siderealTime(jd); const lst = (gmst + lon / 15) % 24; // lon in degrees -> hours const ramc = lst * 15; // Right ascension of MC in degrees // formula for ascendant: tan(A) = sin(Θ) / (cos(Θ) sin(ε) + tan(φ) cos(ε)) // epsilon (obliquity) const epsilon = astronomia.obliquity(jd) * Math.PI/180; const latRad = lat * Math.PI/180; const ramcRad = ramc * Math.PI/180; const sinTheta = Math.sin(ramcRad); const cosTheta = Math.cos(ramcRad); const tanPhi = Math.tan(latRad); let numerator = sinTheta; let denominator = cosTheta * Math.sin(epsilon) + tanPhi * Math.cos(epsilon); let A = Math.atan2(numerator, denominator); let asc = A * 180 / Math.PI; if (asc < 0) asc += 360; // Ensure quadrant: ascendant should be in same quadrant as ramc + 90° let ramcQuadrant = Math.floor(ramc / 90) % 4; let ascQuadrant = Math.floor(asc / 90) % 4; while (ascQuadrant !== ramcQuadrant) asc += 90; if (asc >= 360) asc -= 360; ascQuadrant = Math.floor(asc / 90) % 4; return asc; const data = await resp.json()

// Convert tropical ecliptic longitude to sidereal nirayana function tropicalToSidereal(tropicalLon, jd) let ayan = getLahiriAyanamsha(jd); let sidereal = tropicalLon - ayan; sidereal = ((sidereal % 360) + 360) % 360; return sidereal; const latField = document.getElementById('lat')

cityInput.addEventListener('change', async () => const city = cityInput.value; if (city) const coords = await geocodeCity(city); if (coords) currentCoords = coords; latField.value = coords.lat.toFixed(4); lonField.value = coords.lon.toFixed(4); else latField.value = "Not found"; lonField.value = "Not found"; currentCoords = null; );