mapbox-gl-native
mapbox-gl-native copied to clipboard
Convert image sources into tiles on the fly
If you take any 6500px+ wide image and try to add it to a map via MGLImageSource, you'll see a black box. Conversely, the image renders without issue in our Android SDK.
Steps to reproduce
- Pull down my branch here: https://github.com/mapbox/ios-sdk-examples/tree/large-image-test-sf
- Make sure the red-rect image below is in the
Filesdirectory of the iOS SDK Examples project by dragging and dropping it in Xcode. - Run the
ImageSourceExample.swiftin a simulator or on a physical device - you will see a black box instead of the red image.
You can also do this by uploading your own 6500px+ wide image and substituting it in the Add an image example.
Here's the black box that you'll see:

(Image to download and place in Files directory)

Expected behavior
It should look like it does in Android - the image rendering properly:

Actual behavior
The image does not render - instead a black box is shown.
Configuration
Mapbox SDK versions: 4.4.0 iOS/macOS versions: iOS 11.4 Device/simulator models: iPad Pro (@captainbarbosa has more information on the model if needed) Xcode version: 9.4.1
This sounds like either a limitation of OpenGL texture sizes on iOS devices, or a limitation of the image decoding code we use on iOS.
I recommend using a raster tileset instead of a single image.
A longer term refactor in the GL Native code base could be to automatically convert images into tiles for circumventing this issue.
@kkaefer thanks for looking at this! One thing I forgot to mention - @captainbarbosa tested this without Mapbox, just using a UIImageView, and it worked as expected. So perhaps it's the second issue - a limitation of the image decoding we use on iOS.
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.
@samfader Did you find a solution ?
@bleformal Have you tried displaying your image as a MGLRasterSource rather than a MGLImageSource? That's the workaround suggested here: https://github.com/mapbox/mapbox-gl-native/issues/12989#issuecomment-426288438
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.
Might be related: https://github.com/mapbox/mapbox-gl-native-android/issues/331
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.
Any update for this issue?