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.
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:
<script src="http://lcogt.net/virtualsky/embed/virtualsky-0.3.2.js" type="text/javascript"></script>- 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();
} - 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> - 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 insertedprojection ('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 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 colouraz (180) - an azimuthal offset with 0 = north and 90 = eastnegative (false) - invert the default colours i.e. to black on whitesky_gradient (true) - reduce the brightness of stars near the horizoncardinalpoints (true) - show/hide the N/E/S/W labelsconstellations (false) - show/hide the constellation linesconstellationlabels (false) - show/hide the constellation labelsshowplanets (true) - show/hide the planetsshoworbits (false) - show/hide the orbits of the planetsshowdate (true) - show/hide the date and timeshowposition (true) - show/hide the latitude and longitudeground (false) - show/hide the local ground (for full sky projections)keyboard (true) - allow keyboard controlsmouse (true) - allow mouse controlsgridlines_az (false) - show/hide the azimuth/elevation grid linesgridlines_eq (false) - show/hide the RA/Dec grid linesgridstep (30) - the size of the grid step when showing grid lines
Examples
- 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});
- 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});
- 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")});
- 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.