1

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

Espresso
  • 740
  • 13
  • 32

1 Answers1

2

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.

tir38
  • 9,810
  • 10
  • 64
  • 107
Tk30
  • 36
  • 1