Note: This documentation is preliminary and subject to change.
Web Control scripts are used to customize the WorldWide Telescope web client. This document describes the setup, development process, API set and samples to aid developers in building their own applications.
The customization scripts are written in JScript and embedded in an html file, and along with custom data files, can be used to do one or more of the following tasks:
Note that currently the SDK only applies to the Sky view of WorldWide Telescope, and not the Earth, Planet, Panorama or SolarSystem views.
| The Aphelion Beta release is based on Silverlight 3, whereas the earlier versions of the web client were based on Silverlight 2. Support for Silverlight 2 applications has not been removed, however new applications should be written for Silverlight 3. To upgrade a script from Silverlight 2 to 3 involves changing just a few lines of code, which are pointed out in the Web Control Development section. |
To develop WorldWide Telescope web control applications, ensure the following steps have been completed:
![]() |
Refer to the WWT Web Client Simple sample for the structure of a WorldWide Telescope web client. This section provides some additional notes for developers.
The Silverlight object for WorldWide Telescope is embedded in the web client html with an entry such as the following:
Silverlight object entry |
<object id="silverlightObject" |
Entry | Required | Description | Example |
| NoUI | No | Turns the UI on or off. | NoUI=true, |
| tour | No | Initiates a tour on start up. | tour=http://www.worldwidetelescope.org/docs/wtml/tourone.wtt, |
| wtml | No | Loads a collection on start up. | wtml=http://www.worldwidetelescope.org/docs/wtml/myplaces.wtml, |
| webkey | Yes | A valid key (a valid test key is shown here). | webkey=AX2011Gqqu |
Before installing Silverlight 3, uninstall Silverlight 2 (this includes uninstalling Microsoft Silverlight, Microsoft Silverlight 2 SDK, and Microsoft Silverlight Tools for Visual Studio 2008). Then install Silverlight 3 and the Silverlight 3 SDK and Silverlight 3 Tools for Visual Studio 2008 SP1.
In the source scripts for your applications, change the following in the Silverlight object entry:
Param | Change from | Change to |
| source | http://www.worldwidetelescope.org/webclient/WWTSL.xap | http://www.worldwidetelescope.org/webclient/clientbin/WWTSL.xap |
| minRuntimeVersion | 2.0.31005.0 | 3.0.40624.0 |
| href | fwlink/?LinkID=124807 | fwlink/?LinkID=149156&v=3.0.40624.0 |
Note that the type does not change from x-silverlight-2. Also note the addition of the tour entry for initParams.
The View object is the principal object, the other objects are created on initialization of a View object, or can be created by the methods provided by this object.
Note that the Example Code listed for each property or method is not code that will run on its own, just an example of how to use the property or method within a script. Run-able samples are listed and linked to in the Web Control Samples section.
Object | Description |
| Annotation | Used to describe the annotation for a Circle, Poly or PolyLine object. |
| Circle | Used to render a circle on the screen. |
| Poly | Used to render a polygon on the screen. |
| PolyLine | Used to render a polyline on the screen. |
| Settings | Used to specify a range of settings for a View object. |
| View | Used to manage the current view of WorldWide Telescope images. |
The Annotation Object is inherited by the Circle object, the Poly object, and the PolyLine object, and is used to describe the annotation for these objects. An Annotation object is not used independently of these other objects, so this object should not be instantiated on its own.
Property | Description |
| ID | Contains a string for use by the web client. |
| Label | Contains descriptive text for the annotation. |
| Opacity | Specifies the opacity to be applied to the complete annotation. |
| ShowHoverLabel | Specifies whether to render the label if the mouse is hovering over the annotation. |
| Tag | Contains a string for use by the web client. |
The ID property contains a string for use by the web client.
Annotation.ID [string]
This string can be used to hold information (perhaps a URL or link to related information, reference string or number, credits, date, times, and so on) that is of use to the web client. The ID string is returned with a wwtAnootationclicked event.
// Draw a circle at the center of the constellation Sagittarius |
The Label property contains descriptive text for the annotation.
Annotation.Label [string]
The label text will be rendered if the ShowHoverLabel property is set to true.
// Draw a circle at the center of the constellation Sagittarius |
The Opacity property specifies the opacity to be applied to the complete annotation.
Annotation.Opacity [double]
The default opacity setting is 1.0, which means that no transparency blending will be applied to the complete annotation. A value of 0.5, for example, will result in a 50% transparency blending being applied. Note that the color values for individual lines and fill color (which can include an alpha transparency value) are applied to the specific lines and shapes before the opacity value here is applied to the entire annotation.
// Set a solid fill color |
The ShowHoverLabel property specifies whether to render the label if the mouse is hovering over the annotation.
Annotation.ShowHoverLabel [Bool]
The default setting is false.
// Draw a circle at the center of the constellation Sagittarius |
The Tag property contains a string for use by the web client.
Annotation.Tag [string]
This string can be used to hold information that is of use to the web client. The string is not used internally by WorldWide Telescope.
circle.Tag = "001";
|
The Circle object is used to render a circle on the screen. It is created by the CreateCircle method.
The Circle object inherits the properties of the Annotation object.
![]() The image shows a purple circle with a 2 pixel line, a green polygon and a light blue polyline. Note that the order in which the elements are drawn is significant in how they appear, if there is any overlap or transparency. |
Property | Description |
| Fill | Specifies whether the circle should be filled or not. |
| FillColor | Specifies the fill color as an ARGB value. |
| LineColor | Specifies the line color as an ARGB value. |
| LineWidth | Specifies the line width in pixels. |
| Radius | Specifies the circle radius. |
| SkyRelative | Specifies whether the circle size is absolute or relative. |
Method | Description |
| SetCenter | Specifies the center coordinates of the circle. |
The Fill property specifies whether the circle should be filled or not.
Circle.Fill [Bool]
The default is false.
// Fill a circle with a transparent red |
The FillColor property specifies the fill color as an ARGB value.
Circle.FillColor [uint]
The default fill color is white. The four bytes of the unsigned integer are the alpha, red, green and blue values respectively.
// Fill a circle with opaque green |
The LineColor property specifies the line color as an ARGB value.
Circle.LineColor [uint]
The default line color is white. The four bytes of the unsigned integer are the alpha, red, green and blue values respectively.
// Draw a circle in opaque dark gray |
The LineWidth property specifies the line width in pixels.
Circle.LineWidth [double]
The default line width is 1 pixel.
// Double the default line width |
The Radius property specifies the circle radius.
Circle.Radius [double]
If the SkyRelative property is true, then the radius units are degrees of arc, if not then the units are pixels. The default radius is 10.
// Draw a fixed circle with a radius of 25 pixels |
The SkyRelative property specifies whether the circle size is absolute or relative.
Circle.SkyRelative [Bool]
The default is false. If this property is true, then the radius of the circle is in degrees of arc, and the circle will resize with zooming. If it is false, then the circle radius is in pixels, and the circle will not change size as the view is zoomed.
// Draw a SkyRelative circle with a radius of 0.2 degrees of arc |
The SetCenter method specifies the center coordinates of the circle.
Circle.SetCenter(
ra [Double],
dec [Double]
)
This method does not return a value.
The default value for right ascension and declination is zero.
// Draw a circle at the center of the constellation Sagittarius |
The Poly object is used to render a polygon on the screen. The polygon can be filled with color, or unfilled, but is always a closed shape -- the last point entered for the polygon is connected to the first. It is created by the CreatePolygon method.
The Poly object inherits the properties of the Annotation object.
Property | Description |
| Fill | Specifies whether the polygon is filled or not. |
| FillColor | Specifies the fill color as an ARGB value. |
| LineColor | Specifies the line color as an ARGB value. |
| LineWidth | Specifies the line width in pixels. |
Method | Description |
| AddPoint | Adds a point to a polygon. |
The Fill property specifies whether the polygon is filled or not.
Poly.Fill [Bool]
The default fill setting is false.
// Fill a polygon with a slightly transparent blue |
The FillColor property specifies the fill color as an ARGB value.
Poly.FillColor [uint]
The default fill color is white. The four bytes of the unsigned integer are the alpha, red, green and blue values respectively.
// Set a solid red fill color |
The LineColor property specifies the line color as an ARGB value.
Poly.LineColor [uint]
The default color is white. The four bytes of the unsigned integer are the alpha, red, green and blue values respectively.
// Set a solid black line color |
The LineWidth property specifies the line width in pixels.
Poly.LineWidth [double]
The default line width is 1 pixel.
// Double the line width |
The AddPoint method adds a point to a polygon.
Poly.AddPoint(
x [Double],
y [Double]
)
This method does not return a value.
There is no theoretical limit to the number of points that can be added to a Poly object, however the number of points does affect performance -- so complex geometry should be simplified.
// The following function will add any number of points [ra, dec] to a polygon. |
The PolyLine object is used to render a polyline on the screen. A polyline cannot be filled, and is not a closed shape -- the last point is not connected back to the first. It is created by the CreatePolyLine method.
The PolyLine object inherits the properties of the Annotation object.
Property | Description |
| LineColor | Specifies the line color as an ARGB value. |
| LineWidth | Specifies the line width in pixels. |
Method | Description |
| AddPoint | Adds a point to the polyline. |
The LineColor property specifies the line color as an ARGB value.
PolyLine.LineColor [uint]
The default color is white. The four bytes of the unsigned integer are the alpha, red, green and blue values respectively.
// Set a solid blue color |
The LineWidth property specifies the line width in pixels.
PolyLine.LineWidth [double]
The default line width is 1 pixel.
poly.LineWidth = 3; |
The AddPoint method adds a point to a polyline.
PolyLine.AddPoint(
x [Double],
y [Double]
)
This method does not return a value.
There is no theoretical limit to the number of points that can be added to a PolyLine object, however the number of points does affect performance -- so complex geometry should be simplified.
// The following function will add any number of points [ra, dec] to a polyline. |
The Settings object is used to specify a range of settings for a View object. The Settings object is created as part of the initialization of a View object.
The Settings object is referenced from the Settings property of the View object.
Property | Description |
| ConstellationBoundryColor | Specifies the constellation boundary color as an ARGB value. |
| ConstellationFigureColor | Specifies the constellation figure color as an ARGB value. |
| ConstellationSelectionColor | Specifies the constellation selection color as an ARGB value. |
| EclipticColor | Specifies the ecliptic color as an ARGB value. |
| GridColor | Specifies the grid color as an ARGB value. |
| LocalHorizonMode | Specifies that the view should be from a local lat/long/alt position (for example, a city, or landmark). |
| LocationAltitude | Specifies the view location altitude in meters. |
| LocationLat | Specifies the view location latitude. |
| LocationLng | Specifies the view location longitude. |
| ShowClouds | Specifies whether to show the Earth's cloud layer. |
| ShowConstellationBoundries | Specifies whether to show constellation boundaries. |
| ShowConstellationFigures | Specifies whether to show constellation figures. |
| ShowConstellationSelection | Specifies whether to show only the selected constellation. |
| ShowCrosshairs | Specifies whether to show cross-hairs. |
| ShowEcliptic | Specifies whether to show the path of the Sun. |
| ShowFieldOfView | Specifies whether to show the field of view box. |
| ShowGrid | Specifies whether to show the equatorial grid. |
| ShowHorizon | Specifies whether to show the horizon. |
| ShowUTCTime | Specifies whether to show the time as a UTC value. |
| UserID | Specifies the user ID as a Guid. |
The ConstellationBoundryColor property specifies the constellation boundary color as an ARGB value.
Settings.ConstellationBoundryColor [uint]
The default boundary color is blue.
// |
The ConstellationFigureColor property specifies the constellation figure color as an ARGB value.
Settings.ConstellationFigureColor [uint]
The default figure color is red.
wwtView.Settings.ConstellationFigureColor= 0xAARRGGBB;
|
The ConstellationSelectionColor property specifies the constellation selection color as an ARGB value.
Settings.ConstellationSelectionColor [uint]
The default selection color is yellow.
wwtView.Settings.ConstellationSelectionColor= 0xAARRGGBB;
|
The EclipticColor property specifies the ecliptic color as an ARGB value.
Settings.EclipticColor [uint]
The default ecliptic color is green.
wwtView.Settings.EclipticColor= 0xAARRGGBB;
|
The GridColor property specifies the grid color as an ARGB value.
Settings.GridColor [uint]
The default equatorial grid color is gray.
wwtView.Settings.GridColor= 0xAARRGGBB;
|
The LocalHorizonMode property specifies that the view should be from a local lat/long/alt position (for example, a city, or landmark).
Settings.LocalHorizonMode [Bool]
This setting is equivalent to the View > View from this location checkbox, after setting up a local viewpoint.
wwtView.Settings.LocalHorizonMode = true;
|
![]() The view from New York of the Andromeda Constellation. Note the horizon and compass directions. |
![]() The view of Andromeda from the default viewing position, without any local horizon. |
The LocationAltitude property specifies the view location altitude in meters.
Settings.LocationAltitude [double]
None.
// Set the view from London, UK |
The LocationLat property specifies the view location latitude.
Settings.LocationLat [double]
The default location latitude is 47.633.
// Set the view from Sydney, Australia |
![]() |
The LocationLng property specifies the view location longitude.
Settings.LocationLng [double]
The default location longitude is 122.133333.
// Set the view from San Francisco, USA |
The ShowClouds property specifies whether to show the Earth's cloud layer.
Settings.ShowClouds [Bool]
This setting is equivalent to the Settings > Show Earth Cloud Layer checkbox. The viewer has to be a sufficient distance away from the surface of the Earth for the cloud cover to appear.
wwtView.Settings.ShowClouds = true;
|
![]() | The Earth without its cloud layer. |
![]() | The Earth with its cloud layer. |
The ShowConstellationBoundries property specifies whether to show constellation boundaries.
Settings.ShowConstellationBoundries [Bool]
This setting is equivalent to the View > Boundaries checkbox.
wwtView.Settings.ShowConstellationBoundries = true;
|
![]() The constellation boundaries are shown in blue, except for the selected constellation, with its boundary in yellow. |
The ShowConstellationFigures property specifies whether to show constellation figures.
Settings.ShowConstellationFigures [Bool]
This setting is equivalent to the View > Figures checkbox.
wwtView.Settings.ShowConstellationFigures = true;
|
![]() The constellation figures. |
The ShowConstellationSelection property specifies whether to show only the selected constellation.
Settings.ShowConstellationSelection [Bool]
This setting is equivalent to the View > Focused Only checkbox.
wwtView.Settings.ShowConstellationSelection = true;
|
![]() The selected constellation. |
The ShowCrosshairs property specifies whether to show cross-hairs.
Settings.ShowCrosshairs [Bool]
This setting is equivalent to the View > Reticle/Crosshairs checkbox.
wwtView.Settings.ShowCrosshairs = true;
|
![]() | The crosshairs, or reticle, shown with Mars in view. |
The ShowEcliptic property specifies whether to show the path of the Sun.
Settings.ShowEcliptic [Bool]
This setting is equivalent to the View > Ecliptic/Orbits checkbox, which indicates that the path of the Sun should be rendered as a line.
wwtView.Settings.ShowEcliptic = true;
|
![]() |
The ShowFieldOfView property specifies whether to show the field of view box.
Settings.ShowFieldOfView [Bool]
This setting is equivalent to the View > Field of View Indicator checkbox. The field of view box may not be visible in a view until the field of view is changed.
wwtView.Settings.ShowFieldOfView = true;
|
![]() Gamma Pegasi shown with the Field of View Indicator box. |
The ShowGrid property specifies whether to show the equatorial grid.
Settings.ShowGrid [Bool]
This setting is equivalent to the View > Equatorial Grid check box.
wwtView.Settings.ShowGrid = true;
|
![]() The Equatorial grid shown, looking North, with the Hydrogen Alpha Full Sky Map as the data source. |
The ShowHorizon property specifies whether to show the horizon.
Settings.ShowHorizon [Bool]
None.
wwtView.Settings.ShowHorizon = true;
|
The ShowUTCTime property specifies whether to show the time as a UTC value.
Settings.ShowUTCTime [Bool]
If this value is true, the time shown will be Universal Coordinated Time (or Greenwich Mean Time), and if it is false the time displayed will be local time.
wwtView.Settings.ShowUTCTime = true;
|
The UserID property is used to retrieve the user ID as a Guid.
Settings.UserID [Guid]
The Guid is in registry format, without the accompanying "{}" braces. When a user runs the client, a unique Guid is generated for them. The Guid is not persistent and will be different each time the same user runs the client. It can be used to identify a particular user during one session.
// Assume an input statement has been set up in the html code, such as: |
The View object is used to manage the current view of WorldWide Telescope images. It is the principal object in the object model, and handles the creation of the other objects.
The View object does not inherit any classes that have exposed properties or methods.
Property | Description |
| Fov | Contains the field of view in degrees. |
| Settings | Reference to the Settings object for the view. Note this object is created when the View object is created, so there is no specific call to create a Settings object. |
| SmoothAnimation | Specifies whether to pan smoothly or quickly to the new location. |
Method | Description |
| AddAnnotation | Adds an Annotation object to the view. |
| ClearAnnotations | Removes all annotations from the view. |
| CreateCircle | Creates a Circle object, and returns a reference to the created object. |
| CreatePolygon | Creates a Poly object (a polygon), and returns a reference to the created object. |
| CreatePolyLine | Creates a PolyLine object, and returns a reference to the created object. |
| GetDec | Retrieves the declination for the view. |
| GetRA | Retrieves the right ascension for the view. |
| Goto | Used to go to a new viewing position. |
| HideUI | Specifies whether to hide the UI for the view. |
| LoadImageCollection |
Used to load a WTML collection file, containing links to foreground and background images. |
| LoadTour | Used to load and start a tour. |
| LoadVOTable | Used to load a VO (Virtual Observatory) table. |
| PlayTour | Used to restart a tour from the beginning. |
| RemoveAnnotation | Removes the specified annotation from the view. |
| SetBackgroundImageByName | Loads an image to use as the view background. |
| SetForegroundImageByName | Loads an image to use as the view foreground. |
| SetForegroundOpacity | Specifies the opacity of the entire foreground image, which can be useful when visually comparing the foreground and background images. |
| StopTour | Used to stop and exit a tour. |
Event | Description |
| wwtAnootationclicked | Fired when an Annotation object is clicked on. Note the spelling error! |
| wwtArrived | Fired when a change to the view from a drag, zoom, or goto comes to a halt. |
| wwtClick | Fired when the left mouse button is clicked. |
| wwtReady | Fired when the web client is initialized. |
The Fov property contains the field of view in degrees.
View.Fov [double]
This property is read-only. The maximum field of view is 60 degrees, the minimum is close to zero, at 0.00022910934437488727 degrees. Field of view can be considered to be the inverse of the zoom factor -- the smaller the field of view the greater the zoom factor.
// Function to increase the field of view (zoom out) |
The Settings property references the Settings object for the view.
View.Settings [Settings]
This property is read-only, though individual settings can have their values set (refer to the Settings object).
wwtView.Settings.ShowCrosshairs = true; |
The SmoothAnimation property specifies whether to pan smoothly or quickly to the new location.
View.SmoothAnimation [Bool]
If this property is set to true the panning will be smoother but slower than if the property is false. This property is equivalent to the Settings/Smooth Panning checkbox in the UI, and the purpose of setting it to false is to improve CPU performance.
wwtView.SmoothAnimation = true;
|
The AddAnnotation method adds an Annotation object to the view.
View.AddAnnotation(
annotation [Annotation]
)
This method does not return a value.
An Annotation Object is inherited by the Circle object, the Poly object, and the PolyLine object, so adding an annotation will add one of these graphics to the view, in addition to providing the annotation text.
Typically one or more annotations are added to a view when a user clicks on a custom UI element such as a checkbox, and then those annotations are removed when the user deselects that UI element.
// Global settings |
The ClearAnnotations method removes all annotations from the view.
View.ClearAnnotations()
This method takes no parameters.
This method does not return a value.
None.
wwtView.ClearAnnotations();
|
The CreateCircle method creates a Circle object, and returns a reference to the created object.
View.CreateCircle(
fill [Bool]
)
This method returns a reference to a Circle object.
In addition to creating the circle an Annotation object (which is inherited by the Circle object) will be created to provide supporting text.
// Assume that a WWT view object has been created, and named wwtView |
![]() In this image, circle objects filled with a transparent color have been used to identify point sources of light. |
The CreatePolygon method creates a Poly object (a polygon), and returns a reference to the created object.
View.CreatePolygon(
fill [Bool]
)
This method returns a reference to the created Poly object.
In addition to creating the polygon an Annotation object (which is inherited by the poly object) will be created to provide supporting text.
// Assume that a WWT view object has been created, and named wwtView |
![]() This image shows the use of Polygon objects to identify a hierarchy of areas. If these areas are annotated, then increasingly detailed descriptions of the stellar sources can be given. |
The CreatePolyLine method creates a PolyLine object, and returns a reference to the created object.
View.CreatePolyLine(
fill [Bool]
)
This method returns a reference to a PolyLine object.
In addition to creating the polyline, an Annotation object (which is inherited by the polyline object) will be created to provide supporting text.
The rendering of a polyline will simply take each point in the list and draw a line to the next. In order to have a more complex polyline, for example with forks with two or more lines coming from a single point, then there are two main options, either create several polyline objects sharing a single point, or backtrack over points after reaching the end of one fork, and then continuing to add points along the second fork, and so on.
// Assume that a WWT view object has been created, named wwtView |
![]() This image shows some common variations of Polyline objects. |
The GetDec method retrieves the declination for the view.
View.GetDec()
This method takes no parameters.
This method returns a double containing the declination in decimal degrees.
The declination of an object is how many degrees it is north or south of the celestial equator. It is used in conjunction with right ascension, which is measured eastward from a prime meridian on the sky. The prime meridian passes through the position of the Sun at the time of the vernal equinox, so its position changes slowly over the years, due to the precession of the equinoxes. The position of the celestial poles also changes with precession, so to locate an object from its right ascension and declination, you must also know the date for which those coordinates are valid; that date is called the epoch of the coordinates. WorldWide Telescope requires the epoch to be J2000.
// Save off the current view... |
The GetRA method retrieves the right ascension for the view.
View.GetRA()
This method takes no parameters.
This method returns a double containing the right ascension in decimal degrees.
Refer to the remarks for GetDec.
// Function to zoom in.... |
The Goto method is used to go to a new viewing position.
View.Goto(
ra [Double],
dec [Double],
fov [Double],
instant [Bool]
)
This method does not return a value.
This method is one of the most used of the API set, controlling the changing of the views.
// The following code shows how to convert from hours, minutes and seconds |
The HideUI method specifies whether to hide the UI for the view.
View.HideUI(
hide [Bool]
)
This method does not return a value.
If the UI is hidden, the main menu, thumbnails, collections, tours and so on will not be visible, giving an uninterrupted view. This can be helpful when control of the view is being handled by a custom client UI.
var bShowUI = true; |
The LoadImageCollection method is used to load a WTML
collection file,
containing links to foreground and background images.
View.LoadImageCollection(
url [String]
)
This method does not return a value.
For a description of the content of image collection files, refer to the WorldWide Telescope Data Files Reference document.
After the collection is loaded, the images can be referenced by their string name using the SetBackgroundImageByName and SetForegroundImageByName methods.
// If the data file is in the same folder as the JScript Web Control. |
The LoadTour method is used to load and start a tour.
View.LoadTour(
url [String]
)
This method does not return a value.
Tours are a sequence of tour stops. Each tour stop describes a viewing position, with accompanying audio (music or speech), and graphics (text, shapes or images). The amount of time a tour should spend at each stop is specified, along with how the transition should be made (instant or slewing) to the next stop. Obviously when the last tour stop has been visited, the tour is completed. On completion the end tour dialog will appear.
![]() |
Tours can be stand-alone, or part of collections. For more information on tours refer to the WorldWide Telescope User Guide, and also to the WorldWide Telescope Data Files Reference document.
wwtView.LoadTour("http://www.worldwidetelescope.org/docs/wtml/tourone.wtt"); |
The LoadVOTable method is used to load a VO (Virtual Observatory) table.
View.LoadVOTable(
url [String],
useCurrentView [Bool]
)
This method does not return a value.
The VO data will appear as a spreadsheet in its own window. For details on the VO standard for storing data, refer to us-vo.org.
wwtView.LoadVOTable("path.xml", true); |
The PlayTour method is used to restart a tour from the beginning.
View.PlayTour()
This method takes no parameters.
This method does not return a value.
Refer to the remarks for the LoadTour method.
function restartTour() |
The RemoveAnnotation method removes the specified annotation from the view.
View.RemoveAnnotation(
annotation [Annotation]
)
This method does not return a value.
None.
// Global settings |
The SetBackgroundImageByName method loads an image to use as the view background.
View.SetBackgroundImageByName(
name [String]
)
This method does not return a value.
The string used as the name parameter for this method should be present as a
Place name in the .WTML
file loaded by the
LoadImageCollection method. Typically background images come from Survey data, such as
visible light, x-ray, infrared, ultraviolet, gamma, and
so on. In the UI of WorldWide Telescope, the background image is selected with
the Imagery entry, and if there is a foreground image, the
Image Crossfade slider will appear.
A background image need not cover the whole sky, and can in fact be a simple study of one object in space. In this case the rest of the sky will be dark and empty, except for the solar system which is not considered foreground or background.
![]() |
wwtView.LoadImageCollection("MyImageCollection.wtml"); |
The SetForegroundImageByName method loads an image to use as the view foreground.
View.SetForegroundImageByName(
name [String]
)
This method does not return a value.
The string used as the name parameter for this method should be present as a
Place name in the .WTML
file loaded by the
LoadImageCollection method.
There can be only one foreground image and only one
background image rendered at any one time. The typical use is to render
studies as foreground images on top of a survey as a background image.
If the opacity of the foreground image is solid, the background image will not be visible underneath. However if the SetForegroundOpacity method is used to add some transparency, then both foreground and background images will be visible, and can be compared. Typical use of these two layers is to load a visual survey as either foreground or background, and then to compare it with an x-ray, heat or image of another non-visible wavelength, enabling a visual comparison between the two.
In the UI of WorldWide Telescope the Explore
> Open > Collection menu selection is typically used to load
foreground images. If the WTML
collection file explicitly defines a study as a
background, or a survey as foreground, then this menu selection can be used to
reverse the normal process.
However, by default, studies loaded this way are treated as foreground, surveys
as background.
To load a survey as a foreground image, or a study as a background image, use Folder entries with the following structures. Note all the extra information needed in the Place entry for a study image.
|
<?xml version="1.0"?> <Folder> <Folder Name="Background Studies" Group="View" Searchable="True" Type="Sky"> <Place Name="Study One" DataSetType="Sky" RA="0" Dec="0" Constellation="0" Classification="0" Magnitude="0" Distance="0" ZoomLevel="0" Rotation="0" Angle="0" Opacity="100" AngularSize="1"> <Target>Undefined</Target> <BackgroundImageSet> <!-- Enter the study image set here <ImageSet </ImageSet> --> </BackgroundImageSet> </Place> </Folder> <!-- --> <Folder Name="Foreground Surveys" Group="Explorer"> <Place Name="Survey One"> <ForegroundImageSet> <!-- Enter the survey image set here <ImageSet </ImageSet> --> </ForegroundImageSet> </Place> </Folder> </Folder> |
The Sun and solar system planets and moons are not considered either foreground or background, and will be present in any sky view.
Note that the images used for both foreground and background are tiled image pyramids. Refer to the tools documentation WorldWide Telescope Data Tools Guide for details on how to create these image pyramids, and to the WorldWide Telescope Data Files Reference for details on the data file formats.
wwtView.LoadImageCollection("Serpens.wtml"); |
The "Serpens.wtml" file contains the following:
![]() |
The SetForegroundOpacity method specifies the opacity of the foreground image, which can be useful when visually comparing the foreground and background images.
This method is not currently implemented.
View.SetForegroundOpacity(
opacity [Double]
)
This method does not return a value.
This setting enables some see-through in the foreground image, to enable a comparison with the background image. Note that if the foreground image is a .png file, then some transparency information is usually held within the file. The SetForegroundImageByName method sets the foreground opacity to 1.0 each time a new image is loaded.
wwtView.SetForegroundOpacity(0.8);
|
The StopTour method is used to stop and exit a tour.
View.StopTour()
This method takes no parameters.
This method does not return a value.
After a tour has been stopped with this call, it cannot be restarted from the position it was stopped at. PlayTour (which restarts a tour) will not work after a tour has been stopped. Also refer to the remarks for LoadTour.
function loadTour(tourURL) { |
The wwtAnootationclicked event is fired when an Annotation object is clicked on. Note the spelling error!.
function wwtAnootationclicked(ra, dec, id){}
The id parameter contains the string set in the Annotation.ID property.
function wwtAnootationclicked(ra, dec, id) { |
The wwtArrived event is fired when a change to the view from a drag, zoom, or goto comes to a halt.
function wwtArrived(){}
When the view is to change following a drag, zoom, or goto, normally there will be an animated slew across space until the new view comes to rest. It is on the completion of the slew that this event is fired.
Currently this event is not being sent if the instant parameter of the Goto method is set to True.
function wwtArrived() { |
The wwtClick event is fired when the left mouse button is clicked.
function wwtClick(ra, dec){}
This event is not fired for all mouse clicks, only those when the view is stationary and the mouse click is not part of a zoom or drag procedure. In other words, it is evident that the user is clicking on an object. The RA and Dec provided as parameters are the location of the click, which will not usually be the same as the RA and Dec for the current view.
function wwtClick(ra, dec) { |
The wwtClick event is fired when the web client is initialized.
function wwtReady(){}
This event is fired only once, and should be responded to by all clients. Use it to initialize internal variables appropriately, in particular the reference to the View object, shown in the example code.
var wwtView; |
The following table lists the samples that can be used as a starting point for WorldWide Telescope web client development.
Click on the Sample Name to view the source. Note that paths may need to be changed for the samples to work, these paths are highlighted by comments in the sample code.
Sample Name | Description | Link |
Sky samples | ||
| WWT Web Client Simple |
Performs the basic steps of opening up a client, and provide a few UI controls to select one of two constellations, and change a few settings.
| Run |
| WWT Web Client Poly |
Adds the creation of two circle, one polygon and one polyline annotation objects to the simple client.
| Run |
| WWT Web Client Arrived |
Shows the use of the Arrived event, drawing a red circle on the new view when the event is received.
| Run |
| WWT Web Client Click Event |
Shows the use of the Click event, drawing a circle or an alert box giving the location of the click.
| Run |
| WWT Web Client Fov |
Shows the current Field of View, with buttons to zoom in and out.
| Run |
| WWT Web Client Local View |
Shows the view from a number of cities around the world.
| Run |
| WWT Web Client Images |
Loads a sample image collection, enabling the selection of one of three foreground images.
| Run |
| WWT Web Client Tours |
Loads and runs one of two simple tours of the Solar System.
| Run |
Earth samples | ||
| WWT Web Client Earth City Search |
Change the view to the Earth, then locate cities and lat/long locations.
| Run |
Planet samples | ||
| WWT Web Client Mars Explorer |
Change the view to Planets and the Imagery to Mars, then scroll through a range of surface features from the
Valles Marineris canyon to the Happy Face crater.
| Run |
Note that for samples to run correctly they must be located from a web address (http://...) and not from a local file address.
The following table lists some demonstration programs that have been created using the SDK.
Demo Name | Description | Link |
| WWT Web Client Hi-Def Planet Explorer |
Provides a range of options for exploring the surfaces of our Moon and Mars. Thousands of surface features, including craters, mountains, valleys, seas, plains, ridges and depressions,
are available to step through, sort, search and view.
Make sure to select the correct planet or moon in the Look At and Imagery drop down lists, after starting the program. | Run |
| WWT Web Client Distant Planet Explorer |
Provides a range of options for exploring the surfaces of Mercury, Venus, and the four main moons of Jupiter: IO, Ganymede, Europa and Callisto. Hundreds of surface features,
are available to step through, sort, search and view.
Make sure to select the correct planet or moon in the Look At and Imagery drop down lists, after starting the program. | Run |
| WWT Web Client Messier Catalog |
All 110 objects in this famous catalog can be viewed, displayed as a slide show, sorted and searched.
| Run |