Sky Map Now for Sun, Moon and 5 Planets
Please select a city near you to see Sky Map Now.
Select a City
Anchorage
Bangkok
Cairo
Calcutta
Chicago
Denver
Hong Kong
Honolulu
London
Los Angeles
Mexico City
Moscow
New York
Paris
Rome
Saigon
Shanghai
Singapore
Taipei
Tampa
Tokyo
https://cdn.jsdelivr.net/npm/suncalc@1.9.0/suncalc.min.js
let centerDot = {
x: [], //0,-72,-64,-67,-51,-19,-60,-53],
y: [], //0, -22,6.4,-56,-73,66,30,-76],
mode: ‘markers+text’,
name: ‘Center’,
marker: { size: 7, color: ‘red’ },
text: [‘北極星(Polaris)’,’日(Sun)’,’月(Moon)’,’水星(Me)’,’金星(V)’,’火星(Ma)’,’木星(J)’,’土星(S)’],
textposition: ‘right’,
textfont: { size: 12 }
};
let dd=0.;
let xec=0;
let yec=0;
let zec=0;
let sunRA=0;
let longi=0;
let daylightSave=1;
let solarHA=0;
let lati=0;
let year1=0;
let month1=0;
let day1=0;
let hours1=0;
let minutes1=0;
let seconds1=0;
let cityName=””;
const degRad=180 / Math.PI;
// const xYear=year2;
// const xMonth=month2;
// const xDay=day2;
// const xHH=hours2; //UTC time
// const xMM=minutes2;
// const xSS=seconds2;
function getJulianDay(date) {
const year = date.getUTCFullYear();
const month = date.getUTCMonth() + 1;
const day = date.getUTCDate();
const hour = date.getUTCHours();
const minute = date.getUTCMinutes();
const second = date.getUTCSeconds();
let a = Math.floor((14 – month) / 12);
let y = year + 4800 – a;
let m = month + 12 * a – 3;
let jd = day + Math.floor((153 * m + 2) / 5) + 365 * y + Math.floor(y / 4) – Math.floor(y / 100) + Math.floor(y / 400) – 32045;
jd += (hour – 12 + minute / 60 + second / 3600) / 24;
return jd.toFixed(6);
}
function getSolarNoon() {
const citySelect = document.getElementById(‘citySelect’);
const timeDisplay = document.getElementById(‘timeDisplay’);
const city = citySelect.value;
cityName=city;
// Check if SunCalc is loaded
if (typeof SunCalc === ‘undefined’) {
timeDisplay.innerHTML = ‘Error: SunCalc library failed to load.‘;
return;
}
if (!city) {
timeDisplay.textContent = ‘Please select a city to see Sky Map Now.’;
return;
}
// City coordinates and time zone data
const cities = {
‘Anchorage’: { lat: 61.2181, lon: -149.9003, tz: ‘America/Anchorage’ },
‘Bangkok’: { lat: 13.7563, lon: 100.5018, tz: ‘Asia/Bangkok’ },
‘Cairo’: { lat: 30.0444, lon: 31.2357, tz: ‘Africa/Cairo’ },
‘Calcutta’: { lat: 22.5726, lon: 88.3639, tz: ‘Asia/Kolkata’ },
‘Chicago’: { lat: 41.8781, lon: -87.6298, tz: ‘America/Chicago’ },
‘Denver’: { lat: 39.7392, lon: -104.9903, tz: ‘America/Denver’ },
‘Hong Kong’: { lat: 22.3193, lon: 114.1694, tz: ‘Asia/Hong_Kong’ },
‘Honolulu’: { lat: 21.3069, lon: -157.8583, tz: ‘Pacific/Honolulu’ },
‘London’: { lat: 51.5074, lon: -0.1278, tz: ‘Europe/London’ },
‘Los Angeles’: { lat: 34.0522, lon: -118.2437, tz: ‘America/Los_Angeles’ },
‘Mexico City’: { lat: 19.4326, lon: -99.1332, tz: ‘America/Mexico_City’ },
‘Moscow’: { lat: 55.7558, lon: 37.6173, tz: ‘Europe/Moscow’ },
‘New York’: { lat: 40.7128, lon: -74.0060, tz: ‘America/New_York’ },
‘Paris’: { lat: 48.8566, lon: 2.3522, tz: ‘Europe/Paris’ },
‘Rome’: { lat: 41.9028, lon: 12.4964, tz: ‘Europe/Rome’ },
‘Saigon’: { lat: 10.7769, lon: 106.7009, tz: ‘Asia/Ho_Chi_Minh’ },
‘Shanghai’: { lat: 31.2304, lon: 121.4737, tz: ‘Asia/Shanghai’ },
‘Singapore’: { lat: 1.3521, lon: 103.8198, tz: ‘Asia/Singapore’ },
‘Taipei’: { lat: 25.0330, lon: 121.5654, tz: ‘Asia/Taipei’ },
‘Tampa’: { lat: 27.9506, lon: -82.4572, tz: ‘America/New_York’ },
‘Tokyo’: { lat: 35.6762, lon: 139.6503, tz: ‘Asia/Tokyo’ }
};
const { lat, lon, tz } = cities[city];
lati=lat;
// Get current date and time in the city’s time zone and UTC
const now = new Date();
const options = {
timeZone: tz,
year: ‘numeric’,
month: ‘short’,
day: ‘numeric’,
hour: ‘2-digit’,
minute: ‘2-digit’,
second: ‘2-digit’,
hour12: false
};
const currentDateTime = new Intl.DateTimeFormat(‘en-US’, options).format(now);
const utcOptions = {
timeZone: ‘UTC’,
year: ‘numeric’,
month: ‘short’,
day: ‘numeric’,
hour: ‘2-digit’,
minute: ‘2-digit’,
second: ‘2-digit’,
hour12: false
};
const utcDateTime = new Intl.DateTimeFormat(‘en-US’, utcOptions).format(now);
// Calculate Julian Day
const julianDay = getJulianDay(now);
dd=julianDay-2451543.5;
try {
// Calculate solar noon using SunCalc
const times = SunCalc.getTimes(now, lat, lon);
const solarNoon = times.solarNoon;
if (!solarNoon) {
throw new Error(‘Solar noon calculation failed.’);
}
// Format solar noon time in the city’s time zone
const solarNoonTime = new Intl.DateTimeFormat(‘en-US’, options).format(solarNoon);
// timeDisplay.innerHTML = `Current Date and Time in ${city}: ${currentDateTime} Solar Noon in ${city}: ${solarNoonTime}
UTC Date and Time: ${utcDateTime} (UTC)
Julian Day: ${julianDay}`; const parts_c = currentDateTime.split(‘,’); const [cHH, cMM,cSS] = parts_c[2].split(‘:’); //.map(Number); const parts_s = solarNoonTime.split(‘,’); const dateStr=parts_c[0]+”,”+parts_c[1]; const date1=new Date(dateStr); const [sHH, sMM,sSS] = parts_s[2].split(‘:’); solarHA=(cHH-sHH+(cMM-sMM)/60+(cSS-sSS)/3600)*15; year1=date1.getFullYear(); month1=date1.getMonth()+1; day1=date1.getDate(); hours1=cHH; minutes1=cMM; seconds1=cSS; // document.getElementById(“demo5”).innerHTML =”dd= “+dd.toFixed(2)+” current hh=” +cHH+” “+cMM+” “+sHH+” “+sMM+” HA=”+solarHA.toFixed(2); // document.getElementById(“demo2″).innerHTML =”yr1, month1 etc=”+year1+” “+month1+” “+day1+” “+hours1+” “+minutes1+” “+seconds1; // Date(currentDateTime).getHours(); } catch (error) { timeDisplay.innerHTML = `Current Date and Time in ${city}: ${currentDateTime} (${tz})
Error calculating solar noon: ${error.message}
UTC Date and Time: ${utcDateTime} (UTC)
Julian Day: ${julianDay}`; } startCalculation(); } function startCalculation() { // The five cases of side lengths const cases = [ [282.9404,4.71E-05,1,0.016709,-1.151E-09,356.047,0.985600259,23.4393,-3.563E-07,0,0,0,0], [318.0634,0.164357322,60.2666,0.0549,0,115.3654,13.06499295,23.4393,-3.563E-07,5.1454,0,125.1228,-0.052953808], [29.1241,1.01E-05,0.387098,0.205635,5.59E-10,168.6562,4.092334437,23.4393,-3.563E-07,7.0047,0.00000005,48.3313,3.24587E-05], [54.891,1.38E-05,0.72333,0.006773,-1.302E-09,48.0052,1.602130224,23.4393,-3.563E-07,3.3946,2.75E-08,76.6799,0.000024659], [286.53736,2.0094E-05,1.523688,0.093405,1.26796E-09,18.6021,0.524020777,23.4393,-3.563E-07,1.84988,-2.191E-07,49.562,-0.000008004], [273.8777,1.6451E-05,5.20256,0.048498,4.469E-09,19.895,0.0830853,23.4393,-3.563E-07,1.303,-1.557E-07,100.4542,2.76854E-05], [339.3939,2.9766E-05,9.55475,0.055546,-9.499E-09,316.967,0.033444228,23.4393,-3.563E-07,2.4886,-1.081E-07,113.6634,0.000023898] ]; const outputDiv = document.getElementById(“results”); outputDiv.innerHTML = “”; centerDot.x[0]=0; centerDot.y[0]=0; cases.forEach((params, index) => { const [w0,w1,a,e0,e1,M0,M1,ob0,ob1,i0,i1,N0,N1] = params; const result = calculateRAAndDEC(w0,w1,a,e0,e1,M0,M1,ob0,ob1,i0,i1,N0,N1); const xplusy=calculateXY(result.RA, result.DEC); // document.getElementById(“demo2″).innerHTML =”In start cal:” +index+” ;x= “+xplusy.x; centerDot.x[index+1]=xplusy.x; centerDot.y[index+1]=xplusy.y; outputDiv.innerHTML += `