diff --git a/src/add.js b/src/add.js index 5eb35fc..ea7d2de 100644 --- a/src/add.js +++ b/src/add.js @@ -192,7 +192,7 @@ export async function addThumbnail(thumbnails, layerGroup, options) { const layer = await imageOverlay(url, bounds, options.crossOrigin); if (layer === null) { log(1, "image layer is null", url); - return addThumbnail(thumbnails, layerGroup, options); // Retry with the remaining thumbnails + return await addThumbnail(thumbnails, layerGroup, options); // Retry with the remaining thumbnails } addLayer(layer, layerGroup, asset); return await new Promise(resolve => { diff --git a/src/utils/bbox-to-bounds.js b/src/utils/bbox-to-bounds.js index 1061426..ddfd537 100644 --- a/src/utils/bbox-to-bounds.js +++ b/src/utils/bbox-to-bounds.js @@ -5,7 +5,16 @@ * @returns */ export default function bboxToLatLngBounds(bbox) { - const [xmin, ymin, xmax, ymax] = bbox; + let xmin, ymin, xmax, ymax, _; + if (bbox.length === 6) { + [xmin, ymin, _, xmax, ymax, _] = bbox; + } + else if (bbox.length === 4) { + [xmin, ymin, xmax, ymax] = bbox; + } + else { + return null; + } const southWest = [ymin, xmin]; const northEast = [ymax, xmax]; return L.latLngBounds(southWest, northEast); diff --git a/src/utils/image-overlay.js b/src/utils/image-overlay.js index f5a1187..84c265c 100644 --- a/src/utils/image-overlay.js +++ b/src/utils/image-overlay.js @@ -14,7 +14,7 @@ export default async function imageOverlay(url, bounds, crossOrigin, options) { } catch { return null; } - const lyr = L.imageOverlay(url, bounds, options); + const lyr = L.imageOverlay(img, bounds, options); return lyr; } catch { return null;