iTwin / itwinjs-core

Monorepo for iTwin.js Library
https://www.itwinjs.org
MIT License
600 stars 210 forks source link

Attaching an 'ArcGIS' tiled map-layers makes display-test-app crash #4263

Closed mdastous-bentley closed 1 year ago

mdastous-bentley commented 2 years ago

Describe the bug Attaching a specific ArcGIS map-layer makes the application crash. This dataset tile tree contains tiles for LOD 15-19, which forces the display to load a large number of tiles when the view is zoomed out.

To Reproduce Steps to reproduce the behavior:

  1. Download iModel from https://connect-imodelweb.bentley.com/imodeljs/?projectId=1f451d6e-15d2-4a2a-b8a1-a90ada795264&iModelId=d457c2c2-308b-4cdd-8538-77228c71d119&ChangeSetId=285cb3d51dfaf20107283bfcf3d5180ff1a11614
  2. Open downloaded imodel
  3. Select the ' Geo: BentleyAGOL-phillyBuildings' view
  4. Run this key-in: fdt attach arcgis maplayer https://services7.arcgis.com/nZ2Vb4CUwdo9AIiQ/arcgis/rest/services/iTwinImageTest1/MapServer PhillyCityLandmarks
  5. A large number of tiles is being fetched/displayed until the application crash.

Expected behavior The itwin.js application should not display any tiles when the current view scale does not match the scale of any available resolution. Ideally an API should be available for consumers (i.e UI) to provide feedback about a map-layer being out of range in the current viewport, otherwise end-user might assume there is a display issue. ESRI viewer implements something similar.

Desktop (please complete the applicable information):

Additional context Current behavior was introduced to fix the display of map-layers having a minimum LOD, otherwise, nothing would ever be shown (even though the view would be zoomed at a proper level). This works OK if view scale is not far away from the first available LOD. See Support minimum LOD for ESRI layers

Provider code: ArcGISMapLayerImageryProvider

pmconne commented 2 years ago

@mdastous-bentley can you elaborate upon the "application crash"? Do you have a call stack? An exception? I followed your steps and it loaded 1226 tiles, 11 of which were determined to be "empty", and ultimately selected 22 for display. It did not crash.

image

mdastous-bentley commented 2 years ago

Metrostation-Demo_Marjo_ESV.json.txt Try this ESV file (pick view1).

Also, I could not get it crashed, it will reach around 4GB of memory, and then viewer would remain blank/frozen. Design Review would completely crash the browser tab though.

mdastous-bentley commented 1 year ago

@pmconne I still need assistance for fixing this issue. Even though the application doesn't crash consistently, tiles are missing.

pmconne commented 1 year ago

You seem to know more about the problem than I do. What does the following mean?

when the current view scale does not match the scale of any available resolution.

mdastous-bentley commented 1 year ago

The ArcGIS dataset contains its own tile tree definition, described by level of details (each one representing a view scale and resolution). Each time the view change, and tiles are missing, ArcGISMapLayerImageryProvider.loadTile is called with quad id (row,column/zoomLevel).

In the current case, the ArcGIS dataset's tile tree is incomplete: zoom levels (or resolutions if you prefer) are missing. When it happens, iTwin.js "tiling system" will assume children of a missing tile, are also not available: this is not true. The provider has currently no way to inform the iTwin.js "tiling system" about it.

pmconne commented 1 year ago

Can you link to somewhere in the provider's code where this information can be obtained?