Reputation: 930
I want to create a symbol layer with the textfield set to a property from my GeoJSON file. For instance, in my GeoJSON file each Feature has a property called "rlabel" and I would like to set the value of this label as the symbol layers textfield. How do I do this?
String geojsonString = loadJsonFromDownloadedFile(...);
source = new GeoJsonSource("source-id", geojsonString);
SymbolLayer symbolLayer = new SymbolLayer("symbol-layer-id", "source-id");
symbolLayer.setProperties(
PropertyFactory.textField( ??? ) // what goes here?
);
style.addLayer(symbolLayer);
Thanks
Upvotes: 1
Views: 1064
Reputation: 36
Try the following code:
PropertyFactory.textField(get("rlabl"))
Specifically the get()
method is com.mapbox.mapboxsdk.style.expressions.Expression.get()
This class has a lot of matchers.
Upvotes: 2