Fork Me on GitHub

VirtualSky

VirtualSky a browser-based planetarium from Las Cumbres Observatory 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:

  1. 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>
    
  2. 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>
    
  3. 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>
    
  4. 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>
    
  5. 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>
    
  6. 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>
    
  7. 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>
    
  8. 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>
    
  9. A default view using stereo projection in Arabic
    $(document).ready(function() {
    
    	var planetarium = $.virtualsky({
    		id: 'starmap',
    		projection: 'stereo',
    		lang: 'ar'
    	});
    });
    			
    <div id="starmap" style="width:944px;height:400px;"></div>
    

Options

There are a range of options to try (default values in brackets):

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 (VirtualSky uses many of the same keyboard shortcuts).