Skip to content

New method to add an image layer from a PNG URL + WCS #137

@tboch

Description

@tboch

It would be nice to have a method in ipyaladin to create a new image layer from a PNG URL associated to its WCS.
This is possible in Aladin Lite:

aladin.setOverlayImageLayer(
  A.image(
    "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQIAHqI53PhyJZRzGs8QN8...",
    {
        name: "M61",
        imgFormat: 'jpeg',
        wcs: {
            NAXIS: 2, // Minimal header
            CTYPE1: 'RA---TAN', // TAN (gnomic) projection + SIP distortions
            CTYPE2: 'DEC--TAN', // TAN (gnomic) projection + SIP distortions
            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) => {
          console.log('done');
            aladin.gotoRaDec(ra, dec);
            aladin.setFoV(fov)
        }
    },
));

Example in action: https://cds.unistra.fr/~boch/al-base64-color.html

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions