Nandoff
Nandoff

Reputation: 29

Update mapbox map style in real time [Mapbox Android SDK]

Today I come with a question which could be trivial or easy to guess, but I'm not being able to solve. I've got a map style, in Mapbox Studio, in which I created 19 layers (1 for each department of a country, see picture) Map What I've got, is a simple application which shows the map and a floating action button. What I want to do, is to customize the style (change background color) in real time of a single layer or group of layers. What I want to achieve with my application is to inform the user with the real alerts in real time that are happening in each department. I've tried using the 'PropertyFactory' with no result.

Thank you for your help!

Upvotes: 1

Views: 1136

Answers (1)

Tobrun
Tobrun

Reputation: 18391

Here is an example of getting a FillLayer and changing the color/opacity.

FillLayer salto = mapboxMap.getLayerAs("SALTO");
if (salto != null) {
    salto.setProperties(
      fillColor(Color.RED),
      fillOpacity(0.25f)
    );
}

Upvotes: 1

Related Questions