Udaya | Lagna Calculator

function getSignAndDegree(siderealDeg) let signIndex = Math.floor(siderealDeg / 30); let degInSign = siderealDeg - (signIndex * 30); return sign: zodiacSigns[signIndex], deg: degInSign.toFixed(2), lord: lords[signIndex] ;

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

// 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;

function getNakshatra(siderealDeg) // 27 Nakshatra each 13°20' = 13.3333333° const nakshatras = [ "Ashwini", "Bharani", "Krittika", "Rohini", "Mrigashira", "Ardra", "Punarvasu", "Pushya", "Ashlesha", "Magha", "Purva Phalguni", "Uttara Phalguni", "Hasta", "Chitra", "Swati", "Vishakha", "Anuradha", "Jyeshtha", "Mula", "Purva Ashadha", "Uttara Ashadha", "Shravana", "Dhanishtha", "Shatabhisha", "Purva Bhadrapada", "Uttara Bhadrapada", "Reverti" ]; let nakshatraLen = 360 / 27; // 13.3333333 let idx = Math.floor(siderealDeg / nakshatraLen); let startDeg = idx * nakshatraLen; let pada = Math.floor(((siderealDeg - startDeg) / (nakshatraLen / 4))) + 1; return `$nakshatras[idx] (Pada $pada)`; Udaya Lagna Calculator

// Zodiac sign name from 0° Aries (0 = Aries ... 11 = Pisces) const zodiacSigns = [ "Mesha (Aries)", "Vrishabha (Taurus)", "Mithuna (Gemini)", "Karka (Cancer)", "Simha (Leo)", "Kanya (Virgo)", "Tula (Libra)", "Vrishchika (Scorpio)", "Dhanu (Sagittarius)", "Makara (Capricorn)", "Kumbha (Aquarius)", "Meena (Pisces)" ]; const lords = ["Mars", "Venus", "Mercury", "Moon", "Sun", "Mercury", "Venus", "Mars", "Jupiter", "Saturn", "Saturn", "Jupiter"];

// 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;

<!-- 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) ; function getSignAndDegree(siderealDeg) let signIndex = Math

// 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;

// initial load demo for Mumbai (async () => const initCity = cityInput.value; const coords = await geocodeCity(initCity); if(coords) currentCoords = coords; latField.value = coords.lat.toFixed(4); lonField.value = coords.lon.toFixed(4); )();

This is an excellent request, as (also known as the Rising Sign or Ascendant ) is the most fundamental pillar of Vedic astrology (Jyotish). // Lahiri Ayanamsha for given JD

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; );

// Sidereal zodiac boundaries (Nirayana) - tropical sign boundaries minus ayanamsha. // Lahiri Ayanamsha for given JD. function getLahiriAyanamsha(jd) // Approx formula: 23° 26' 21.406" - t/76 ? Actually use astronomia's built-in precise calculation // astronomia has ayanamsha for sidereal positions. We'll compute directly with function. // Use astronomia's siderealTime? Better: compute tropical ascendant then subtract ayanamsha. const obliquity = astronomia.obliquity(jd); // Mean Ayanamsha formula by IAU 1976 / Lahiri: ~ 23° 26' 21.406" – (precession) but for simple we use astronomia's precession // However, astronomia's ayanamsha is not directly exposed but we can compute using mean longitude of sun - sidereal sun? Let's use built-in: // astronomia.ayanamsha() is not in this bundle, but we use: // modern lahiri = 23° 26' 21.406" - ( (JD - 2451545)/36525 * 50.290966 )/3600 approx. // More accurate: use precise precession from astronomia. const t = (jd - 2451545) / 36525; // Julian centuries since J2000 const precessionRateArcsec = 50.290966; // arcsec/year? Actually per century: 5029.0966 arcsec? no, 50.290966 arcsec/year. Let's do per tropical century: const precessionPerCenturyDeg = (5029.0966) / 3600; // in degrees per Julian century let ayan = precessionPerCenturyDeg * t; // base offset at J2000 = 23° 51' 21.406"?? No, correct Lahiri at J2000 is about 23.856° approx // We'll use standard known value: Lahiri ayanamsha for J2000 = 23° 51' 21.406" = 23.855946° const ayanJ2000 = 23.855946; let ayanamshaDeg = ayanJ2000 + precessionPerCenturyDeg * t; // but more stable: ensure we return degrees. return (ayanamshaDeg + 360) % 360;

The IBS website uses cookies. This gives us the opportunity to monitor the correct operation of the site, as well as analyze data in order to develop our products and services. By visiting the site, you agree to the processing of your personal data. In case of disagreement, you should leave it. Learn more