geosolutions-it / MapStore2

The solution to create and share maps, dashboards, geostories with 3D support on the web. And it is open-source too!
https://mapstore.geosolutionsgroup.com/
Other
513 stars 400 forks source link

Viewer get stuck for minutes zooming to COGs extent #10119

Open tdipisa opened 7 months ago

tdipisa commented 7 months ago

Description

If you try to zoom to a COG layer from TOC using the related toolbar button, the application freezes for minutes and it is necessary to close the browser windows in many cases.

Image

When you add layers from Catalog tool the zoom to layer is performed as expected without any problems. It seems there is a kind of infinite loop in the code when the zoom is performed from the TOC. Also QA instance is affected therefore it doesn't seems to be related to latest TOC changes provided with https://github.com/geosolutions-it/MapStore2/issues/9982

Affected version

How to reproduce

Expected Result

The viewer map zoom as expected

Current Result

The application get stuck

Browser info (use this site: https://www.whatsmybrowser.org/ for non expert users) | Browser Affected | Version | |---|---| |Internet Explorer| | |Edge| | |Chrome| | |Firefox| | |Safari| |

Other useful information

dsuren1 commented 7 months ago

Investigation

@tdipisa The problem caused by this tif https://oin-hotosm.s3.amazonaws.com/5d7dad0becaf880008a9bc88/0/5d7dad0becaf880008a9bc89.tif, when OL trying to render tile beyond the tile grid extent. When wrapX: false, the performance issue not observed.

[!NOTE] Observation with a similar tif source with compression but without overview mask data - https://tmp-asger-public.s3.eu-central-1.amazonaws.com/jpegtest.cog.tif works fine

This issue seems to be not native to our application, it exists in OL, reproducible in a sandbox Note: modify wrapX: true. The browser may crash or become unresponsive

Could be because of the following reasons,

  1. TIF source has overview mask causing issue in loading tile beyond grid extent eventually making it not compatible for wrapping it horizontally causing performance issue as geotiff's readRGB and readRaster can be expensive

    image Screenshot 2024-04-01 at 12 59 06 PM
  2. Or wrapX implementation for GeoTIFF source has some issue in these cases

I don't observe any problem with the compression used.

However, I think will raise this question in the OL community to better evaluate this case.

Workaround

In the meantime, two possible ways to avoid this issue

  1. Do not use the TIF source mentioned above (No code change needed)
  2. or set wrapX: false for GeoTIFF source, will stop rendering tiles beyond the tile grid extent i.e Currently MS shows multi-world map, setting wrapx: true will extend the tile rendered in these worlds too. But setting it to false will render it in the original/initial world map i.e wont be shown in other world maps (code change needed)
tdipisa commented 7 months ago

@dsuren1 thank you

However, I think will raise this question in the OL community to better evaluate this case.

Let's see for this please

or set wrapX: false for GeoTIFF source, will stop rendering tiles beyond the tile grid extent i.e Currently MS shows multi-world map, setting wrapx: true will extend the tile rendered in these worlds too. But setting it to false will render it in the original/initial world map i.e wont be shown in other world maps (code change needed)

It could be a temporary workaround only for COGs layers but this would introduce a different behavior only for this layer type and it is not good, I think. If we decide to proceed with something like this also the UI should be updated to have control of the wrapx property for all layers, not only for GOCs.

Since it seems only a problem with that COG source I would like to put this ticket on hold for the moment.