I've been following this guide provided by Mapbox to familiarize myself with SymbolLayers and how to manipulate their properties on the map.
https://blog.mapbox.com/a-guide-to-the-android-symbollayer-api-5daac7b66f2c
The key step I'm having issues with is Step 5 where they update the iconSize
property onMapClick. After they add a property to the selected Feature
, the guide says to call source.setGeoJson(featureCollection);
in order to reset the source of the layer.
The project I'm working with uses a VectorSource
as the source of data for the SampleLayer
, not a GeoJsonSource
like the example uses. The problem is that VectorSource
doesn't provide a method like setGeoJson
so I'm not able to reset the layer source after I change the property.
What can I do to work around this without having to change all of our source data?
for (Feature feature : featureCollection.getFeatures() {
if (feature.getStringProperty("title").equals(selectedFeature.getStringProperty("title"))) {
feature.getProperties().addProperty("selected", true);
}
}
source.setGeoJson(featureCollection);
The full source of that example can be found here: https://github.com/mapbox/mapbox-android-demo/blob/286f33d848c9fea48de908b144682081961b986b/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/labs/SymbolLayerMapillaryActivity.java