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

Raster layers have black background on iOS

Open johnnyluu opened this issue 10 years ago • 12 comments

Hey guys,

I added a raster layer, which is a overlay of a masterplan, onto my map following this guide: https://www.mapbox.com/help/georeferencing-imagery/ . Everything looks fine in chrome, but when I run in inside of a cordova app on ios, the raster layer has a black background that covers everything underneath. I tried moving the layer down, but the black still comes through where there's nothing else on top. Is there a way to remove this background color on ios?

Thanks!!

johnnyluu avatar May 31 '16 01:05 johnnyluu

Any update on this one, guys?

johnnyluu avatar Jun 16 '16 05:06 johnnyluu

No update @johnnyluu. Unfortunately, we don't have the capacity to spend time debugging Cordova here at Mapbox. We would appreciate if you could investigate the issue and submit a patch 😄

lucaswoj avatar Jun 16 '16 17:06 lucaswoj

Hey @lucaswoj , is not a Cordova issue. It happens in the browser on iOS as well

johnnyluu avatar Jun 18 '16 01:06 johnnyluu

@johnnyluu What format is the Tileset reported as? (see https://www.mapbox.com/studio/tilesets/YOUR_TILESET_ID)

If it's webp, then it's because iOS Safari doesn't support webp (which support transparency), so it's falling back to JPG tiles which lack transparency, I think.

Can you post the Style ID or Tileset ID?

andrewharvey avatar Jul 08 '16 00:07 andrewharvey

Closing as stale

lucaswoj avatar Jul 29 '16 19:07 lucaswoj

@andrewharvey @lucaswoj Sorry I didn't notice the update.

Yes the tileset IS in webp format. I followed this tutorial here to georeference the image: https://www.mapbox.com/help/georeferencing-imagery/ . What should I do to create a tileset that's supported by iOS, so it doesn't display the background colour?

tileset ID: brightfox.7h3843ej

johnnyluu avatar Aug 03 '16 02:08 johnnyluu

I see that this was closed. However this still happens on iOS with the latest SDK. Were any fixes related to this ticket incorporated?

croozeus avatar May 03 '17 10:05 croozeus

I am having the same issue, the 'black background'. Has this been resolved? Could someone help please?

baptistae avatar Oct 31 '18 09:10 baptistae

Hi @baptistae I think there's potentially a few causes of and solutions to this issue but it's impossible to say without more information. If you believe this is a bug in Mapbox code and not a browser support issue or general how-to question, please update this ticket with a minimal reproduction of the bug. Otherwise, I'd recommend ensuring that you're not using WebP tiles as discussed above and contacting our support team if you have further questions.

ryanhamley avatar Oct 31 '18 18:10 ryanhamley

Hi @ryanhamley,

The black background I meant can be seen in the link below.

https://api.mapbox.com/styles/v1/ebaptista/cjnwlpcih6rgr2sqk24kd7qim.html?fresh=true&title=true&access_token=pk.eyJ1IjoiZWJhcHRpc3RhIiwiYSI6ImNqaDFkMW41NjAycWMzM3J5ZWozd2hwZXoifQ.-s9u1p7IopNgLegMxdf53A#14.0/-8.576514/125.546172/0

Thanks

baptistae avatar Oct 31 '18 22:10 baptistae

This is caused by the use of JPG raster tiles which do not support an alpha channel. This renders as expected in Chrome but not Safari, because Chrome supports WebP images (notice the extra requests for WebP images in Chrome Dev Tools' Network tab). You can see detailed discussion of the issue here. The linked issue also discusses possible workarounds such as turning the image into an Image source on the map. Unfortunately, there's no easy solution to implement on our end because of the limitations of the JPG format and browser support for WebP.

ryanhamley avatar Oct 31 '18 22:10 ryanhamley

Thanks @ryanhamley for the prompt reply and the explanation.

Cheers

baptistae avatar Oct 31 '18 22:10 baptistae