geoJsonSource

DSL function for GeoJsonSource performing parsing using background thread. Immediately returns GeoJsonSource with no data set and starts preparing actual data using a worker thread.

If using runtime styling:

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

compositing style will be performed correctly under the hood and Style.OnStyleLoaded will be emitted in correct moment of time when all sources are parsed.

If creating geojson sources for already loaded Style please consider using overloaded geoJsonSource(String, GeoJsonSource.Builder.() -> Unit, onGeoJsonParsed: (GeoJsonSource) -> Unit) function and use fully prepared GeoJsonSource in onGeoJsonParsed callback.

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

DSL function for GeoJsonSource performing parsing using a worker thread. Immediately returns GeoJsonSource with no data set, fully parsed GeoJsonSource is returned in onGeoJsonParsed callback.

Using this method means that it is user's responsibility to proceed with adding this source, layers or other style objects in onGeoJsonParsed callback.

fun geoJsonSource(id: String, config: GeoJsonSource.Builder.() -> Unit, onGeoJsonParsed: OnGeoJsonParsed): GeoJsonSource