VirtualSky
VirtualSky a browser-based planetarium 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.
Contents
What's new?
Version 0.7.4 / 15 September 2019
Changes:
- Update links
- Make sure atmosphere gradient displays on first draw #63
- Improve the size of the keyboard shortcuts
- Fix bug with time input
Version 0.7.3 / 6 August 2019
There have been some improvements to the code:
- Fixed issue #52 to improve touch move handling
- Improved performance of drawing
- Fixed part of issue #25 to get RA/dec of cursor position
Version 0.7.0 / 15 October 2018
There has been a major overhaul to remove the need for jQuery (replaced with stuQuery). This has reduced the initial page load from 337kB to 200kB so it should hopefully load more quickly and save bandwidth. Also:
- Can set the width of gridlines (
gridlineswidth=5
) #46 - Can set the width of constellation lines (
constellationwidth=5
) - Can set the width of constellation boundaries (
constellationboundarieswidth=5
) - Can set the width of the galaxy (
galaxywidth=5
) - Help screen can be accessed with the mouse
- The place-search API was deprecated by Yahoo so the place lookup now uses static files split by starting letter (to keep it quick)
- Switched to date/time input fields to make date selection easier with controls native to the browser
- Bug fix: manually set constellation boundaries work again. #41
Please report any bugs on Github giving your browser make/version. You can also suggest new features there (although they may not happen for ages or at all as this is an entirely spare time project).
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 in your page:
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: - A
lambert
projection, with constellations shown, no keyboard control and a black-on-white view. It is based in Manchester,UK and facing north: - 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. - A
mollweide
projection with with star labels drawn and the ground blocking half the sky. - 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). - A default view using
stereo
projection with a place marker - A default view using
gnomic-tan
projection centred on M42 - A default view using
gnomic-tan
projection centred on Orion with a button to move, and a handler forcontextmenu
(try the right mouse button...) - A default view using
stereo
projection in Arabic - A default view using
stereo
projection showingobjects
(in this case the Messier catalogue) included from a local JSON file:If you have multiple files of objects you can separate them with semi-colons e.g.
objects: 'messier.json;caldwell.json'
.
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 labelsconstellationwidth
(0.7) - set the width of the constellations in pixelsconstellationboundaries
(false) - show/hide the constellation boundariesconstellationboundarieswidth
(0.7) - set the width of the constellation boundaries in pixelsmeteorshowers
(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 linesgridlineswidth
(0.7) - set the width of the gridlines in pixelsgridstep
(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 Waygalaxywidth
(0.7) - set the width of the Milky Way outline in pixelslive
(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.lang
- VirtualSky will attempt to auto-detect the preferred language of the person's browser but you can specify a language explicitlycallback.contextmenu
- VirtualSky will invoke the given callback on right click or long press on the map. The event sent to the callback includes the RA,DEC coordinates in the skyPos property, if applicable.
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).