addGeoJsonSource method

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

Implementation

@override
Future<void> addGeoJsonSource(String sourceId, Map<String, dynamic> geojson,
    {String? promoteId}) async {
  final data = _makeFeatureCollection(geojson);
  _addedFeaturesByLayer[sourceId] = data;
  _map.addSource(sourceId, {
    "type": 'geojson',
    "data": geojson, // pass the raw string here to avoid errors
    if (promoteId != null) "promoteId": promoteId
  });
}