VirtualSky
VirtualSky a browser-based planetarium from LCOGT that lets you see what is visible in the sky from any location on Earth. It can be customized and included on your own website, blog etc. It is provided freely for educational and non-profit use.
Keyboard shortcuts
Press the "?" key (with your mouse over VirtualSky) to see the full list of keyboard controls.
Instructions for embedding
The easiest way to include VirtualSky on your website is to use the custom form to create an embed link (uses an <iframe>
).
Sometimes an <iframe>
just doesn't give you the flexibility you need (or you might want to include it in an offline page during a public talk). In that case you could download a copy of the source from GitHub and include VirtualSky in your page using Javascript. You will need to include the following code block in the <head>
of your page:
<!--[if lt IE 9]><script src="excanvas.min.js"></script><![endif]--> <script src="jquery-1.10.0.min.js"></script> <script src="virtualsky.min.js" type="text/javascript"></script> <script> $(document).ready(function() { var planetarium = $.virtualsky({ id: 'starmap1' }); }); </script>
Make sure the scripts point to the correct locations for the Javascript files. In the <body>
you need to include the DOM element you've referenced by ID:
<div id="starmap1" style="width:400px;height:400px;"></div>
The result is:
That is a version of VirtualSky with all the default options. However, one of the great things about VirtualSky is that it can be customised. Here are some examples to give you some ideas:
- A
stereo
projection set for Santa Barbara's lat/long:$(document).ready(function() { var planetarium = $.virtualsky({ id: 'starmap', projection: 'stereo', latitude: 34.4326, longitude: -119.86286 }); });
<div id="starmap" style="width:100%;height:500px;"></div>
- A
lambert
projection, with constellations shown, no keyboard control and a black-on-white view. It is based in Manchester,UK and facing north:$(document).ready(function() { var planetarium = $.virtualsky({ id: 'starmap', projection: 'lambert', mouse: true, keyboard: false, az: 0, negative: true, constellations: true, latitude: 53.5, longitude: -2.5 }); });
<div id="starmap" style="width:500px;height:300px;"></div>
- A
stereo
projection with no keyboard or mouse input and with a Galactic grid and the Meridian line displayed. The view is facing south east from Hill Valley, California at 1:21 am on October 25, 1985.$(document).ready(function() { var planetarium = $.virtualsky({ id: 'starmap', projection: 'stereo', keyboard: false, mouse: false, az: 135, meridian: true, latitude: 38.25, longitude: -122.6, clock: new Date("October 25, 1985 01:21:00"), gridlines_gal: true }); });
<div id="starmap" style="width:650px;height:300px;"></div>
- A
mollweide
projection with with star labels drawn and the ground blocking half the sky.$(document).ready(function() { var planetarium = $.virtualsky({ id: 'starmap', projection: 'mollweide', showstarlabels: true, ground: true }); });
<div id="starmap" style="width:920px;height:460px;"></div>
- A default view with a
stereo
projection, constellation lines and two manually specified constellation boundaries (note that RA/Dec for boundaries are assumed to be in B1875).$(document).ready(function() { var planetarium = $.virtualsky({ id: 'starmap', az: 225, projection: 'stereo', constellations: true, constellationboundaries: true, boundaries: [ ["And",343,34.5,343,52.5,350,52.5,350,50,353.75,50,353.75,48,2.5,48,2.5,46,13,46,13,48,16.75,48,16.75,50,20.5,50,25,50,25,47,30.625,47,30.625,50.5,37.75,50.5,37.75,36.75,30,36.75,30,35,21.125,35,21.125,33,10.75,33,10.75,23.75,12.75,23.75,12.75,21,2.125,21,2.125,22,1,22,1,28,0,28,0,31.33333,356.25,31.33333,356.25,32.08333,352.5,32.08333,352.5,34.5,343,34.5], ["Ori",69.25,0,69.25,15.5,74.5,15.5,74.5,16,80,16,80,15.5,84,15.5,84,12.5,86.5,12.5,86.5,18,85.5,18,85.5,22.83333,88.25,22.83333,88.25,21.5,93.25,21.5,93.25,17.5,94.625,17.5,94.625,12,94.625,10,93.625,10,93.625,0,93.625,-4,87.5,-4,87.5,-11,76.25,-11,76.25,-4,70,-4,70,0,69.25,0] ], clock:new Date("July 17, 2013 18:39:00 GMT") }); });
<div id="starmap" style="width:944px;height:400px;"></div>
- A default view using
stereo
projection with a place marker$(document).ready(function() { var planetarium = $.virtualsky({ id: 'starmap', projection: 'stereo', }); planetarium.addPointer({ 'ra':83.8220792, 'dec':-5.3911111, 'label':'Orion Nebula', 'img':'http://server7.sky-map.org/imgcut?survey=DSS2&w=128&h=128&ra=5.58813861333333&de=-5.3911111&angle=1.25&output=PNG', 'url':'http://simbad.u-strasbg.fr/simbad/sim-id?Ident=M42', 'credit':'Wikisky', 'colour':'rgb(255,220,220)' }) });
<div id="starmap" style="width:944px;height:400px;"></div>
- A default view using
gnomic-tan
projection centred on M42$(document).ready(function() { var planetarium = $.virtualsky({ 'id': 'starmap', 'projection': 'gnomic', 'ra': 83.8220833, 'dec': -5.3911111, 'ground': false, 'constellations': true, 'fov': 15 }); });
<div id="starmap" style="width:944px;height:400px;"></div>
- A default view using
gnomic-tan
projection centred on Orion with a button to move$(document).ready(function() { var planetarium = $.virtualsky({ 'id': 'starmap', 'projection': 'gnomic', 'ra': 83.8220833, 'dec': -5.3911111, 'ground': false, 'constellations': true, 'fov': 15 }); $('button#moveit').on('click',function(){ planetarium.panTo(56.8690917,24.1053111,3000) }); });
<div id="starmap" style="width:944px;height:400px;"></div> <button id="moveit">Move to The Pleiades</button>
Options
There are a range of options to try (default values in brackets):
id
('starmap') - The ID for the HTML element where you want the sky insertedprojection
('polar') - The projection type as 'polar', 'stereo', 'lambert', 'ortho', 'equirectangular', 'mollweide', 'planechart' or 'fisheye'width
(500) - Set the width of the sky unless you've set the width of the elementheight
(250) - Set the height of the sky unless you've set the height of the elementplanets
- either an object containing an array of planets or a JSON filemagnitude
(5) - the magnitude limit of displayed starslongitude
(53.0) - the longitude of the observerlatitude
(-2.5) - the latitude of the observerclock
(now) - a Javascript Date() object with the starting date/timebackground
('rgba(0,0,0,0)') - the background colourtransparent
(false) - make the background transparentcolor
('rgb(255,255,255)') - the text colouraz
(180) - an azimuthal offset with 0 = north and 90 = eastnegative
(false) - invert the default colours i.e. to black on whitegradient
(true) - reduce the brightness of stars near the horizonground
(false) - show/hide the local ground (for full sky projections)keyboard
(true) - allow keyboard controlsmouse
(true) - allow mouse controlscardinalpoints
(true) - show/hide the N/E/S/W labelsconstellations
(false) - show/hide the constellation linesconstellationlabels
(false) - show/hide the constellation labelsconstellationboundaries
(false) - show/hide the constellation boundariesmeteorshowers
(false) - show/hide current meteor shower radiantsshowplanets
(true) - show/hide the planetsshowplanetlabels
(true) - show/hide the planet labelsshoworbits
(false) - show/hide the orbits of the planetsshowstars
(true) - show/hide the starsshowstarlabels
(false) - show/hide the star labels for the brightest starsscalestars
(1) - the factor by which to scale the star sizesshowdate
(true) - show/hide the date and timeshowposition
(true) - show/hide the latitude and longitudegridlines_az
(false) - show/hide the azimuth/elevation grid linesgridlines_eq
(false) - show/hide the RA/Dec grid linesgridlines_gal
(false) - show/hide the Galactic grid linesgridstep
(30) - the size of the grid step when showing grid linesecliptic
(false) - show the line of the Eclipticmeridian
(false) - show the line of the Meridianshowgalaxy
(false) - show an outline of the Milky Waylive
(false) - update the display in real timefontsize
- if, from a design point of view, you need a very specific font size (currently only in pixels), this is how you override the automatic font scaling. e.g. "10px"fontfamily
- VirtualSky inherits the font family when it is added to an element on a page but can't when using an iframe. To solve that situation, you can provide a CSSfont-family
string.
Technical details
Virtual Sky uses the <canvas> element - part of the HTML5 proposal - so should work in most modern browsers such as Firefox (there are issues in Firefox 3.0 on Ubuntu), Opera, Chrome and Safari. It should also work in Internet Explorer 7.0 and 8.0 through the use of the excanvas.js library. The code can be found on Github.
Alternatives
There are other browser-based planetaria available online e.g. Ivan Boldyrev's Starchartjs, Luther Huffman's StarAtlas and Thomas Boch's All Sky Map. On the desktop, Stellarium is a highly featured planetarium program that works on Windows, Mac and Linux platforms.