GeoTIFF / georaster-layer-for-leaflet

Display GeoTIFFs and soon other types of raster on your Leaflet Map
https://geotiff.github.io/georaster-layer-for-leaflet-example/
Apache License 2.0
283 stars 57 forks source link

Prevent the browser's tab to crash for extent having a non-number height or width #103

Open qgerome opened 1 year ago

qgerome commented 1 year ago

These variables can be NaN if (oldrb.width !== 0 && oldrb.height !== 0) {

Example file: population.cog.tif.zip

DanielJDufour commented 1 year ago

Thank you! Impressive work! I really appreciate you catching this. I think this bug has been causing problems and it didn't know why.

Do you happen to know what values were being passed to new GeoExtent(oldExtentOfInnerTileInRasterCRS.bbox); leading to NaN? Is there a bug in the geo-extent library that I should fix?

qgerome commented 1 year ago

Yes, I took a screenshot of the variables :

CleanShot 2022-07-25 at 10 20 11@2x

I think the problem is indeed with the subtract operation in geo-extent (https://github.com/DanielJDufour/geo-extent/blob/2ede7c76866e9fd78a426fb1b0463692c1564078/src/geo-extent.js#L159)

DanielJDufour commented 1 year ago

wow. I really appreciate you finding the root cause of the problem! I created an issue with preciso and will fix there: https://github.com/DanielJDufour/preciso/issues/7

DanielJDufour commented 1 year ago

I think the issue might have been geo-extent using an old broken version of preciso. Will republish soon

DanielJDufour commented 1 year ago

Rebuilding / Republishing hit a snag with some dependency typings. I can fix it, but it will unfortunately probably take a day or more.

qgerome commented 1 year ago

No problem for the timeline :)

Since the error is from an external dependency, do you prefer I remove the commit that checks if it's different than 0 or is it ok for you as-is ?

DanielJDufour commented 1 year ago

I just published version 3.9.0-0 as a release candidate, which should fix the previous issue. I'm going to read through this PR again and I'll think about your question more.