setGeoJsonSource method

Future<void> setGeoJsonSource(
  1. String sourceId,
  2. Map<String, dynamic> geojson
)

Sets new geojson data to and existing source

This only works as exected if the source has been created with addGeoJsonSource before. This is very useful if you want to update and existing source with modified data.

The json in geojson has to comply with the schema for FeatureCollection as specified in https://datatracker.ietf.org/doc/html/rfc7946#section-3.3

The returned Future completes after the change has been made on the platform side.

Implementation

Future<void> setGeoJsonSource(
    String sourceId, Map<String, dynamic> geojson) async {
  await _mapboxGlPlatform.setGeoJsonSource(sourceId, geojson);
}