Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Sun and Moon Position in Lat/Lon from Date/time VB6 - Continue

Posted on 2009-05-06
17
Medium Priority
?
1,346 Views
Last Modified: 2012-06-21
This is a continue from http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_24363977.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: http://www.experts-exchange.com/Programming/Languages/CPP/Q_23501542.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
"
0
Comment
Question by:iscode
  • 8
  • 6
  • 2
  • +1
17 Comments
 
LVL 46

Expert Comment

by:tbsgadi
ID: 24323107
Have a look here for VBA code (which is the same as VB6)

Good Luck,

Gary
0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 24323108
0
 
LVL 6

Author Comment

by:iscode
ID: 24323938
Hi tbsgadi
I allready had those formulas as I had traced this link from bodas.org but thanks anyway
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 46

Expert Comment

by:tbsgadi
ID: 24323956
Don't they give you what you want?
0
 
LVL 6

Author Comment

by:iscode
ID: 24324219
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
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_24363977.html
We had solved that for the sun but not for the moon
0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 24324262
Does this get you any closer?
http://www.stargazing.net/kepler/sunrise.html
0
 
LVL 6

Author Comment

by:iscode
ID: 24324357
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
0
 
LVL 6

Accepted Solution

by:
iscode earned 0 total points
ID: 24325462
OK I think I found my answer
as I already have RA in moon position I should get gha from this link
http://www.jgiesen.de/elevazmoon/basics/index.htm
Just need to check it out
0
 
LVL 6

Author Comment

by:iscode
ID: 24326484
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-2451545.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

0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 24326517
Great!
0
 
LVL 6

Author Comment

by:iscode
ID: 24327017
Now how do I close the question without delete it?
0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 24327561
Press the Request Attention
0
 
LVL 18

Expert Comment

by:mdougan
ID: 24328240
That was fast!  Congratulations!
0
 
LVL 6

Author Comment

by:iscode
ID: 24328742
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?
0
 
LVL 18

Expert Comment

by:mdougan
ID: 24328861
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!
0
 
LVL 6

Author Comment

by:iscode
ID: 24329685
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.
0
 

Expert Comment

by:Johnny
ID: 26181719
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

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Aerodynamic noise is the cause of the majority of the noise produced by helicopters. The inordinate amount of noise helicopters produce is a major problem in the both a military and civilian setting. To remedy this problem the use of an aerogel coat…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question