Solved

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

Posted on 2009-05-06
17
1,297 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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Geomentry-Fundamental concepts 6 66
Odds of picking games correctly 4 90
Honda Vezel hybrid vs Honda Shuttle hybrid 2 171
Automatic Email Reminder 4 38
Introduction This article is designed to assist GIS (Geographic Information System) and GPS (Global Positioning System) developers using ESRI ArcGIS and other spatial information management systems.   For the uninitiated the concept of projectio…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

803 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