display transparency for image source layers in mapbox gl

14 views Asked by At

I have a mapbox project (react-mapbox-gl) here which displays png images with alpha channel. currently the images get displayed without the transparency.

How can I make mapbox display the transparency in an image source?

currently I am doing something like this:

<Source
  key={`${layer.id}_${layer.name}_${layer.source.type}`}
  type="image"
  url={url}
  coordinates={tileBounds}
>
  {layer.mapStyles?.map((mapStyle) => {
    return (
      <Layer
        beforeId={beforeId}
        key={mapStyle.id}
        {...mapStyle}
        paint={{ 'raster-opacity': 0.5 }} // Opacity is NOT what I mean - since it makes everything translucent or not... I really need the alpha transparency in the png... 
      />
    );
  })}
</Source>

any hint would be great! Thanks a lot!

0

There are 0 answers