Skip to content
Bastien Fiorito edited this page Jan 28, 2016 · 61 revisions
Table of Contents

1 - Overview
2 - Embedding in a web page
3 - JavaScript API
_ 3.1 - Create a Mizar instance
___ 3.1.1 - Basic options
___ 3.1.2 - Navigation options
___ 3.1.3 - Stats
___ 3.1.4 - Services
_ 3.2 - Set the GUI elements
_ 3.3 - Point to a given location
_ 3.4 - Get the current fov
_ 3.5 - Go to a FOV level
_ 3.6 - Add a layer
___ 3.6.1 - Opensearch layer
___ 3.6.2 - GeoJson layer
___ 3.6.3 - HIPS layer
___ 3.6.4 - Background Layer
_____ 3.6.4.1 - Set a predefined background survey
_____ 3.6.4.2 - Set a custom background survey
___ 3.6.5 - Add grid information
___ 3.6.6 - Planet layers
___ 3.6.7 - MOC layer
_3.7 - Operations on layers
___ 3.7.1 - Get all layers
___ 3.7.2 - Get layer
___ 3.7.3 - Get all observations from a layer
___ 3.7.4 - Remove a layer
___ 3.7.5 - Remove observation from a layer
___ 3.7.6 - Get metadata from an observation
____3.7.7 - Handel opacity
___ 3.7.8 - Handle visibility
___ 3.7.9 - Highlight a shape
___ 3.7.10 - Request MOC for an existing layer
___ 3.7.11 - xMatch several MOCs
___ 3.7.12 - Request_remove FITS
_3.8 - How the GeoJSON layer is represented in MIZAR
_3.9 - Data transfer with SAMP
_3.10 - Convert VOTable to JSON
_3.11 - Handling rendering
4 - Usage example

## 1 - Overview Mizar Widget is a sky visualization tool running in a browser and able to both embed Mizar in a web page and to handle it through its JavaScript API. ## 2 - Embedding in a web page
<!-- you can skip the following line if your page already integrates the jQuery library --> 
<script type="text/javascript" src="http://voparis-sitools.obspm.fr/sitools/app/api/v1/jquery-1.9.1.min.js" charset="utf-8"></script>
<!-- insert this snippet where you want MizarWidget viewer to appear and after the loading of jQuery -->
<div id="mizarWidget-div" width="400" height="400"></div>
<script type="text/javascript" src="http://mizarlite.ias.u-psud.fr/MizarWidget.min.js" charset="utf-8"></script>
<script type="text/javascript">
window.onload = function(){
    var options = {};
    var mizar = new MizarWidget('#mizarWidget-div', options);
}
</script>
## 3 - JavaScript API This JavaScript will let you to create your own instance of Mizar bound to a given div element of your web page. This API provides methods to interact in your web page with the navigation, data and services of MIZAR. A description of this API is available as below. ### 3.1 - Create a Mizar instance Insert the embedding code in your web page. ```javascript var options = { "coordSystem": "EQ", "stats": { "visible": true }, "sitoolsBaseUrl": "http://demonstrator.telespazio.com/sitools", "navigation": { "initTarget": [0,0], "initFov": 20, "minFov": 0.001, "zoomFactor": 0 }, "nameResolver": { "zoomFov": 2 } }; var mizar = new MizarWidget('#mizarWidget-div', options); ```

After calling, the variable mizar is the reference to Mizar instance.

The different options are the following :

### 3.1.1 - Basic options | Key | Description | Expected value | Default value | | ------------- |:----------------------------------------------:| -------------------:|---------------:| | coordSystem | The initial coordinate system | Either EQ or GAL | EQ | | sitoolsBaseUrl| The url to SiTools2 server | String | http://demonstrator.telespazio.com/sitools | | debug | Mode debug | Either true or false| false | ### 3.1.2 - Navigation options | Key | Description | Expected value | Default value | | ------------- |:----------------------------------------------:| -------------------:|---------------:| | initTarget | The initial position when Mizar starts |An array with coordinates (latitude and longitude) in decimal degrees in the system defined by initCoordinateSystems parameter | [0,0]| | minFov | The minimum field of view that Mizar can reach | A numerical value > 0 | 0.001 | | initFov | The field of view in degree of the viewport when Mizar starts |0 < A numerical value < 180 | 20 | | zoomFactor |The zoom factor that is applied when the user zooms in/out< | A numerical value >= 0 | 0 | inertia | Use the inertia effect of the globe | Either true or false | false | ### 3.1.3 - Stats | Key | Description | Expected value | Default value | | ------------- |:----------------------------------------------:| -------------------:|---------------:| | verbose | Verbose mode |Either true or false | false | | visible | Is visible | Either true or false| false | ### 3.1.4 - Services In order to take the full benefit from using Mizar, there are services which are provided by SiTools2. Basically the initialization of "sitoolsBaseUrl" will be sufficient, but if you want to use your own service, it's still possible by defining "baseUrl" property for the following services:
Service Option name
Name resolver nameResolver
Reverse name resolver reverseNameResolver
Moc service coverageService
Solar objects solarObjects
Cut out cutOut
Healpix cut healpixCut
Context sharing shortener
Interconnection between applications using SAMP votable2geojson

Example:

Name Resolver

You can define your own Name Resolver by specifing a jsObject. 3 Name Resolver are already available :

  • DefaultNameResolver : to use by default
  • CDSNameResolver : to use when CDS Name Resolver Url is specified
  • DictionaryNameResolver : to use on Planet Layer
"nameResolver" : {
    "zoomFov": 2,
    "jsObject" : "./name_resolver/DefaultNameResolver"
}
"nameResolver" : {
    "zoomFov": 2,
    "jsObject" : "./name_resolver/CDSNameResolver",
    "baseUrl" : "http://..."
}
"nameResolver" : {
    "zoomFov": 2,
    "jsObject" : "./name_resolver/DictionaryNameResolver",
    "baseUrl" : "http://mizar/mars_resolver.json"
}

Some of these services must be defined on layer initialization in "availableServices" parameter, such as:

  • OpenSearch : used to filter the open search results
  • Moc : used to show(if it possible) the coverage(moc) layer for the given open search layer
  • XMatch : used to extract the common coverage between two layers

Example:

mizar.addLayer({
    "category": "Image",
    "type": "DynamicOpenSearch",
    "name": "Iso",
    "serviceUrl": "http://demonstrator.telespazio.com/sitools/iso",
    "availableServices": [ "Moc", "XMatch" ]
});
### 3.2 - Set the GUI elements When embedding Mizar in the web page, it is possible to show or hide some GUI elements. ![](https://raw.githubusercontent.com/SITools2/MIZAR/gh-pages/images/GUI.png "MIZAR GUI") In the following table, you will find the different methods to call so that you can control which element you want to show/hide.
GUI Element Description Method Option name
Compass The compass to show the orientation in the sky setCompassGui(boolean) false
Name resolver The search position element setNameResolverGui(boolean) false
2D map The 2D map to know the position in the sky set2dMapGui(boolean) false
ShortenerUrl The link to share the current Mizar widget view setShortenerUrlGui(boolean) false
Samp The Samp protocol to allow communication between VO tools setSampGui(boolean) false
Category The category menu setCategoryGui(boolean) false
Angle distance The angle distance GUI to measure an angle distance setAngleDistanceGui(boolean) false
ReverseNameResolver The reverse name resolver GUI setReverseNameResolverGui(boolean) false
Image viewer The loaded images viewer setImageViewerGui(boolean) false
Position tracker Position tracker to display the mouse position in the current coordinate system setPositionTrackerGui(boolean) true
### 3.3 - Point to a given location To point to a given location with Mizar, use the following method `goTo(position, callback)` where position can be expressed as: * coordinates in hms/dms in the reference frame : `mizar.goTo("0:42:14.33 41:16:7.5")` * coordinates in decimal degree in the reference frame : `mizar.goTo("11.11 41.3")` * object name : `mizar.goTo("m31", function(response){ console.log(response.features) });` and callback is a function to be called on name resolver request success, which gets passed the result of search if the position has been expressed as object name. ### 3.4 - Get the current fov To get the current field of view(fov) use the following command: `mizar.getCurrentFov();` ### 3.5 - Go to a FOV level To set the FOV level with Mizar, use the following method `mizar.setZoom(fovInDegrees, callback)` where: * fovInDegrees is expressed in decimal degrees and takes the value in range [0, 180] * callback is a function to be called at the end of animation. ### 3.6 - Add a layer Five types of layers are available with Mizar : * OpenSearch layer : Must be used if you want to display overlays with a number of records > 10000. The openSearch layer allows clients to search data on the server according to Healpix index and order numbers. * GeoJson layer : Must be used if you want to load the whole file in memory to display overlay. Since it's loaded in memory, there could be some performance issues when the number of loaded features is more than 10000. * HIPS layer : Must be used to display only images * Grid coordinates : Currently there are two coordinate systems supported : Equatorial & Galactic. * Planet layers : Layers which used to represent planet raster data, based on WMS service. #### 3.6.1 - OpenSearch layer To add an opensearch Layer, use the following command: ```javascript var openSearchDesc = { "category": "Herschel-SAG4", "type": "DynamicOpenSearch", "dataType": "line", "name": "Pacs-SAG4-Herschel", "serviceUrl": "http://demonstrator.telespazio.com/sitools/oherschel", "visible": false, "description": "SAG-4 : Evolution of interstellar dust (Herschel Guaranteed Time Key Project prepared by the ISM Specialist Astronomy Group of the SPIRE consortium) ", "attribution": "SAG4 provided by ", "minOrder": 4, "availableServices": [ "OpenSearch", "Moc", "XMatch" ] } mizar.addLayer(openSearchDesc); ``` where the description contains the following properties:
Key Description Expected Value Default value
Required
type The layer type DynamicOpenSearch /
name The layer name A short string /
serviceUrl The url to opensearch service A short string /
Optional
category the category name to group the layer within a menu A short string "Other"
description The layer description A long string ""
attribution The layer attribution A HTML string ""
minOrder the Healpix order (according to the FOV of the viewport) from which the clients queries the server. We need this parameter because openSearchLayer can be interfaced with VO servers. And, the VO servers do not support the pagination and some of them cuts the response after a certain number of rows. In order to ensure the coherence of the data representation when the clien zoom in, we need to define the order from which the response is not cut A number > 3 5
visible Set to true to make the layer visble Either true or false true
color HTML color of the overlay. If none, an automatic color is set HTML color Random color
dataType Datatype to represent in the menu Either line or point "line"
opacity The layer opacity A decimal in [0, 1] 1
availableServices Set the services that can be applied on the layer The array containing the names of available services. For more details see: 3.1.4 []
displayProperties List of keywords to present. The others keywords are presented in "others" keyword example : identifier, title []
#### 3.6.2 - GeoJson layer To add a GeoJson Layer, use the following command:
```javascript var geoJsonDesc = { "category": "Other", "type": "GeoJSON", "name": "Herschel testing layer", "description": "Herschel response used for testing", "data": { "type": "JSON", "url": "data/responseHerschel.json", }, "visible": true, "pickable" : true }; var geoJsonLayer = mizar.addLayer(geoJsonDesc); ``` where the available options are the following:
Key Description Expected Value Default value
Required
name The layer name A short string /
type The layer type GeoJSON /
data The required value to represent the type of json JSON
For more details see the paragraph below
/
Optional
category the category name to group the layer within a menu A short string "Other"
description The layer description A long string ""
attribution The layer attribution A HTML string ""
minOrder the Healpix order (according to the FOV of the viewport) from which the clients queries the server. We needs this parameter because openSearchLayer can be interfaced with VO servers. And, the VO servers do not support the pagination and some of them cut the response after a certain number of rows. In order to insure the coherence of the data representation when the clien zoom in, we need to define the order from which the response is not cut A number > 3 5
visible Set to true to make the layer visible Either true or false true
color HTML color of the overlay. If none, an automatic color is set HTML color Random color
dataType Datatype to represent in the menu Either line or point "line"
availableServices Set the services that can be applied on the layer The array containing the names of available services. For more details see: 3.1.4 []

There are several special json providers which are predefined in Mizar as: "Constellations", "Stars" and "planets". These are very special so if you need more information about how they are implemented, please look the source code :) To load a basic JSON file in Mizar as a GeoJSON layer, the "data" property is described by following options:

Key Description Expected Value Default value
Required
type The type of json A short string JSON
url The url to GeoJSON file to load / /
#### 3.6.3 - HIPS layer To add a HIPS Layer, use the following command: ```javascript var myHipsLayerDesc = { "category": "Image", "type": "healpix", "name": "LFIColor Planck", "baseUrl" : "http://demonstrator.telespazio.com/sitools/Alasky/PLANCK/LFIColor30-44-70", "description": "Planck survey from CDS", "visible": false, "format": "jpg", "attribution": "Planck backbround from ", "background": false }; mizar.addLayer(myHipsLayerDesc) ``` where the available options are the following:
Key Description Expected Value Default value
Required
name The layer name A short string /
type The layer type "healpix" /
baseUrl The URL of the HIPS (Healpix images) URL /
background A boolean to indicate that layer is an overlay false /
Optional
category the category name to group the layer within a menu A short string "Other"
description The layer description A long string ""
attribution The layer attribution A HTML string ""
numberOfLevels The number of levels in the HIPS data A number > 3 5
visible Set to true to make the layer visble Either true or false true
color HTML color of the overlay. If none, an automatic color is set HTML color Random color
format Format of the HIPS Either "jpg" or "png" jpg
fitsSupported Set to true to represent FITS file in order to change the whole dynamic of the image Either true or false false
availableServices Set the services that can be applied on the layer The array containing the names of available services. For more details see: 3.1.4 []
#### 3.6.4 - Background layer ##### 3.6.4.1 - Set a predefined background survey There are several background surveys that are predefined by Mizar, which you can find in "data/backgroundSurveys.json".

To set a background survey with Mizar, use the following command : mizarWidget.setBackgroundSurvey(surveyName) Where surveyName can be :

  • WISE RGB
  • SpitzerI1I2I4color
  • IRIS
  • 2MASS
  • RASS
  • NVSS
  • DSS
  • SDSS
  • PlanckCMB
  • Planck-HFI-857
  • Planck-HFI-545
  • Planck-HFI-353
  • Planck-HFI-217
  • Planck-HFI-143
  • Planck-HFI-100
  • W DR4-94GHz-3.2mm
  • V DR4-61GHz-4.9mm
  • Q DR4-41GHz-7.3mm
  • Ka DR4-33GHz-9.1mm
  • K DR4-23Ghz-13mm
##### 3.6.4.2 - Set a custom background survey To set a custom background survey, use the following command: ```javascript var customSurveyDescription = { "type": "healpix", "name": "Planck LFIColor30-44-70", "baseUrl": "http://demonstrator.telespazio.com/sitools/Alasky/PLANCK/LFIColor30-44-70", "icon": "css/images/star_icon.png", "visible": false, "background": true, "coordSystem": "GAL", "attribution": "Planck background from ", "numberOfLevels": 1 }; mizar.setCustomBackgroundSurvey(customSurveyDescription); ``` where the description options are described as below :
Key Description Expected value Default value
Required
name Name of the layer, which can be displayed A short string /
type The layer type "healpix" /
baseUrl The URL of the HIPS (Healpix images) URL /
background A boolean to indicate that layer is a background true /
Optional
description Description of the layer, which can be displayed A long string ""
coordSystem either EQ (Equatorial J2000) or GAL (Galactic) Enum("EQ" or "GAL") "EQ"
attribution Copyright of the layer, which is displayed A HTML string ""
numberOfLevels Number of levels of HIPS A numerical value >= 3 5
format HIPS format Either jpg or png jpg
fitsSupported Set to true when FITS is available in HIPS. This allows to load the FITS in a histogram and to change the cut Either true or false false
### 3.6.5 - Add grid information In addition to data, adaptative grid information can be displayed as below:
```javascript var gridDesc = { "category": "Coordinate systems", "type": "coordinateGrid", "name": "Equatorial grid", "visible": false, "coordSystem": "EQ", "color": "white", "latFormat": "DMS", "longFormat": "HMS" } mizar.addLayer(gridDesc); ``` The grid description options are described in the following table:
Key Description Expected value Default value
Required
name Name of the grid in the GUI A string /
type The layer type "coordinateGrid" /
Optional
category Category where the grid is grouped in the GUI A string "Other"
coordSystem Coordinate system represented by grid Enum("EQ" or "GAL") "EQ"
visible Set to true when the grid must be visible Either true or false true
color Set the color of the grid (RGB code, RGB code in hex, human color) a color white
latFormat Type of format for displaying the latitude Either DMS or Deg Deg
longFormat Type of format for displaying the longitude Either HMS or Deg Deg
opacity Opacity of the grid. When 0 is set, the layer is not visible anymore A decimal value in [0, 1] 1
### 3.6.6 Planet layers

By default Mizar provides 2 planet layers : "Mars" & "Earth". To view the planet layer use: mizar.viewPlanet(planetName); where planet name is "Mars" or "Earth".
You can also add your custom planet layer with the following snippet:

var planetDesc = {
    "category": "Planets",
    "type": "Planet",
    "name": "Venus",
    "nameResolverURL": "http://demonstrator.telespazio.com/mizar/data/venus_resolver.json",
    "elevation": {
        "baseUrl": "http://demonstrator.telespazio.com/wcspub",
        "coverage": "VENUS_TOPO",
        "version": "1.0.0"
    },
    "baseImageries": [
        {
            "name": "VenusMOC",
            "baseUrl": "http://demonstrator.telespazio.com/venus",
            "layers": "WMS-LayerName",
            "format": "image/png"
        }[,
        {
            .. other WMS layer
        }]
    ]
}
mizar.addLayer(planetDesc);
mizar.viewPlanet("Venus");

Or, if the planet layer already exists(the case of : "Mars" & "Earth"), you can add new WMS layer to it by following snippet:

var marsLayer = mizar.getLayer("Mars");
var planetDesc = {
   "name": "Mars Mola",
   "type": "WMS",
   "category": "Planets",
   "visible": false,
   "baseUrl": "http://demonstrator.telespazio.com/ms-mars",
   "layers": "MOLA_Color",
   "format": "image/png",
   "attribution": "my attribution"
};
mizar.addLayer(planetDesc,marsLayer);

The planet description options are described in the following table: Basic options:

Key Description Expected value Default value
Required
name Name of planet in the GUI A string /
type The layer type "Planet" /
Optional
category Category where the grid is grouped in the GUI A string "Other"
nameResolverURL Name resolver SiTools service or json dictionary The URL ""
opacity Opacity of the grid. When 0 is set, the layer is not visible anymore A decimal value in [0, 1] 1

You can add elevation layer to your planet within "elevation" option, which could be parametrized with following options:

Key Description Expected value Default value
Required
baseUrl The URL to the WCS service supporting image/x-aaigrid format The URL /
coverage The name of coverage to use /
Optional
crs the coordinate reference system to use A string "EPSG:4326"
version Version of wcs standard A string : "2.0.x" or "1.0.x" is supported 2.0.0
scale Elevation scale value A decimal positive value 1

To vizualize the planet, you must define WMS layers which could be described within "baseImageries" property. Each base imagery could be parametrized with following options:

Key Description Expected value Default value
Required
name The layer name which will be displayed in selectmenu A string /
baseUrl The URL to the WMS service The URL /
layers The list of layers to request A string with layer names separated by "," character /
Optional
srs The spatial system reference to use A string "EPSG:4326"
version Version of wms standard A string 1.1.1
format The file format to request A string 'image/jpeg'

For more details see: Mars example

### 3.6.7 - MOC layer In addition to data, a MOC in ICRS reference frame can be displayed as below:
```javascript var mocDesc = { "category": "Other", "type": "Moc", "name": "My MOC", "description": "my MOC description", "serviceUrl": "http://demonstrator.telespazio.com/sitools/corot/exo/moc", "visible": true" }; var mocLayer = mizar.addLayer(mocDesc); ``` The MOC options are described in the following table:
Key Description Expected value Default value
Required
name Name of the MOC in the GUI A string /
type The layer type "Moc" /
Optional
category Category where the MOC is grouped in the GUI A string "Other"
description The layer description A long string ""
visible Set to true when the MOC must be visible Either true or false true
color Set the color of the grid (RGB code, RGB code in hex, human color) a color white
opacity Opacity of the grid. When 0 is set, the layer is not visible anymore A decimal value in [0, 1] 1

A MOC example:

{
"6":[22043,23620,30237,30331,30439,30450],
"7":[85845,85847,88161,88162,88163,88166,88169,88186,88261,88307,88308,88310,
 88311,88313,88315,88316,88318,88319,88576,88578,88660,88661,88663,88678,88679,
 88685,88834,88840,89001,89003,89006,89007,89071,89080,89082,89083,94287,94298,
 94309,94319,94320,94322,94330,94331,94416,94417,94425,94427,94430,94452,94465,
 94468,94469,94544,94545,94547,94548,94550,94551,94556,120926,120962,120963,
 120968,120969,121122,121123,121128,121129,121131,121132,121172,121173,121175,
 121181,121315,121318,121321,121338,121669,121680,121682,121745,121746,121747,
 121750,121753,121755,121779,121784,121785,121788,121790,121791,121795,121806,
 121825,121828,121830,121831,121836,121837,121858,121864,121866,121867,121888,
 121889,127253,127255,127296,127298,127302,127308,127309,127310],
"8":[342013,342014,342015,343377,343378,343379,343385,343413,352471,352558,352559,
 352641,352642,352643,352656,352658,352670,352673,352685,352738,352936,352938,
 352939,353041,353043,353052,353053,353088,353089,353090,353092,353147,353222,
 353223,353236,353238,353249,353250,353251,353257,353259,353268,353269,353270,
 353930,353962,354310,354316,354336,354628,354629,354631,354648,354649,354651,
 354676,354677,354679,354701,354703,354705,354706,354707,354708,354710,354711,
 354736,354737,354739,354748,354760,354762,354763,354784,354785,354786,355328,
 355330,355331,355340,355342,355343,355364,356018,356019,356074,356075,356078,
 356277,356278,356279,356281,356298,356326,356346,377143,377147,377186,377198,
 377233,377245,377271,377284,377285,377286,377313,377314,377315,377318,377338,
 377621,377673,377676,377680,377705,377707,377712,377714,377715,377718,377724,
 377726,377792,377793,377796,377797,377799,377812,377817,377857,377880,377881,
 377884,377885,377887,377936,377938,377944,377946,377953,377956,377957,377959,
 377968,378133,378185,378198,378209,378212,378213,378215,378228,378229,378230,
 378232,378233,378236,380938,472924,472925,472927,472949,479230,479231,481962,
 483695,483710,483781,483782,483783,483788,483789,483825,483828,483829,483831,
 483842,483843,483844,483846,483847,483866,483881,483884,483888,483890,484480,
 484482,484483,484506,484521,484532,484536,484538,484677,484696,484697,484699,
 484721,484732,484733,484735,484821,484823,485255,485259,485264,485266,485267,
 485278,485293,485346,485358,486673,486684,486685,486687,486724,486726,486727,
 486732,486752,486941,486977,486978,486979,486994,487009,487011,487109,487110,
 487111,487113,487115,487120,487121,487122,487124,487128,487130,487131,487145,
 487148,487149,487151,487156,487178,487179,487216,487218,487230,487297,487308,
 487309,487311,487316,487318,487319,487333,487336,487338,487339,487370,487392,
 487393,487424,487426,487427,487438,487460,487462,487560,487561,487564,487568,
 487570,509008,509009,509011,509017,509196,509198,509199,509212,509214,509220,
 509221,509223,509229,509244,509245,509246,509282,509288,509329],
"9":[1368031,1368045,1368046,1368047,1368049,1368050,1368051,1373469,1373505,
 1373506,1373507,1373537,1373549,1373649,1373661,1409883,1409908,1409909,
 1409911,1409917,1410222,1410223,1410227,1410230,1410282,1410561,1410562,
 1410563,1410630,1410636,1410638,1410639,1410672,1410674,1410675,1410684,
 1410686,1410687,1410689,1410701,1410736,1410737,1410748,1410749,1410751,
 1410946,1410958,1411000,1411002,1411003,1411722,1411750,1412160,1412161,
 1412163,1412197,1412217,1412220,1412221,1412222,1412306,1412311,1412316,
 1412336,1412349,1412364,1412365,1412366,1412372,1412376,1412384,1412385,
 1412396,1412408,1412482,1412485,1412493,1412494,1412502,1412510,1412516,
 1412531,1412542,1412579,1412586,1412587,1412602,1412829,1412831,1412873,
 1412878,1412879,1412882,1412883,1412885,1412886,1412887,1412900,1412901,
 1412903,1412909,1412911,1412956,1412958,1412959,1412995,1413024,1413025,
 1413027,1413084,1413086,1415712,1415714,1415726,1415808,1415809,1415810,
 1415842,1417232,1417234,1417235,1417244,1417246,1417247,1417268,1417269,
 1417270,1417272,1417273,1417274,1417348,1417349,1417350,1417352,1417353,
 1418479,1418490,1418491,1418501,1418521,1418549,1418601,1418693,1418713,
 1418741,1418783,1418801,1418802,1418803,1418809,1418819,1418836,1418838,
 1418839,1418900,1418901,1418903,1418952,1418953,1418955,1418980,1418981,
 1418983,1418996,1418997,1418998,1419000,1419001,1419016,1419018,1419019,
 1419044,1419046,1419047,1419064,1419066,1419148,1419152,1421316,1421318,
 1421319,1421336,1421338,1421339,1421364,1421366,1421367,1421416,1421460,
 1421464,1421472,1421473,1421474,1421476,1424037,1424039,1424045,1424046,
 1424047,1424066,1424067,1424090,1424091,1424094,1424290,1424291,1424294,
 1424295,1424318,1424319,1425021,1425022,1425023,1425101,1425102,1425103,
 1425105,1425106,1425107,1425121,1425123,1425132,1425133,1425135,1425186,
 1425187,1425196,1425198,1425199,1425296,1425298,1425299,1425308,1425310,
 1425376,1425378,1425390,1508565,1508566,1508567,1508569,1508570,1508571,
 1508581,1508582,1508583,1508587,1508738,1508739,1508748,1508750,1508751,
 1508784,1508786,1508787,1508796,1508798,1508799,1508928,1508929,1508931,
 1508940,1508941,1508943,1508976,1508977,1508979,1508989,1509083,1509095,
 1509101,1509148,1509149,1509150,1509168,1509169,1509170,1509178,1509184,
 1509186,1509249,1509250,1509251,1509264,1509266,1509267,1509276,1509278,
 1509279,1509344,1509346,1509347,1509356,1509358,1510481,1510493,1510688,
 1510689,1510691,1510700,1510701,1510708,1510712,1510714,1510715,1510718,
 1510719,1510724,1510725,1510726,1510728,1510729,1510730,1510789,1510791,
 1510797,1510798,1510799,1510825,1510827,1510854,1510855,1510878,1510879,
 1510900,1510902,1510908,1510910,1511181,1511192,1511193,1511195,1511221,
 1511256,1511258,1511264,1511265,1511267,1511280,1511433,1511436,1511437,
 1511439,1511476,1511477,1511532,1511533,1511544,1511545,1511547,1511637,
 1511748,1511750,1511751,1511756,1511757,1511758,1511780,1511782,1511788,
 1511808,1511809,1511832,1511833,1511880,1511882,1512528,1512529,1512531,
 1512540,1512541,1512543,1512736,1512737,1512739,1512748,1512749,1512751,
 1512786,1512798,1512845,1512856,1512857,1512859,1512885,1512924,1512926,
 1512937,1512940,1512941,1512948,1512952,1512953,1523744,1523746,1523747,
 1523840,1523841,1523842,1891675,1891677,1891678,1891679,1891685,1891704,
 1891705,1891707,1891805,1891807,1916906,1916907,1916909,1916910,1916911,
 1916918,1916919,1927842,1927843,1934773,1934775,1934779,1934792,1934794,
 1934795,1934798,1934834,1934835,1934844,1934846,1934847,1935119,1935121,
 1935122,1935123,1935141,1935161,1935164,1935165,1935167,1935297,1935320,
 1935321,1935349,1935363,1935365,1935366,1935367,1935382,1935456,1935458,
 1935520,1935521,1935523,1935529,1935532,1935533,1935540,1935541,1935556,
 1935558,1935559,1935564,1935565,1935566,1937578,1937926,1937927,1937944,
 1937946,1937947,1937950,1938016,1938018,1938019,1938028,1938030,1938031,
 1938042,1938080,1938081,1938083,1938092,1938093,1938136,1938148,1938149,
 1938150,1938156,1938717,1938719,1938793,1938795,1938881,1938892,1938893,
 1938895,1938917,1938936,1938937,1938939,1939281,1939283,1939317,1939319,
 1939473,1939476,1939477,1939479,1939520,1939521,1939522,1941015,1941018,
 1941019,1941029,1941030,1941031,1941033,1941034,1941035,1941062,1941082,
 1941104,1941106,1941107,1941116,1941118,1941119,1941121,1941124,1941125,
 1941127,1941133,1941169,1941180,1941181,1941183,1941376,1941378,1941390,
 1941426,1941438,1946543,1946553,1946554,1946555,1946556,1946558,1946689,
 1946691,1946700,1946701,1946703,1946900,1946902,1946903,1946932,1946933,
 1946934,1946936,1946937,1946938,1946952,1946954,1946955,1946976,1947012,
 1947741,1947742,1947743,1947761,1947763,1947772,1947773,1947775,1947906,
 1947907,1947970,1947982,1948018,1948024,1948026,1948027,1948030,1948031,
 1948032,1948033,1948035,1948041,1948069,1948071,1948381,1948383,1948429,
 1948431,1948433,1948434,1948457,1948459,1948492,1948493,1948500,1948501,
 1948502,1948504,1948518,1948536,1948538,1948539,1948576,1948577,1948579,
 1948589,1948600,1948601,1948603,1948628,1948632,1948633,1948634,1948639,
 1948702,1948710,1948711,1948776,1948778,1948779,1948870,1948876,1948878,
 1948879,1948912,1948914,1948915,1949184,1949185,1949196,1949197,1949199,
 1949221,1949241,1949243,1949268,1949270,1949322,1949323,1949341,1949348,
 1949350,1949408,1949409,1949411,1949412,1949413,1949414,1949424,1949450,
 1949472,1949474,1949475,1949486,1949576,1949577,1949700,1949702,1949744,
 1949746,1949846,1949852,1949854,1949855,1949922,1949928,1949930,1949931,
 1950248,1950249,1950252,1950260,1950261,1950284,1950286,1950304,1950305,
 2035989,2036040,2036041,2036043,2036065,2036076,2036077,2036079,2036165,
 2036167,2036176,2036177,2036178,2036180,2036181,2036754,2036760,2036762,
 2036763,2036790,2036791,2036811,2036813,2036814,2036815,2036826,2036860,
 2036862,2036863,2036869,2036871,2036888,2036889,2036891,2036913,2036925,
 2036988,2036989,2036990,2037120,2037122,2037123,2037132,2037134,2037156,
 2037312,2037313,2037315,2037324,2037328,2037329]
}
### 3.7 Operations on layers #### 3.7.1 - Get all layers To get all layers, use the following method : `mizar.getLayers()` #### 3.7.2 - Get layer To get a single layer, use `mizar.getLayer(layerName)` where layerName is name of layer defined in backgroundSurveys.json. #### 3.7.3 - Get all observations from a layer To get all observations from a layer, use the following method : `mizar.getLayer(layerName).features` #### 3.7.4 - Remove a layer To remove a layer, use the following method: `mizar.removeLayer(layer)` #### 3.7.5 - Remove observation from a layer To remove the given observation from layer use : `layer.removeFeature(observation)`
This method is only available for GeoJSON layer.
#### 3.7.6 - Get metadata from an observation Each observation extracted from layer with command described in 3.6.6.3 has `properties` object containing all available metadata. #### 3.7.7 - Handle opacity To change opacity of the given layer use `layer.opacity(value)`, where value must be in range [0, 1]. #### 3.7.8 - Handle visibility To change visibility of the given layer use `layer.visible(boolean)`. #### 3.7.9 - Highlight a shape This feature allows to hightlight a shape (point or polygon) by calling the following method `mizar.highlightObservation(featureData, options)` where:
* featureData is an object containing : feature and layer. * options: Is an object containing highlight options: - isExclusive : Boolean indicating if Mizar has to blur already selected observations before highligting the given one. - color : The color of highlight

For more details see Explorer example

#### 3.7.10 - Request MOC for an existing layer `mizar.requestMoc(layer,callback)` where callback is a function to be called on success or fail of moc computation. The function gets passed one argument: mocLayer(null if no moc exists for the given layer); Once moc retrieved you can change its visibility like any other layer.

For more details see Moc example

#### 3.7.11 - xMatch several MOCs `var intersectionLayer = mizar.xMatch(layerArray)` where layerArray is array of layers containing the MOC(not MOC layers themselves), which you want to intersect.

For more details see Moc example

#### 3.7.12 - Request/remove FITS To request/remove fits of/from the given observation you should use these two snippets:
`mizar.requestFits(featureData)` : to request
`mizar.removeFits(featureData)` : to remove,
where `featureData` is an object containing : feature and layer.

For more details see Explorer example

### 3.8 - Data transfer with SAMP

To benefit SAMP communication between Mizar and other application supporting SAMP protocol you'll need to activate the following GUI's:

mizar.setSampGui(true);
mizar.setCategoryGui(true);

To register Mizar on SAMP Hub, just click on icon, then click on "Register" button. Once Mizar is registered, there are several scenarios become available:

  • Send the VOTable and images from Hub application to visualize in Mizar
  • Send background in viewport to other application:
    • Choose the layer with Fits support
    • Toggle fits
    • Click on export button
  • Send fits of the given observation
    • Show layer containing observations
    • Click on observation which you want to be sent
    • Click on
  • Send cutout-ed observation via samp(TODO : check it with background layers)
  • On every movement Mizar sends "coord.pointAt.sky" message with eye center ra/dec coordinates
### 3.8 - How the GeoJSON layer is represented in MIZAR] Here is a GeoJSON response : ```json { "features": [ { "type": "Feature", "geometry": { "coordinates": [199.89386974238522,-12.718711269167299],[199.8440358491079,-12.718711266507693],[199.8440310650965,-12.767322370100011],[199.89387452093231,-12.767322372770128],[199.89386974238522,-12.718711269167299], "type": "Polygon" }, "properties": { "crs": { "type": "name", "properties": { "name": "equatorial.ICRS" } }, "title":"HST_07909", "identifier":"HST_07909_CS_WFPC2_F606W_WF", "TelescopeName":"HST/HLA", "Instrument":"WFPC2", "Ra":199.871366999, "Dec":-12.744627868, "thumbnail":"https://c2.staticflickr.com/4/3671/10253524335_f8deed215f_s.jpg", "quicklook":"https://www.dropbox.com/s/qlwi8cal8iuolqe/ngc5076.jpg", "Category":"SCIENCE", "others" : { "AccessRef":"http://archives.esac.esa.int/hst/proxy?file_id=HST_07909_CS_WFPC2_F606W_WF_DRZ", "Type":"OBJECT,WFPC2,1,A2D7,F606W,,CAL", "ProposalID":"7909", "AssocID":"HST_07909_CS_WFPC2_F606W_WF", "TimeCalibration":"CALIBRATED", "CreatorVersion":"2.5.5 (Aug 27, 2009)", "DisplayRef":"NONE", "TimeStart":50884.8584947, "TimeExtent":800, "date-obs":"1998/03/12T20:49:13", "DispersiveElement":"F606W", "SpectralResolution":150.24, "SpatialCalibration":"CALIBRATED", "Ncombine":2, "ProcessingType":"highly_processed", "SpectralStart":510.89, "Score":0, "PosAngle":0, "TimeStop":50884.8765502, "TargetName":"ANY", "Collection":"HST", "CoordRefFrame":"ICRS", "Creator":"Space Telescope - European Coordinating Facility", "Mode":"IMAGE,BROADBANDFILTER", "SpectralResPower":3.9004924297332764, "FluxCalibration":"CALIBRATED", "Publisher":"Space Telescope - European Coordinating Facility", "Naxes":2, "SpectralLocation":586.01, "SpectralExtent":150.24, "CoordProjection":"TAN", "PIName":"CASERTANO STEFANO", "TargetDescription":"UNIDENTIFIED;PARALLEL FIELD", "FovRef":"hla_sia_WFPC2_46_242801069202", "CreatorDID":"HST_07909_CS_WFPC2_F606W_WF", "SpectralStop":661.13, "ProposalTitle":"POMS Test Proposal: WFII parallel archive proposal", "TimeLocation":50884.867522450004 } }, "services": { "download":{ "mimetype":"image/fits", "url":"http://archives.esac.esa.int/hst/proxy?file_id=HST_07909_CS_WFPC2_F606W_WF_DRZ" } } }], "totalResults": 1, "type": "FeatureCollection" } ``` Its representation in MIZAR is the following: ![](https://raw.githubusercontent.com/SITools2/MIZAR/gh-pages/images/properties.png "Representation in MIZAR") ### 3.9 - Convert VOTable to JSON To make easier the interface with VO services, a converter is available by calling the following command: `mizar.convertVotable2JsonFromURL(url, callback)`, where url is the url to votable and callback is a function which gets passed the transformed JSON.

You can also use mizar.convertVotable2JsonFromXML(xml, callback), where xml is a string containing the xml to transform.

Finally, to have a quick visualization of your votable, you can just drag'n'drop it on Mizar's canvas.

### 3.10 - Handling rendering

Mizar and its layers can publish several events which could be used to handle rendering status:

Mizar:

  • "image:download" : when some observation download the FITS
  • "image:add" : event published just before downloading FITS
  • "image:remove" : event published when FITS of some observation has been removed
  • "backgroundLayer:add" : when new background layer has been added
  • "backgroundLayer:change" : when background imagery has been changed
  • "additionalLayer:add" : when new additional layer has been added
  • "mizarMode:toggle" : when mizar mode(Planet or Sky) has been toggled

Layer:

  • "visiblity:changed" : when the visibility of layer has been changed
  • "features:added" : when layer received the new observations
  • "startLoad" : when layer started sending the requests
  • "endLoad" : when layer stopped sending the requests

Example:

layer.subscribe("features:added", function(featureData){
    // Show received features
    console.log(featureData.features);
});
## 4 - Usage example ```javascript // Init Mizar var options = { navigation: { "initTarget": [0,0] }, nameResolver: { "zoomFov": 2 } };

var mizar = new MizarWidget('#mizarWidget-div', options); mizar.setBackgroundSurvey("IRIS");

mizar.sky.subscribe("baseLayersReady", function(){

// Define custom layer
var openSearchDesc = {
    type: "DynamicOpenSearch",
    name: "MyLayerID-0",
    serviceUrl: "https://example.com/test"
};
var myOpenSearchLayer = mizar.addLayer(openSearchDesc);

// Go to point of interest
mizar.goTo("m31", function(){
    // Start search on open search layer
    var startSearch = function()
    {
        // Make open search layer visible
        myOpenSearchLayer.visible(true);

        // Wait while searching results arrive
        window.setTimeout(function(){
            console.log("Opacity changed");
            // Change opacity
            myOpenSearchLayer.opacity(0.3);
        }, 10000);
    }

    // Adjust FOV
    var fov = mizar.getCurrentFov();
    if (fov[1] <= 2) {
        // Since name resolver zoomFov is 0.2, we'll always pass here
        mizar.setZoom(1, startSearch);
    }
    else
    {
        startSearch();
    }
});

// Highlight received observations
myOpenSearchLayer.subscribe("features:added", function(featureData){

    var features = featureData.features;
    // OpenSearch layer loading ended
    // Show received features
    for ( var i=0; i<featureData.features.length; i++ )
    {
        var feature = featureData.features[i];
        mizar.highlightObservation(feature);
    }
});

});

Clone this wiki locally