addGeoJsonSource method

Future<void> addGeoJsonSource(
  1. String sourceId,
  2. Map<String, dynamic> geojson, {
  3. String? promoteId,
})

Adds a new geojson source

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

promoteId can be used on web to promote an id from properties to be the id of the feature. This is useful because by default mapbox-gl-js does not support string ids

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

Implementation

Future<void> addGeoJsonSource(String sourceId, Map<String, dynamic> geojson,
    {String? promoteId}) async {
  await _mapboxGlPlatform.addGeoJsonSource(sourceId, geojson,
      promoteId: promoteId);
}