mapbox / mapbox-studio-classic

https://www.mapbox.com/mapbox-studio/
BSD 3-Clause "New" or "Revised" License
1.14k stars 229 forks source link

Mapbox Studio styles don't produce consistent colors in generated PNG tiles #1577

Closed portsmouth closed 6 years ago

portsmouth commented 6 years ago

This is an issue with the Mapbox Studio web app, but I'm not sure where to log it, and it may be the same in Mapbox Classic.

I am trying to use Mapbox Studio to generate a style containing an integer ID per country (in range 0-255), encoded in the color channels of the image. The attached style country_index_style.json.zip achieves this by generating a layer per country (defined by a geojson file containing country boundaries), with fill-color #xy0000 where xy is the hex code for the country. (Note I also specified "fill-antialias: false" to prevent anti-aliasation from corrupting the IDs near country boundaries). For example, I assign Romania the fill color #b80000 (equivalent to rgba(184,0,0,1)).

This all looks good in Mapbox studio, as here: https://www.mapbox.com/studio/styles/jamports/cjazkexj8bn9e2smqtp4x2lxf/

I then need to download tiles from this style, via URLs like: https://api.mapbox.com/styles/v1/jamports/cjazkexj8bn9e2smqtp4x2lxf/tiles/512/4/9/5?access_token=

However the (PNG) tiles which are downloaded via the request above are not exactly consistent with the style, for example the tile linked to above shows a portion of Romania but the color of the pixels is actually #b90000 (which should correspond to Russia in the style).

The color in the tiles is not even consistently wrong, e.g. the tile adjacent to the one above has the correct color for Romania according to the style, i.e. #b80000, as here:

https://api.mapbox.com/styles/v1/jamports/cjazkexj8bn9e2smqtp4x2lxf/tiles/512/4/8/5?access_token=

Is this an issue with the tile rendering from Mapbox Studio, or is there something I'm missing in either my style, or in how I should interpret the color of the downloaded tiles? (e.g. perhaps the color in the tiles should not be expected to match the fill color in the style itself, for some reason).

samanpwbb commented 6 years ago

Hi @portsmouth – your issue is unrelated to mapbox-studio-classic: different rendering tech is used in Mapbox Studio (mapbox-gl) than in Mapbox Studio Classic (mapnik). Sounds like there may be inconsistencies with how mapbox gl native (https://github.com/mapbox/mapbox-gl-native) and mapbox gl js (https://github.com/mapbox/mapbox-gl-js) render color. If you can isolate a more specific test case, I suggest ticketing the issue in https://github.com/mapbox/mapbox-gl-native.