geoJsonSource

fun geoJsonSource(id: String): GeoJsonSource

DSL function for GeoJsonSource accepting empty data source. Immediately returns GeoJsonSource with no data set.

fun geoJsonSource(id: String, block: GeoJsonSource.Builder.() -> Unit): GeoJsonSource

DSL function for GeoJsonSource.

Immediately returns GeoJsonSource with no data set and starts preparing actual data using a worker thread if GeoJsonSource.Builder.feature, GeoJsonSource.Builder.featureCollection or GeoJsonSource.Builder.geometry were applied.

If using runtime styling:

loadStyle(style(Style.DARK) { +geoJsonSource(id) { featureCollection(collection) } ... }

Style.OnStyleLoaded will be emitted without waiting to draw GeoJsonSource.feature, GeoJsonSource.featureCollection or GeoJsonSource.geometry on the map.

In order to capture events when actual data is drawn on the map please refer to Observer API and listen to MapEvents.SOURCE_DATA_LOADED or MapEvents.MAP_LOADING_ERROR with type = metadata if data parsing error has occurred.