[Interest] Set transparent fill on map using mapboxgl plugin

Paolo Angelelli paolo.angelelli at qt.io
Tue Oct 24 12:36:36 CEST 2017


On Mon, 23 Oct 2017 13:55:15 +0200
Ola Røer Thorsen <ola at silentwings.no> wrote:

> Hi, I'm evaluating using QtLocation's map using mapboxgl. Currently I'm
> using the default settings, default map style, default developer access
> token.
> 
> I'd like to set most layers' fill color to transparent, to see how it works
> out as an overlay on top of some live video.
> 
> From the documentation it seems like I can use the MapParameter items to do
> this, but so far I haven't been able to do anything to change the existing
> layers.
> 
> Anyone have some hints for me how to do this? Basically i'd like to set the
> colors for layers like the background, water, etc. to transparent.
> 
> Best regards,
> Ola

Hi,
 on this the mbgl documentation is a bit lacking ( there's even an open bug report on this, QTBUG-62453 ).
However, the way it works at the moment is that, if you give an objectName, say "foo", to your map item, then you can
reference the resulting mapboxgl layer using "QtLocation-foo" as layer name.

Example (setting some layout props):

    MapPolyline {
        objectName: 'poly'
        id: poly
        line.width: 10
        line.color: 'deepskyblue'
        path : <somepath>
    } 

    MapParameter {
        type: 'layout'
        property var layer: 'QtLocation-poly'
        property var lineJoin: 'round'
        property var lineCap: 'round'
    }

For your specific problem, if this is going to work, it's probably by setting some of the properties described
in https://www.mapbox.com/mapbox-gl-js/style-spec/#layers-fill


best,
Paolo



More information about the Interest mailing list