KStars API


KStars is free, open source, cross-platform Astronomy Software.

It provides an accurate graphical simulation of the night sky, from any location on Earth, at any date and time. The display includes up to 100 million stars, 13,000 deep-sky objects,all 8 planets, the Sun and Moon, and thousands of comets, asteroids, supernovae, and satellites.

For students and teachers, it supports adjustable simulation speeds in order to view phenomena that happen over long timescales, the KStars Astrocalculator to predict conjunctions, and many common astronomical calculations. For the amateur astronomer, it provides an observation planner, a sky calendar tool, and an FOV editor to calculate field of view of equipment and display them. Find out interesting objects in the "What's up Tonight" tool, plot altitude vs. time graphs for any object, print high-quality sky charts, and gain access to lots of information and resources to help you explore the universe!

Included with KStars is Ekos astrophotography suite, a complete astrophotography solution that can control all INDI devices including numerous telescopes, CCDs, DSLRs, focusers, filters, and a lot more. Ekos supports highly accurate tracking using online and offline astrometry solver, autofocus and autoguiding capabilities, and capture of single or multiple images using the powerful built in sequence manager.


KStars is a simulation of the night sky. The whole program is essentially a (very complicated) model/view implementation. The "model" is all of the data regarding objects in the night sky, and how they change with time, and the "view" is the graphical display of this model on your screen.

The "model" is encapsulated in the KStarsData class, and the "view" is encapsulated in the KStars class. Here is a list of the major components of KStars:








Auxiliary are helper classes/dialogs/functions used throughout KStars.


How does it work?

The following explanation is a very high level and general overview on the basic workflow in KStars. When you run KStars, the following general steps are executed (not necessarily in this order):

  1. An Instance of KStars is created. KStars will start with the SimClock running and set to the system date and time unless otherwise specified in command line arguments.
  2. An Instance of KStarsData is created. Data for stars, catalogs, deep sky objects, comets...etc are read and loaded into memory. Some data are not read unless necessary, such as stars that only appear at very high zoom levels.
  3. Date and Time are initialized. Simulated clocks normally ticks forward at a particular interval, the default being once per second like a real clock.
  4. KStars splash screen is created.
  5. An Instance of SkyMap is created. The SkyMap is the primary central widget in KStars. Toolbars, menus, actions, and status bar are initialized.
  6. SimClock emits the timeAdvanced() signal, which is connected to KStarsData::updateTime(), which takes care of updating object coordinates and drawing the skymap. Effects for precession, nutation, aberration, and refraction are taken into account.
  7. SkyMap can have multiple draw backends (QPainter or OpenGL). It calls the selected backend to draw the overlays and objects unto the sky map.
  8. The backend implementing SkyMapDrawAbstract receives a PaintEvent(..) from SkyMap which begins by drawing the background first. Afterwards, it calls KStarsData SkyMapComposite instance which in turn calls all child composites and components to draw themselves. Each component draws itself on the skymap. The order of the drawing routine ensures layers such as equatorial/horizontal grid lines are drawn last.
  9. The sky map responds to user input from keyboard and mouse to perform various actions such as panning, zooming, invoking the popup menu for a particular object...etc.
  10. SimClock emits timeAdvanced() signal and the cycle repeats.
  11. The user can invoke tools, change settings, download new data, run scripts..etc while the cycle above is taking place in the background.
  12. Upon exit destructors are called to properly terminate all objects, free memory, and save options if necessary.
Jasem Mutlaq