function loadImage(template, z, x, y, options) {
  return new Promise((resolve, reject) => {
    const image = new Image();
    image.crossOrigin = options.crossOrigin ?? null;
    image.addEventListener('load', () => resolve(image));
    image.addEventListener('error', () => reject(loadError));
    image.src = renderXYZTemplate(template, z, x, y, options.maxY);
  });
}
@param {string} template The image url template.
@param {number} z The tile z coordinate.
@param {number} x The tile x coordinate.
@param {number} y The tile y coordinate.
@param {import('./DataTile.js').LoaderOptions} options The loader options.
@return {Promise<HTMLImageElement>} Resolves with a loaded image.