diff --git a/src/js/Aladin.js b/src/js/Aladin.js index 23423f2a..c4e14109 100644 --- a/src/js/Aladin.js +++ b/src/js/Aladin.js @@ -899,7 +899,6 @@ export let Aladin = (function () { return radec_j2000; }; - /** * point to a given position, expressed as a ra,dec coordinate * diff --git a/src/js/HpxImageSurvey.js b/src/js/HpxImageSurvey.js index 7c938e5a..a16cc098 100644 --- a/src/js/HpxImageSurvey.js +++ b/src/js/HpxImageSurvey.js @@ -65,10 +65,19 @@ export async function fetchSurveyProperties(rootURLOrId) { } else { if (metadata.length > 1) { let ids = []; - metadata.forEach((prop) => { - ids.push(prop.ID) - }); - throw ids + ' surveys are matching. Please use one from this list.'; + let surveyFound = false; + for (let i = 0; i < metadata.length; i++) { + ids.push(metadata[i].ID) + if (metadata[i].ID === id) { + metadata = metadata[i]; + surveyFound = true; + break; + } + } + + if (!surveyFound) { + throw ids + ' surveys are matching. Please use one from this list.'; + } } else if (metadata.length === 0) { throw 'no surveys matching'; } else { @@ -273,16 +282,17 @@ export let HpxImageSurvey = (function() { // the output format has not been defined by the user // => we give him one of the available formats if (!this.imgFormat) { - this.imgFormat = tileFormats[0]; - if (this.imgFormat === 'FITS') { - //tileFormat = "FITS"; + if (tileFormats.indexOf('PNG') >= 0) { + this.fits = false; + this.imgFormat = "PNG"; + } else if (tileFormats.indexOf('JPEG') >= 0) { + this.fits = false; + this.imgFormat = "JPEG"; + } else if (tileFormats.indexOf('FITS') >= 0) { this.fits = true; - } else if (this.imgFormat === "PNG") { - //tileFormat = "PNG"; - this.fits = false; + this.imgFormat = "FITS"; } else { - //tileFormat = "JPG"; - this.fits = false; + throw "Unsupported format(s) found in the metadata: " + tileFormats; } }