Aladin Lite API namespace for creating celestial objects.
Example
// Usage example:
import { A } from 'aladin-lite';
const aladin = new A.aladin("#aladin-lite-div", { survey: 'your survey url', fov: 180, projection: 'SIN' });
Methods
(static) HiPS(id, optionsopt) → {HiPS}
Creates a HiPS image object
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
string | Can be:
|
|
options |
HiPSOptions |
<optional> |
Options describing the survey |
Returns:
- A HiPS image object
- Type
- HiPS
(static) MOCFromCone(circle, optionsopt, successCallbackopt, errorCallbackopt) → {MOC}
Creates a new MOC (Multi-Order-Coverage) from an object describing a cone on the sky
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
circle |
Object | A object describing a cone in the sky
Properties
|
|||||||||||||
options |
MOCOptions |
<optional> |
Display options for the MOC | ||||||||||||
successCallback |
function |
<optional> |
Callback function when the MOC loads | ||||||||||||
errorCallback |
function |
<optional> |
Callback function when the MOC fails loading |
Returns:
Returns a new MOC object
- Type
- MOC
(static) MOCFromJSON(jsonMOC, optionsopt, successCallbackopt, errorCallbackopt) → {MOC}
Creates a new MOC (Multi-Order-Coverage) from a JSON-like dictionary (javascript Object)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
jsonMOC |
Object | The MOC stores as a JSON-like dictionary | |
options |
MOCOptions |
<optional> |
Display options for the MOC |
successCallback |
function |
<optional> |
Callback function when the MOC loads |
errorCallback |
function |
<optional> |
Callback function when the MOC fails loading |
Returns:
Returns a new MOC object
- Type
- MOC
Example
var json = {
"3": [517],
"4": [2065,2066,2067,2112,2344,2346,2432],
"5": [8221,8257,8258,8259,8293,8304,8305,8307,8308,8452,8456,9346,9352,9354,9736],
"6": [32861,32862,32863,32881,32882,32883,32892,32893,33025,33026,33027,33157,33168,33169,33171,
33181,33224,33225,33227,33236,33240,33812,33816,33828,33832,37377,37378,37379,37382,37388,
37390,37412,37414,37420,37422,37562,38928,38930,38936,38948,38952],
"7": [131423,131439,131443,131523,131556,131557,131580,131581,132099,132612,132613,132624,132625,132627,132637,
132680,132681,132683,132709,132720,132721,132904,132905,132948,132952,132964,132968,133008,133009,133012,135252,135256,135268,135316,135320,135332,135336,148143,148152,148154,149507,149520
,149522,149523,149652,149654,149660,149662,149684,149686,149692,149694,149695,150120,150122,150208,150210,150216,150218,150240,150242,150243,155748,155752,155796,155800,155812,155816]
};
var moc = A.MOCFromJSON(json, {opacity: 0.25, color: 'magenta', lineWidth: 3});
aladin.addMOC(moc);
(static) MOCFromPolygon(polygon, optionsopt, successCallbackopt, errorCallbackopt) → {MOC}
Creates a new MOC (Multi-Order-Coverage) from an object describing a polygon on the sky
Parameters:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
polygon |
Object | A object describing a polygon in the sky
Properties
|
||||||||||
options |
MOCOptions |
<optional> |
Display options for the MOC | |||||||||
successCallback |
function |
<optional> |
Callback function when the MOC loads | |||||||||
errorCallback |
function |
<optional> |
Callback function when the MOC fails loading |
Returns:
Returns a new MOC object
- Type
- MOC
(static) MOCFromURL(url, optionsopt, successCallbackopt, errorCallbackopt) → {MOC}
Creates a new MOC (Multi-Order-Coverage) from an url
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
url |
string | The url to the MOC (e.g. stored as FITS file) | |
options |
MOCOptions |
<optional> |
Display options for the MOC |
successCallback |
function |
<optional> |
Callback function when the MOC loads |
errorCallback |
function |
<optional> |
Callback function when the MOC fails loading |
Returns:
Returns a new MOC object
- Type
- MOC
(static) Utils() → {AladinUtils}
Returns Utils object.
This contains utilitary methods such as HEALPix basic or projection methods.
Returns:
Returns a new box window object.
- Type
- AladinUtils
(static) aladin(divSelector, optionsopt) → {Aladin}
Creates an Aladin Lite instance within the specified HTML element.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
divSelector |
string | HTMLElement | The ID selector for the HTML element or the HTML element itself | |
options |
AladinOptions |
<optional> |
Options for configuring the Aladin Lite instance. |
Returns:
An instance of the Aladin Lite library.
- Type
- Aladin
Example
var aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {fullScreen: true, cooFrame: "ICRSd", showSimbadPointerControl: true, showShareControl: true, showShareControl: true, survey: 'https://alasky.cds.unistra.fr/DSS/DSSColor/', fov: 180, showContextMenu: true});
})
(static) box(options) → {Box}
Creates a box user interface for Aladin Lite.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Options for configuring the button.
Properties
|
Returns:
Returns a new box window object.
- Type
- Box
Example
let box = A.box({
header: {
title: "My window",
draggable: true,
},
// Adding a CSS class allowing you to position your window on the aladin lite view
classList: ['myBox'],
content: "This is the content of my window<br/> I can write proper html",
})
aladin.addUI(box)
(static) button(options) → {ActionButton}
Creates a user interface button for Aladin Lite
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Options for configuring the button.
Properties
|
Returns:
Returns a new button object representing the graphic overlay.
- Type
- ActionButton
Example
<!-- This example instanciates a customized button that when clicked, enters the user in
the polygonal selection mode. Once the polygon selection is done, the vertices are converted
to sky coords and a Multi-Order Coverage (MOC) is created from that list of sky coords. -->
<!doctype html>
<html>
<head>
</head>
<body>
<div id="aladin-lite-div" style="width: 512px; height: 512px"></div>
<script type="module">
import A from aladin-lite;
let aladin;
A.init.then(() => {
var aladin = A.aladin(
'#aladin-lite-div',
{
survey: 'P/allWISE/color', // set initial image survey
projection: 'AIT', // set a projection
fov: 1.5, // initial field of view in degrees
target: 'NGC 2175', // initial target
cooFrame: 'icrs', // set galactic frame
reticleColor: '#ff89ff', // change reticle color
reticleSize: 64, // change reticle size
showContextMenu: true,
}
);
let btn = A.button({
content: 'My button',
classList: ['myButton'],
tooltip: {cssStyle: {color: 'red'}, content: 'Create a moc in pink!', position: {direction: 'top'}},
action(o) {
aladin.select('poly', p => {
try {
let ra = []
let dec = []
for (const v of p.vertices) {
let [lon, lat] = aladin.pix2world(v.x, v.y);
ra.push(lon)
dec.push(lat)
}
let moc = A.MOCFromPolygon(
{ra, dec},
{name: 'poly', lineWidth: 3.0, color: 'pink'},
);
aladin.addMOC(moc)
} catch(_) {
alert('Selection covers a region out of the projection definition domain.');
}
})
}
});
aladin.addUI(btn)
});
</script>
<style>
.myButton {
position: absolute;
bottom: 0;
left: 0;
background-color: pink;
}
</style>
</body>
</html>
(static) catalog(options) → {Catalog}
Represents a catalog with configurable options for display and interaction.
Parameters:
Name | Type | Description |
---|---|---|
options |
CatalogOptions | Configuration options for the catalog. |
Returns:
- Type
- Catalog
(static) catalogFromNED(target, radius, optionsopt, successCallbackopt, errorCallbackopt) → {Catalog}
Create a catalog from a NED cone search query
Parameters:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
target |
string | Object | can be either a string representing a position or an object name, or can be an object with keys 'ra' and 'dec' (values being in decimal degrees)
Properties
|
||||||||||
radius |
number | Radius of the cone in degrees | ||||||||||
options |
CatalogOptions |
<optional> |
Additional configuration options for the catalogue. | |||||||||
successCallback |
function |
<optional> |
The callback function to execute on successful catalog creation. | |||||||||
errorCallback |
function |
<optional> |
The callback function to execute on error during catalog creation. |
Returns:
- Type
- Catalog
Example
A.catalogFromNED('09 55 52.4 +69 40 47', 0.1, {onClick: 'showPopup', shape: 'plus'})
(static) catalogFromSKAORucio(target, radiusDegrees, optionsopt, successCallbackopt, errorCallbackopt) → {Catalog}
Create a catalog from a SKAORucio cone search query
Parameters:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
target |
string | Object | can be either a string representing a position or an object name, or can be an object with keys 'ra' and 'dec' (values being in decimal degrees)
Properties
|
||||||||||
radiusDegrees |
number | Radius of the cone in degrees | ||||||||||
options |
CatalogOptions |
<optional> |
Additional configuration options for the catalogue. | |||||||||
successCallback |
function |
<optional> |
The callback function to execute on successful catalog creation. | |||||||||
errorCallback |
function |
<optional> |
The callback function to execute on error during catalog creation. |
Returns:
- Type
- Catalog
Example
A.catalogFromSKAORucio('09 55 52.4 +69 40 47', 0.1, {onClick: 'showPopup', shape: 'plus'})
(static) catalogFromSimbad(target, radius, optionsopt, successCallbackopt, errorCallbackopt) → {Catalog}
Create a catalog from a SIMBAD cone search query
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
target |
string | Object | can be either a string representing a position or an object name, or can be an object with keys 'ra' and 'dec' (values being in decimal degrees)
Properties
|
|||||||||||||||||||||
radius |
number | Radius of the cone in degrees | |||||||||||||||||||||
options |
Object | CatalogOptions |
<optional> |
Additional configuration options for SIMBAD cone search. See the SIMBAD cone search parameters.
Properties
|
||||||||||||||||||||
successCallback |
function |
<optional> |
The callback function to execute on successful catalog creation. | ||||||||||||||||||||
errorCallback |
function |
<optional> |
The callback function to execute on error during catalog creation. |
Returns:
A new instance of the Catalog class created from the SIMBAD cone search.
- Type
- Catalog
Example
A.catalogFromSimbad('09 55 52.4 +69 40 47', 0.1, {onClick: 'showTable', limit: 1000}, (cat) => {
aladin.addCatalog(cat)
});
(static) catalogFromSkyBot(ra, dec, radius, epoch, queryOptions, optionsopt, successCallbackopt, errorCallbackopt) → {Catalog}
Create a catalog from a SkyBot cone search query
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
ra |
number | Right Ascenscion in degrees of the cone's center | |
dec |
number | Declination in degrees of the cone's center | |
radius |
number | Radius of the cone in degrees | |
epoch |
string | Requested epoch, expressed in Julian day or ISO dateTime | |
queryOptions |
Object | options passed to SkyBot, see https://vo.imcce.fr/webservices/skybot/?conesearch | |
options |
CatalogOptions |
<optional> |
Additional configuration options for the catalogue. |
successCallback |
function |
<optional> |
The callback function to execute on successful catalog creation. |
errorCallback |
function |
<optional> |
The callback function to execute on error during catalog creation. |
Returns:
- Type
- Catalog
(static) catalogFromURL(url, optionsopt, successCallbackopt, errorCallbackopt, useProxyopt) → {Catalog}
Asynchronously creates a new catalog instance from the specified URL with additional options.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
url |
string | The URL of the catalog. | ||
options |
CatalogOptions |
<optional> |
Additional configuration options for the catalog. | |
successCallback |
function |
<optional> |
The callback function to execute on successful catalog creation. | |
errorCallback |
function |
<optional> |
The callback function to execute on error during catalog creation. | |
useProxy |
boolean |
<optional> |
false | Indicates whether to use a proxy for loading the catalog. |
Returns:
A new instance of the Catalog class created from the specified URL.
- Type
- Catalog
Example
// Create a catalog from a URL using the A.catalogFromURL method
const catalogURL = "https://example.com/catalog";
const catalogOptions = {
name: "My Catalog",
color: "#ff0000",
sourceSize: 10,
// ... other options
};
const myCatalog = A.catalogFromURL(
catalogURL,
catalogOptions,
(catalog) => {
// Catalog successfully loaded
aladin.addCatalog(catalog)
},
(error) => {
// Error loading catalog
console.error("Error loading catalog:", error);
},
);
(static) catalogFromVizieR(vizCatId, target, radius, optionsopt, successCallbackopt, errorCallbackopt) → {Catalog}
Create a catalog from a SKAORucio cone search query
Parameters:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
vizCatId |
string | the id of the ViZieR catalog | ||||||||||
target |
string | Object | can be either a string representing a position or an object name, or can be an object with keys 'ra' and 'dec' (values being in decimal degrees)
Properties
|
||||||||||
radius |
number | Radius of the cone in degrees | ||||||||||
options |
CatalogOptions |
<optional> |
Additional configuration options for the catalogue. | |||||||||
successCallback |
function |
<optional> |
The callback function to execute on successful catalog creation. | |||||||||
errorCallback |
function |
<optional> |
The callback function to execute on error during catalog creation. |
Returns:
- Type
- Catalog
Example
const cat = A.catalogFromVizieR('I/311/hip2', 'M 45', 5, {onClick: 'showTable'});
const cat2 = A.catalogFromVizieR('I/311/hip2', '12 +9', 5, {onClick: 'showTable'});
(static) catalogHiPS(url, options) → {ProgressiveCat}
Creates progressive catalog object (i.e. Simbad/Gaia)
Parameters:
Name | Type | Description |
---|---|---|
url |
string | Root url of the catalog |
options |
CatalogOptions | Options for configuring the catalogue. |
Returns:
Returns a new Overlay object representing the graphic overlay.
- Type
- ProgressiveCat
Example
let gaia = A.catalogHiPS('http://axel.u-strasbg.fr/HiPSCatService/I/345/gaia2', {onClick: 'showTable', color: 'orange', name: 'Gaia', filter: myFilterFunction});
aladin.addCatalog(gaia)
(static) circle(ra, dec, radiusDeg, options) → {Circle}
Creates a circle shape
Parameters:
Name | Type | Description |
---|---|---|
ra |
number | Right Ascension (RA) coordinate of the center in degrees. |
dec |
number | Declination (Dec) coordinate of the center in degrees. |
radiusDeg |
number | Radius in degrees. |
options |
ShapeOptions | Options for configuring the circle. |
Returns:
- Type
- Circle
(static) coo(longitude, latitude, prec) → {Coo}
Creates a new coo from a longitude and latitude given in degrees
Parameters:
Name | Type | Description |
---|---|---|
longitude |
number | longitude (decimal degrees) |
latitude |
number | latitude (decimal degrees) |
prec |
number | precision (8: 1/1000th sec, 7: 1/100th sec, 6: 1/10th sec, 5: sec, 4: 1/10th min, 3: min, 2: 1/10th deg, 1: deg |
Returns:
Returns a new Coo object
- Type
- Coo
(static) ellipse(ra, dec, radiusRaDeg, radiusDecDeg, rotationDeg, options) → {Ellipse}
Creates an ellipse shape
Parameters:
Name | Type | Description |
---|---|---|
ra |
number | Right Ascension (RA) coordinate of the center in degrees. |
dec |
number | Declination (Dec) coordinate of the center in degrees. |
radiusRaDeg |
number | the radius along the ra axis in degrees |
radiusDecDeg |
number | the radius along the dec axis in degrees |
rotationDeg |
number | the rotation angle in degrees |
options |
ShapeOptions | Options for configuring the ellipse. |
Returns:
- Type
- Ellipse
(static) footprint(shapes, sourceopt) → {Footprint}
Creates a new footprint from an array of polygons and optionally a source
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
shapes |
Array.<Circle> | Array.<Polyline> | Array.<Ellipse> | Array.<Vector> | an array of A.polygon objects | |
source |
Source |
<optional> |
a A.source object associated with the footprint |
Returns:
Returns a new Footprint object
- Type
- Footprint
(static) footprintsFromSTCS(stcs, optionsopt) → {Array.<(Polyline|Circle)>}
Parse shapes from a STC-S string
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
stcs |
string | The STC-S string describing the shapes | |
options |
ShapeOptions |
<optional> |
Options for the shape |
Returns:
Returns a list of shapes from the STC-S string
(static) graphicOverlay(options) → {Overlay}
Creates a graphic overlay on the Aladin Lite view.
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Options for configuring the graphic overlay.
Properties
|
Returns:
Returns a new Overlay object representing the graphic overlay.
- Type
- Overlay
Example
var overlay = A.graphicOverlay({ color: '#ee2345', lineWidth: 3, lineDash: [2, 4]});
(static) image(url, optionsopt) → {Image}
Creates a celestial source object with the given coordinates.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
url |
string | Options describing the fits file. An url is mandatory | |
options |
ImageOptions |
<optional> |
Options describing the fits file. An url is mandatory |
Returns:
- A HiPS image object
- Type
- Image
Example
aladin.setOverlayImageLayer(A.image(
"https://nova.astrometry.net/image/25038473?filename=M61.jpg",
{
name: "M61",
imgFormat: 'jpeg',
wcs: {
NAXIS: 0, // Minimal header
CTYPE1: 'RA---TAN', // TAN (gnomic) projection
CTYPE2: 'DEC--TAN', // TAN (gnomic) projection
EQUINOX: 2000.0, // Equatorial coordinates definition (yr)
LONPOLE: 180.0, // no comment
LATPOLE: 0.0, // no comment
CRVAL1: 185.445488837, // RA of reference point
CRVAL2: 4.47896032431, // DEC of reference point
CRPIX1: 588.995094299, // X reference pixel
CRPIX2: 308.307905197, // Y reference pixel
CUNIT1: 'deg', // X pixel scale units
CUNIT2: 'deg', // Y pixel scale units
CD1_1: -0.000223666022989, // Transformation matrix
CD1_2: 0.000296578064584, // no comment
CD2_1: -0.000296427555509, // no comment
CD2_2: -0.000223774308964, // no comment
NAXIS1: 1080, // Image width, in pixels.
NAXIS2: 705 // Image height, in pixels.
},
successCallback: (ra, dec, fov, image) => {
aladin.gotoRaDec(ra, dec);
aladin.setFoV(fov * 5)
}
},
));
(static) imageHiPS()
(async, static) init() → {Promise.<void>}
Initializes the Aladin Lite library, checking for WebGL2 support.
This method must be called before instancing an Aladin Lite object.
Throws:
-
Throws an error if WebGL2 is not supported by the browser.
- Type
- string
Returns:
A promise that resolves once the initialization is complete.
- Type
- Promise.<void>
Example
// Usage example:
A.init
.then(async () => {
const aladinInstance = A.aladin('div', requestedOptions);
// Perform further actions with the Aladin Lite instance
})
.catch(error => {
console.error('Error initializing Aladin Lite:', error);
});
(static) marker(ra, dec, optionsopt, dataopt) → {Source}
Creates a marker at the specified celestial coordinates.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
ra |
number | Right Ascension (RA) coordinate in degrees. | |
dec |
number | Declination (Dec) coordinate in degrees. | |
options |
MarkerOptions |
<optional> |
Options for configuring the marker. |
data |
Object |
<optional> |
Additional data associated with the marker. |
Returns:
A marker source object.
- Type
- Source
Example
const markerObj = A.marker(180.0, 30.0, data, options);
(static) polygon(radecArray, options) → {Polyline}
Creates a polygon object using an array of celestial coordinates (RA, Dec).
Parameters:
Name | Type | Description |
---|---|---|
radecArray |
Array.<Array.<number>> | right-ascension/declination 2-tuple array describing the polyline's vertices in degrees |
options |
ShapeOptions | Options for configuring the polygon |
Throws:
-
Throws an error if the number of vertices is less than 3.
- Type
- string
Returns:
- Type
- Polyline
(static) polyline(radecArray, options) → {Polyline}
Creates a polyline shape
Parameters:
Name | Type | Description |
---|---|---|
radecArray |
Array.<Array.<number>> | right-ascension/declination 2-tuple array describing the polyline's vertices in degrees |
options |
ShapeOptions | Options for configuring the polyline. |
Returns:
- Type
- Polyline
(static) source(ra, dec, dataopt, optionsopt) → {Source}
Creates a celestial source object with the given coordinates.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
ra |
number | Right Ascension (RA) coordinate in degrees. | |
dec |
number | Declination (Dec) coordinate in degrees. | |
data |
Object |
<optional> |
Additional data associated with the source. |
options |
SourceOptions |
<optional> |
Options for configuring the source object. |
Returns:
A celestial source object.
- Type
- Source
Example
const sourceObj = A.source(180.0, 30.0, data, options);
(static) vector(ra1, dec1, ra2, dec2, options) → {Vector}
Creates a vector shape
Parameters:
Name | Type | Description |
---|---|---|
ra1 |
number | Right Ascension (RA) coordinate of the center in degrees. |
dec1 |
number | Declination (Dec) coordinate of the center in degrees. |
ra2 |
number | Right Ascension (RA) coordinate of the center in degrees. |
dec2 |
number | Declination (Dec) coordinate of the center in degrees. |
options |
ShapeOptions | Options for configuring the vector. |
Returns:
- Type
- Vector