Azimuthal Equidistant Raster Reprojection
This example demonstrates an azimuthal equidistant raster reprojection, converting a cylindrical equirectangular Blue Marble image into a disc-shaped Earth view using d3.geoAzimuthalEquidistant. It draws the original JPEG to a Canvas, then uses projection.invert and getImageData to sample source pixels for each target pixel, while calculating the projection disc’s radius to blank out areas outside it. The result is a direct pixel-level transformation rendered entirely on canvas.
AI-generated descriptionThis bl.ock is a response to a question on reprojecting rasters in d3. The approach is covered in this answer: Stack Overflow answer.
It assumes a geographic projection that projects the earth on to a disc, so that one can calculate the radius of the disc and trim the image to this area. This is required as the d3 projection function is not one to one.