ShurupuS
ShurupuS

Reputation: 2923

Mapbox iOS GL black background layer issue

I try to implement raster tiles in mapbox-iOS-SDK gl 3.2.3

This is my local style source:

{
"version": 8,
"name": "2GIS tiles",
"sources": {
    "mainSource": {
        "type": "raster",
        "tiles": [
                  "http://tile1.maps.2gis.com/tiles?x={x}&y={y}&z={z}&v=1"
                  ],
        "tileSize": 128
    }
},
"layers": [
           {
           "id": "background",
           "type": "background",
           "paint": {
               "fill-color": "#FFF9E8"
           }
           },
           {
           "id": "mainLayer",
           "type": "raster",
           "source": "mainSource",
           "paint": {
               "raster-fade-duration": 100
           }
           }
           ]
}

And here what I get click-me

So, while scrolling or panning the map - black background appeared sometimes while tiles are loading.

How can I solve this? Is it possible to change the black color?

Upvotes: 0

Views: 1419

Answers (1)

RobLabs
RobLabs

Reputation: 2347

Try changing the paint property from fill-color to background-color.

E.g.,

{
  "id": "background",
  "type": "background",
  "paint": {
    "background-color": "#FFF9E8"
  }
}

The Mapbox GL Style Reference mentions this for paint, which should explain the black background you are seeing.

background-color
Optional color. Defaults to #000000. Disabled by background-pattern. The color with which the background will be drawn.

Upvotes: 3

Related Questions