tags:

views:

411

answers:

4

Does anybody know of an easy-to-use, FOSS equivalent of the program generating this 'live' colored, earth map.

Alternatively, equally appreciated would be enough pointers on the logic, API, and data to use to write such a program on my own in Java or C?

What I Basically Want

  1. I need to be able to generate a picture for my space-time coordinates (not very far away from the Earth).

  2. I'm hoping that this program will have a dependency NEITHER on a large/online database of images, NOR on a live satellite feed, and would instead be able to work off of an in-memory (or on-disk) colored map of Earth with projection and day-/night-highlighting calculations for creating the desired image.

  3. The program should be able to run on Linux. Could be in Java, C, or any other portable/cross-platform language.

  4. The program should (ideally) be able to run in offline mode... without using the Internet, that is.

+1  A: 

I don't know of a FOSS alternative; but I'm thinking that writing one in C should be doable. You would need a few things: A daylight and a nighttime image in an appropriate projection. (That would, in this case, be a cylindrical projection of some sort.)

You would then map the straight line that represents the day/night switch on a sphere to the neat sinwave-looking thingamajig (I believe this is the tecnical term) you see on the image up there; and composite the nighttime image on top of the daytime image (or vice versa).

The tricky part would really be coordinate and time mappings.

Williham Totland
+1  A: 

It's not a simple calculation, but it's entirely possible to calculate, using orbital mechanics theory, the relative positions of the Earth and Sun so that the illuminated portion of the Earth can be visualised.

Well, obviously it's possible, we've seen the www.foumilab.ch example.

I did something a little similar, but I used POVRay to render a 3D image of the Earth, Sun and Moon during a solar eclipse. I didn't produce a map of the Earth, but the basic calculations came from a popular 'DIY' celestial mechanics book 'Astronomical Algorithms' by Jean Meeus, Willman-Bell, 1991.

The calculations have to take into account the rotation of the Earth as well as the seasonal variation in the tilt of its axis with respect to the Sun.

The POVRay source code is available for download here You can consider it FOSS, if it's of any use.

pavium
I'll take a look at POVRay.... but from a quick reading of its blurb, looks like it works on a different level of abstraction, so may or may not be useful. Thanks, for sharing the link though. Upvoting +1.
Harry
well ... POVRay isn't anything like what you're looking for, but I thought my code could give you a hint of the calculations necessary. Necessary, that is, for reasonable accuracy. Thanks for the upvote.
pavium
+1  A: 

I doubt that this will be hard at all, given:

  • A picture of the Earth for a map
  • A good graphics library
  • A library (or the relevant functions) for calculating the position of the sun
  • A library (or the relevant functions) for spherical geometry

Start by using your astronomy library to calculate the sun's position in a geocentric coordinate system: in other words, what spot on earth has the sun directly overhead. Call this spot X. Then use your trigonometry library: any spot more than 90 degrees from X has night; use your graphics program to darken it on the map. If you want twilight, you might need to do some shading around the boundary. There; problem solved.

Robert L
+1  A: 

4 programs that run on Linux which seem to do most of what you want (or that you can adapt/cannibalise). I've listed them in order of relevance.

  • XGlobe (Qt)
  • Xplanet (OpenGL)
  • WMGlobe (WindowMaker dock app)
  • xearth (background updater - uses network, so probably a no go for you)

The XGlobe page also has links to some very nice looking maps for further customisation, or if you need to "roll your own".

ire_and_curses
Thanks.If we click on the Date/Time button of the Gnome/Fedora11 taskbar, we see something similar to what I want. http://somedeveloper.blogspot.com/2009/09/live-earth-map-in-datetime-control-of.htmlHoping the code for all of this will be easily extractable :-). The other thing is, the earth map used in this control is very plain/bland, not at all like the one the fourmilab.ch site uses.
Harry