Using a planetarium program is a very common thing for any amateur astronomer. I use three such programs, namely: Stellarium, Cartes du Ciel (SkyCharts), and KStars.
Both Stellarium and Cartes du Ciel support a simple scheme to add obstructions in your location to their dynamically generated maps of the sky. This scheme relies on you created a simple file with two columns. The first column is the Asimuth (the degrees of the horizon's offset from 0 for north, 90 for east, 180 for south and 270 for west. Each program interpolates the horizon line from the previous and following azimuth points.
KStars however, does not have the same scheme. It uses a rudimentary editor to 'draw' the horizon using a mouse. The limitation is that you have to add a full polygon for each obstruction.
So, I sought a way to convert the simpler horizon file from Stellarium and Cartes du Ciel into KStars.
I did this by looking at the data structure inside the main database that KStars uses. It is an SQLite 3 database, and hence easy to understand.
Here is an example of a horizon file. Yes, this has lots of obstructions!
00 10
02 10
05 40
10 55
20 62
40 55
42 50
45 15
50 15
60 15
70 15
80 3
90 3
100 15
120 15
129 3
130 27
132 27
134 3
140 5
150 55
160 55
170 55
190 15
200 25
210 15
220 13
230 13
235 23
250 25
260 25
265 25
270 27
275 25
280 20
285 25
290 25
300 25
350 35
351 10
355 10
359 10
We now need to delete any existing tables, and replace then by new empty ones containing azimuth/altitude pairs.
The only limitation is that you have to start an obstruction at zero altitude, and end it at zero altitude as well:
-- Remove any existing tables
DROP TABLE horizon_1;
DROP TABLE horizon_2;
DROP TABLE horizon_3;
DROP TABLE horizon_4;
DROP TABLE horizons;
-- Create the main table
CREATE TABLE horizons (
id INTEGER DEFAULT NULL PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
label TEXT NOT NULL,
enabled INTEGER NOT NULL);
-- Create four horizon files, one for each quadrant of the azimuth circle
CREATE TABLE horizon_1 (Az REAL NOT NULL, Alt REAL NOT NULL);
CREATE TABLE horizon_2 (Az REAL NOT NULL, Alt REAL NOT NULL);
CREATE TABLE horizon_3 (Az REAL NOT NULL, Alt REAL NOT NULL);
CREATE TABLE horizon_4 (Az REAL NOT NULL, Alt REAL NOT NULL);
INSERT INTO "horizons" VALUES (1, 'horizon_1', 'Region 1',1);
INSERT INTO "horizons" VALUES (2, 'horizon_2', 'Region 2',1);
INSERT INTO "horizons" VALUES (3, 'horizon_3', 'Region 3',1);
INSERT INTO "horizons" VALUES (4, 'horizon_4', 'Region 4',1);
-- Now insert the values in each horizon quadrant
-- The first value is the Azimuth, the second is the Altitude
-- Remember that you have to start an area from zero altitude
-- and also end with zero altitude
-- First quadrant, from north to east
INSERT INTO "horizon_1" VALUES(0, 0);
INSERT INTO "horizon_1" VALUES(1, 10);
INSERT INTO "horizon_1" VALUES(2, 10);
INSERT INTO "horizon_1" VALUES(5, 40);
INSERT INTO "horizon_1" VALUES(10, 55);
INSERT INTO "horizon_1" VALUES(20, 62);
INSERT INTO "horizon_1" VALUES(40, 55);
INSERT INTO "horizon_1" VALUES(42, 50);
INSERT INTO "horizon_1" VALUES(45, 15);
INSERT INTO "horizon_1" VALUES(50, 15);
INSERT INTO "horizon_1" VALUES(60, 15);
INSERT INTO "horizon_1" VALUES(70, 15);
INSERT INTO "horizon_1" VALUES(80, 3);
INSERT INTO "horizon_1" VALUES(89, 3);
INSERT INTO "horizon_1" VALUES(90, 0);
-- Second quadrant, from east to south
INSERT INTO "horizon_2" VALUES(100, 0);
INSERT INTO "horizon_2" VALUES(101, 15);
INSERT INTO "horizon_2" VALUES(120, 15);
INSERT INTO "horizon_2" VALUES(129, 3);
INSERT INTO "horizon_2" VALUES(130, 27);
INSERT INTO "horizon_2" VALUES(132, 27);
INSERT INTO "horizon_2" VALUES(134, 3);
INSERT INTO "horizon_2" VALUES(140, 5);
INSERT INTO "horizon_2" VALUES(150, 55);
INSERT INTO "horizon_2" VALUES(160, 55);
INSERT INTO "horizon_2" VALUES(169, 55);
INSERT INTO "horizon_2" VALUES(170, 0);
-- Third quadrant, from south to west
INSERT INTO "horizon_3" VALUES(190, 0);
INSERT INTO "horizon_3" VALUES(191, 15);
INSERT INTO "horizon_3" VALUES(200, 25);
INSERT INTO "horizon_3" VALUES(210, 15);
INSERT INTO "horizon_3" VALUES(220, 13);
INSERT INTO "horizon_3" VALUES(230, 13);
INSERT INTO "horizon_3" VALUES(235, 23);
INSERT INTO "horizon_3" VALUES(250, 25);
INSERT INTO "horizon_3" VALUES(260, 25);
INSERT INTO "horizon_3" VALUES(265, 25);
INSERT INTO "horizon_3" VALUES(269, 27);
INSERT INTO "horizon_3" VALUES(270, 0);
-- Fourth quadrant, from west to north
INSERT INTO "horizon_4" VALUES(275, 0);
INSERT INTO "horizon_4" VALUES(276, 25);
INSERT INTO "horizon_4" VALUES(280, 20);
INSERT INTO "horizon_4" VALUES(285, 25);
INSERT INTO "horizon_4" VALUES(290, 25);
INSERT INTO "horizon_4" VALUES(300, 25);
INSERT INTO "horizon_4" VALUES(350, 35);
INSERT INTO "horizon_4" VALUES(351, 10);
INSERT INTO "horizon_4" VALUES(355, 10);
INSERT INTO "horizon_4" VALUES(358, 10);
INSERT INTO "horizon_4" VALUES(359, 0);
Store the above file in a .sql file.
Then exit KStars.
And run the SQL file as follows:
sqlite3 ~/.local/share/kstars/userdb.sqlite < create-horizon.sql
When you start KStars, you should see your new horizon. It will not look exactly as it did in Stellarium or Cartes du Ciel, so you may need to refine it by adding more azimuth/altitude points.
Most Comments
Most commented on articles ...