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 code in your webpage:

  1.     <script src="http://lcogt.net/virtualsky/embed/virtualsky-0.3.2.js" type="text/javascript"></script>
  2. You will also need to include the following (change the window.onload as appropriate) in your page <head> to get all the defaults:
        window.onload = function() {
            planetarium = new VirtualSky();
        }
  3. Where you want the sky to appear in the page <body>, you need to insert either:
        <div id="starmap" style="width:600px;height:600px;"></div>
    or, if you're feeling adventureous:
        <canvas id="starmap" width="600" height="600"></canvas>
  4. You can customise the sky by sending some arguments in that initial call e.g:
        planetarium = new 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', 'equirectangular', 'mollweide' or 'planechart'
  • 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
  • cardinalpoints (true) - show/hide the N/E/S/W labels
  • constellations (false) - show/hide the constellation lines
  • constellationlabels (false) - show/hide the constellation labels
  • showplanets (true) - show/hide the planets
  • 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 = new 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 = new 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 = new 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/user/slowe/dev/virtualsky/embed/?gridlines_az=true" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" style="width:800px;height:500px;border:0px;"></iframe>

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. There are other canvas-based planetaria available online e.g. Ivan Boldyrev's Starchartjs, StarAtlas and Thomas Boch's All Sky Map.