iscode
asked on
Sun and Moon Position in Lat/Lon from Date/time VB6 - Continue
This is a continue from https://www.experts-exchange.com/questions/24363977/Sun-and-Moon-Position-in-Lat-Lon-from-Date-time-VB6.html
Because of complex in question and length. I move it to new question so it can be readable and hopefully useful for others.
Question was:
"
I am looking for code in visual basic 6 to get sun and moon position in latitude and longitude.
I have converted the code from this link: https://www.experts-exchange.com/questions/23501542/Calculate-Sun-Position-in-Lat-Lon-from-Date-time.html?sfQueryTermInfo=1+10+posit+sun
but it is not very acurate.
Does any one have source code for both sun and moon position in visual basic 6
"
Because of complex in question and length. I move it to new question so it can be readable and hopefully useful for others.
Question was:
"
I am looking for code in visual basic 6 to get sun and moon position in latitude and longitude.
I have converted the code from this link: https://www.experts-exchange.com/questions/23501542/Calculate-Sun-Position-in-Lat-Lon-from-Date-time.html?sfQueryTermInfo=1+10+posit+sun
but it is not very acurate.
Does any one have source code for both sun and moon position in visual basic 6
"
ASKER
Hi tbsgadi
I allready had those formulas as I had traced this link from bodas.org but thanks anyway
I allready had those formulas as I had traced this link from bodas.org but thanks anyway
Don't they give you what you want?
ASKER
They give me RA= Right ascension and DEC=Declination=Latitude and distance
I need the GHA to get the longitude as we discovered in my first question
https://www.experts-exchange.com/questions/24363977/Sun-and-Moon-Position-in-Lat-Lon-from-Date-time-VB6.html
We had solved that for the sun but not for the moon
I need the GHA to get the longitude as we discovered in my first question
https://www.experts-exchange.com/questions/24363977/Sun-and-Moon-Position-in-Lat-Lon-from-Date-time-VB6.html
We had solved that for the sun but not for the moon
ASKER
I have all those too :-) and sunrise and set is not helping me with the moon location as I said sun was solved already in last question but I dont blame you for not reading all that its pretty long,
what I am after now is just moon location latitude and longitude above earth
what I am after now is just moon location latitude and longitude above earth
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes actully it works same for the moon as for the sun after I have RA
T = (JD - 2451545.0 ) / 36525;
theta0 = 280.46061837 + 360.98564736629*(JD-245154 5.0) + 0.000387933*T*T - T*T*T/38710000.0; // degrees
Local sidereal time:
theta = theta0 + longitude (eastern longitudes positive, western negative)
Hour angle: tau = theta - RA
T = (JD - 2451545.0 ) / 36525;
theta0 = 280.46061837 + 360.98564736629*(JD-245154
Local sidereal time:
theta = theta0 + longitude (eastern longitudes positive, western negative)
Hour angle: tau = theta - RA
Great!
ASKER
Now how do I close the question without delete it?
Press the Request Attention
That was fast! Congratulations!
ASKER
Thank you mdougan
Well I would never have made it with out your help in first place,
so tell me have you thought about the shadow :-)
that will be next question, are you inn?
Well I would never have made it with out your help in first place,
so tell me have you thought about the shadow :-)
that will be next question, are you inn?
Sure, I'm in! ;-)
All I've thought about the shadow, so far, is that the shadow will fall exactly along a meridian (longitude line), when the earth is perpendicular to the sun (which happens on the equinoxes). So, on the equinoxes, you would, perhaps, plot a point at every degree of latitude, along the same longitude line, and draw the line between them.
But, as the earth tilts during the course of the year, the line will be more oblique. In the summer months, for example, the shadow won't extend all the way to the North Pole... they have several months of daylight 24 hours a day. So, you will need to find some websites that detail the formulas for calculating this shadow, and I suppose that will be different for the different kinds of projections... so, if you are using a Mercator projection, then look specifically for formulas related to that. If you find a good resource, then I can help you convert it to VB!
All I've thought about the shadow, so far, is that the shadow will fall exactly along a meridian (longitude line), when the earth is perpendicular to the sun (which happens on the equinoxes). So, on the equinoxes, you would, perhaps, plot a point at every degree of latitude, along the same longitude line, and draw the line between them.
But, as the earth tilts during the course of the year, the line will be more oblique. In the summer months, for example, the shadow won't extend all the way to the North Pole... they have several months of daylight 24 hours a day. So, you will need to find some websites that detail the formulas for calculating this shadow, and I suppose that will be different for the different kinds of projections... so, if you are using a Mercator projection, then look specifically for formulas related to that. If you find a good resource, then I can help you convert it to VB!
ASKER
Good
Sound interesting enough and great tips already!
I will see what I can find useful, it can take me few days to prepare this.
Sound interesting enough and great tips already!
I will see what I can find useful, it can take me few days to prepare this.
i dont know if you found the code for the shadows but heres the math for it on your same site
http://www.jgiesen.de/map/index.html
http://www.jgiesen.de/map/index.html
Good Luck,
Gary