Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tboch opened this issue Feb 5, 2025 · 0 comments
Open

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

tboch opened this issue Feb 5, 2025 · 0 comments

Comments

@tboch
Copy link
Contributor

tboch commented Feb 5, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant