Skip to content

Fix thumbnail issues #69

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
11 changes: 10 additions & 1 deletion src/utils/bbox-to-bounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/image-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down