setGeoJsonSourceData method
Replaces the data of a GeoJSON source.
data is a GeoJSON feature collection, feature, or geometry. The library
prepares it for the source with the source's options, off the threads that
the caller and the runtime use, and the command completes once the source
holds it. Later commands don't wait for it. While the source is still
preparing earlier data, only the newest data waits to follow it.
With synchronous tiling on, as
MapHandle.setGeoJsonSourceSynchronousTiling() describes, the command
prepares data before later commands run, so the data shows in the next
frame.
See mln_map_set_geo_json_source_data in the
C API reference.
Errors:
Status.notFoundwhen the style has no source namedsourceId.Status.invalidArgumentwhen the source namedsourceIdisn't a GeoJSON source, whendataisn't valid GeoJSON, or when the source clusters anddataisn't a feature collection of points. The source keeps its data.Status.cancelledwhen newer data for the source replacesdatawhile it waits, or when the source's URL, its removal, a style load, or the map's release replaces the source's data beforedatais ready.Status.invalidStatewhile the style isn't loaded, asMapHandle.setStyleUrl()describes.
Implementation
Future<CommandCompletion> setGeoJsonSourceData(
String sourceId,
Object? data,
) => _command(
(arena, completion) => raw.mln_map_set_geo_json_source_data(
_handle.raw,
nativeStringView(sourceId, arena).value,
_nativeJsonView(data, arena),
completion,
nativeDiagnostic,
),
);