mapbox-maps-flutter icon indicating copy to clipboard operation
mapbox-maps-flutter copied to clipboard

iOS App Crashing When Loading RasterLayer

Open nicolasDevlane opened this issue 1 year ago • 0 comments

I'm trying to show a heatmap in my Flutter app with the help of RasterSource/Layers. It was working fine in 0.5.0 but after migrating to 2.3.0 it started crashing on iOS. The error thrown in xCode is:

Generate Mipmaps For Texture Validation [tex mipmapLevelCount](1) must be > 1

After some investigation I found that there is an issue when the loaded tiles have a size of 1x1. This is also confirmed in one of the comments on this StackOverflow post .

This is the code I'm using in Flutter just in case.

await style.addSource(
      RasterSource(
        id: 'overall_heatmap',
        tiles: heatmap.tiles,
        tileSize: 256,
        scheme: Scheme.XYZ,
        minzoom: heatmap.minZoom,
        maxzoom: heatmap.maxZoom,
        bounds: heatmap.bounds,
      ),
    );

    await style.addLayer(
      RasterLayer(
        id: 'heatmap',
        sourceId: 'overall_heatmap',
        rasterResampling: RasterResampling.LINEAR,
      ),
    );

And this is my Flutter doctor result:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.3, on macOS 14.6.1 23G93 darwin-arm64, locale en-CO)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] Connected device (4 available)            
[✓] Network resources

• No issues found!

Thanks in advance for any help you can provide!

nicolasDevlane avatar Oct 07 '24 01:10 nicolasDevlane