Virtual Sky

Virtual Sky 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.

Instructions for embedding

The easiest way to include Virtual Sky is to use our custom form to create an embed link.

Alternatively, you can include the following block of code in the head of your webpage:

  1.     <!--[if lt IE 9]><script src="http://lcogt.net/virtualsky/embed/excanvas.min.js"></script><![endif]-->
    <script src="http://lcogt.net/virtualsky/embed/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script src="http://lcogt.net/virtualsky/embed/virtualsky-0.3.15.min.js" type="text/javascript"></script>
  2. You will also need to include the following (change the $(document).ready as appropriate) in your page <head> to get all the defaults:
        $(document).ready(function() {
            planetarium = new $.virtualsky();
        })
  3. Where you want the sky to appear in the page <body>, you need to insert:
        <div id="starmap" style="width:600px;height:600px;"></div>
  4. You can customise the sky by sending some arguments in that initial call e.g:
        planetarium = $.virtualsky({id:'starmap', projection:'polar', gridstep:30, mouse:true, keyboard:true, latitude:34.4326, longitude:-119.86286});

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 inserted
  • projection ('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 element
  • height (250) - Set the height of the sky unless you've set the height of the element
  • planets - either an object containing an array of planets or a JSON file
  • magnitude (5) - the magnitude limit of displayed stars
  • longitude (53.0) - the longitude of the observer
  • latitude (-2.5) - the latitude of the observer
  • clock (now) - a Javascript Date() object with the starting date/time
  • background ('rgba(0,0,0,0)') - the background colour
  • az (180) - an azimuthal offset with 0 = north and 90 = east
  • negative (false) - invert the default colours i.e. to black on white
  • sky_gradient (true) - reduce the brightness of stars near the horizon
  • magnitude (5) - the magnitude limit of the stars
  • cardinalpoints (true) - show/hide the N/E/S/W labels
  • constellations (false) - show/hide the constellation lines
  • constellationlabels (false) - show/hide the constellation labels
  • constellationboundaries (false) - show/hide the constellation boundaries
  • meteorshowers (false) - show/hide current meteor shower radiants
  • showplanets (true) - show/hide the planets
  • showplanetlabels (true) - show/hide the planet labels
  • showstarlabels (false) - show/hide the star labels for the brightest stars
  • showorbits (false) - show/hide the orbits of the planets
  • showdate (true) - show/hide the date and time
  • showposition (true) - show/hide the latitude and longitude
  • ground (false) - show/hide the local ground (for full sky projections)
  • keyboard (true) - allow keyboard controls
  • mouse (true) - allow mouse controls
  • gridlines_az (false) - show/hide the azimuth/elevation grid lines
  • gridlines_eq (false) - show/hide the RA/Dec grid lines
  • gridstep (30) - the size of the grid step when showing grid lines

Examples

  1. A polar projection, with keyboard and mouse access set for Santa Barbara's lat/long:

    planetarium2 = $.virtualsky({id:'starmap2', projection:'polar', mouse:true, keyboard:true, latitude:34.4326, longitude:-119.86286});
  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:

    planetarium3 = $.virtualsky({id:'starmap3', projection:'lambert', mouse:true, keyboard:false, az:0, negative:true, constellations:true, latitude:53.5, longitude:-2.5});
  3. A stereo projection with no keyboard or mouse input and with an equatorial grid. The view is facing south from Hill Valley, California at 1:21 am on October 25, 1985.

    planetarium4 = $.virtualsky({id:'starmap4', projection:'stereo', keyboard:false, mouse:false, az:180, latitude:38.25, longitude:-122.6, clock:new Date("October 25, 1985 01:21:00")});
  4. As an iframe

    <iframe src="http://lcogt.net/virtualsky/embed/?gridlines_az=true" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" style="width:100%;height:500px;border:0px;"></iframe>
  5. A mollweide projection with with star labels drawn and the ground blocking half the sky.

    planetarium5 = $.virtualsky({id:'starmap5', projection:'mollweide', showstarlabels:true, az:180, ground:true});

Keyboard shortcuts

    Press the "?" key (with your mouse over VirtualSky) to see the full list of keyboard controls.

    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, 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.