mapbox-gl-native icon indicating copy to clipboard operation
mapbox-gl-native copied to clipboard

Convert image sources into tiles on the fly

Open samfader opened this issue 7 years ago • 10 comments
trafficstars

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

  1. Pull down my branch here: https://github.com/mapbox/ios-sdk-examples/tree/large-image-test-sf
  2. Make sure the red-rect image below is in the Files directory of the iOS SDK Examples project by dragging and dropping it in Xcode.
  3. Run the ImageSourceExample.swift in 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:

img_515e6649682b-1

(Image to download and place in Files directory) red-rect

Expected behavior

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

screenshot_20180928-155248 1

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

samfader avatar Sep 28 '18 23:09 samfader

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 avatar Oct 02 '18 14:10 kkaefer

@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.

samfader avatar Oct 02 '18 16:10 samfader

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

stale[bot] avatar Mar 31 '19 17:03 stale[bot]

@samfader Did you find a solution ?

mbappinte avatar Apr 30 '19 08:04 mbappinte

@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

samfader avatar Apr 30 '19 14:04 samfader

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

stale[bot] avatar Oct 27 '19 15:10 stale[bot]

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

stale[bot] avatar Apr 25 '20 07:04 stale[bot]

Might be related: https://github.com/mapbox/mapbox-gl-native-android/issues/331

alexshalamov avatar Apr 27 '20 09:04 alexshalamov

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

stale[bot] avatar Nov 14 '20 09:11 stale[bot]

Any update for this issue?

thexclu avatar Jun 01 '22 07:06 thexclu