Important alert: (current site time 7/16/2013 2:31:38 AM EDT)
 

winzip icon

Stars (Virtual Night Sky)

Email
Submitted on: 12/23/2006 5:39:13 AM
By: Jeremiah Hughes 
Level: Advanced
User Rating: By 26 Users
Compatibility: VB 6.0
Views: 20127
(About the author)
 
     Enter your longitude and latitude and the program will display the positions of all the stars in the sky as viewed from your location. Place the cursor over a star to get more information. Click on the picture window and press the right and left arrow keys to move one degree in that direction. Hold Shift to move five degrees and Ctrl to move a quarter degree. Obviously, there's a lot more that could be added to this program (saving your location, for example) but it works as is and I've gotten a little tired of messing with it. :) Feel free to make additions to it. Also, comments and votes are welcome. Thanks!

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 13 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
12/14/2006 9:16:09 AMTerriTop

Jeremiah, this is too cool! I love the fact that one can mouse over the, location and get the star and related data. How about the ability to load or save locations. Perhaps a Lon/Lat lookup method based on major cities...5 Stars for the nice submission!! Cheers TerriTop
(If this comment was disrespectful, please report it.)

 
12/14/2006 10:45:33 AMAaron Schulz

This is absolutely supurb! I'm amazed you could fit all that functionality into such a small piece of code.
One of the best contributions I have seen.
(If this comment was disrespectful, please report it.)

 
12/14/2006 11:18:59 AMPaul Bahlawan

That is really quite impressive! Too bad about all the weirdly named and shortened star names. Also too bad you are not working on it any more because there are sooo many features just begging to be added!
um,I noticed when comparing to Starry Night you seem to be almost 2 hours ahead (or maybe it's something else) that is altering the view a bit.
(If this comment was disrespectful, please report it.)

 
12/14/2006 11:32:15 AMJeremiah Hughes

Thanks for the nice comments. Yeah, I also noticed some of the star names were pretty weird but, unfortunately, that was the only database of stars I could find on the Internet. I'm not sure why it's two hours ahead for you. Did you adjust the time zone in addition to the latitude and longitude?
(If this comment was disrespectful, please report it.)

 
12/15/2006 6:46:16 AMRon D.

German users have to replace the Slash in Private Sub RightNow()with a ".". Otherwise they will get an error.
Great tool !
(If this comment was disrespectful, please report it.)

 
12/15/2006 7:00:42 AMben

Great. 5 stars from me!
(If this comment was disrespectful, please report it.)

 
12/15/2006 1:42:20 PMWilliam J Matthews

The values that you have (see below), because of your date format, should read
A = InStr(1, Temp, "/")
B = InStr(A + 1, Temp, "/")

Change the "/" to read "-". This will make it the same with your date format.
(If this comment was disrespectful, please report it.)

 
12/15/2006 1:59:24 PMJeremiah Hughes

I didn't realize that the date function returned different delimiters for people in different regions. I bet the order of the month, day and year varies from the standard American "MMDDYYYY" too, doesn't it? Does anyone know of an easy fix for this? Is there a way to access the current day, month and year in VB separately?
(If this comment was disrespectful, please report it.)

 
12/15/2006 2:00:29 PMGregor53

Great job! ***** from me! What about adding constellation names to this, too?
(If this comment was disrespectful, please report it.)

 
12/15/2006 2:28:27 PMRichard Mewett

Great work! Very original submission, take my *****. FYI the GetUserLocaleInfo() API can be used to determine the date seperator character used. VB also has Year(), Month() & Day() functions for extracting data from a date.
(If this comment was disrespectful, please report it.)

 
12/15/2006 2:33:09 PMJeremiah Hughes

Thanks, Richard. I've replaced all that InStr stuff with this:

Text4(0).Text = Month(Date)
Text4(1).Text = Day(Date)
Text4(2).Text = Year(Date)

Much simpler! :) That should solve all the regional date problems.
(If this comment was disrespectful, please report it.)

 
12/15/2006 6:49:41 PMAhmedQatar

5 stars for this !!!
(If this comment was disrespectful, please report it.)

 
12/16/2006 12:50:19 AMBill K of Boston

well done
5 *

(If this comment was disrespectful, please report it.)

 
12/16/2006 3:24:44 AMSteve Abbott

As this is proving so popular, if you want a new adventure then you need to add the planets and the moon. For this you need the ephemerides over some reasonable timespan. The freeware way of doing this (as you are already publishing your code) is via
http://www.astro.com/swisseph/
You can get a .dll from them and a simple .bas module which then gives you the data to do the calculation in the same way (I think!) as you do the sun.

I've programmed this stuff once for a different reason and it's quite easy and most educational. The reason I said "over some reasonable timespan" is that if you want to know planet positions for +/- 3000 years then you need a multi-MB set of ephemerides that you can also download from the same site. But for a simple program with good enough data for a few years the default settings are fine.

If you want to tackle this, drop me an email and I can help.

Steve
(If this comment was disrespectful, please report it.)

 
12/16/2006 12:36:54 PMMatt DeKok

breathtaking. EXCELLENT WORK!!!!
(If this comment was disrespectful, please report it.)

 
12/17/2006 2:09:00 AMPaul Turcksin

This application seems to be made for PC's having a particular date/time format configured. I got stuck in the RigthNow sub. Instead of extracting date/time vaues from a string, you could use the Day, Month, Year, ... functions provided in VB to make this application independent from specific PC setups.

Text4(0).Text = Month(Date)
Text4(1).Text = Day(Date)
Text4(2).Text = Year(Date)
Text3(0).Text = Hour(Now)
Text3(1).Text = Minute(Now)
Text3(2).Text = Second(Now)

Be also aware that only a small part of the world uses the AM/PM time notation.

(If this comment was disrespectful, please report it.)

 
12/17/2006 8:02:36 AMSteve Abbott

I've now got a version working that shows all the planets. Drop me an email and I'll send this version to you. Because like so much of the world I use the 24hr clock I had to get rid of all your am/pm code as it confused things greatly - but as long as you don't mix my version with yours you should be able to sort things out. The positions of the planets (including Sun and Moon) look reasonable compared to "real" software but I've not checked them carefully. "My" position of the Sun differs slightly from yours, which may well be some sort of subtle error between us.

Steve
(If this comment was disrespectful, please report it.)

 
12/17/2006 1:35:02 PMThomas Swift

A good place to start and expand would be to use the yahoo geocode lookup, just type the zipcode in. I may add it myself.LOL
(If this comment was disrespectful, please report it.)

 
12/17/2006 1:53:07 PMThomas Swift

Gilbert Az, Hello neighbor ! Apache Junction here ! Nice piece of code ! 5 Globes from me. I still say the geocode lookup would definitely be an added plus. It would give it that extra touch of accuracy. For example: http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=66949&lngWId=1
(If this comment was disrespectful, please report it.)

 
12/18/2006 12:32:28 PMSteve Abbott

My final mods have a Sunrise/Sunset detector making the sky blue during the day then fade to black as the sun sets and fades into twilight. The sunset is NOT (as I'd first thought) the time the program calculates that the sun goes beneath the horizon but the time the top of the sun disappears from view which includes refraction by the atmosphere and the size of the sun's disc. It's all good learning material.

Steve
(If this comment was disrespectful, please report it.)

 
12/22/2006 2:02:24 PMJeremiah Hughes

I've added a 24 hour mode for those of you who don't use the "AM/PM" time format. Hopefully it all works but I didn't test the mod throroughly so if there are any bugs please let me know.
(If this comment was disrespectful, please report it.)

 
12/24/2006 12:55:04 AMBrian Ail

hmm why are my stars arranged in a line, which they arent on your screenshot?
(If this comment was disrespectful, please report it.)

 
12/24/2006 1:39:46 PMJeremiah Hughes

Your stars are arranged in a line? I have no idea. :-/ Sorry
(If this comment was disrespectful, please report it.)

 
12/25/2006 12:57:58 PMBugzy

Nice project Jeremiah, very original. Five *'s.
(If this comment was disrespectful, please report it.)

 
12/25/2006 8:21:48 PMDavid M Rice

This is very fine. Thank you. I used it to search the entire night sky but I still didn't find Santa Claus, however.
(If this comment was disrespectful, please report it.)

 
12/25/2006 8:25:53 PMDavid M Rice

Post Script. One can use a GPS and / or the "NMEA Sage Talker" control to provide latitude and longitude as well as time and direction, all updated automatically. Maybe I'll do that, and also use Swiss Ephemeris for planets, Sol, and Luna....
(If this comment was disrespectful, please report it.)

 
12/29/2006 12:02:27 AMDavid M Rice

Is LST correct in this program? It seems to be off, as far as I can tell. I followed the routines given at http://www.tnni.net/~dustymars/Mephemeris.htm and the values do not match this otherwise fun 'stars' program.
(If this comment was disrespectful, please report it.)

 
12/31/2006 3:51:54 PMVictor B

5 Stars for Stars ! I have been looking for something like this !
(If this comment was disrespectful, please report it.)

 
5/29/2008 11:06:33 AMThomas Swift

I notice you still have to input your longitude and latitude. You might want to check out GeoZip2: http://www.planet-source-code.com/vb/default.asp?lngCId=70588&lngWId=1
(If this comment was disrespectful, please report it.)

 
4/11/2009 8:46:20 AMKeith Stanier

I don't know why you need a large StarData.txt files for the data. When I run it it takes 3 or 4 minutes to show anything because its reading the data from the file. Surely this data could be added internally which will speed the startup process. When you close the app it crashes VB you have nothing in the Form_Unload. When it eventually does run it works quite well.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.