Method

MaplibreNativeFfiMapset_geo_json_source_data_async

Declaration [src]

void
maplibre_native_ffi_map_set_geo_json_source_data_async (
  MaplibreNativeFfiMap* self,
  const char* source_id,
  const char* data,
  GAsyncReadyCallback callback,
  gpointer user_data
)

Description [src]

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 maplibre_native_ffi_map_set_geo_json_source_synchronous_tiling_async() 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.

It fails with these errors:

  • MAPLIBRE_NATIVE_FFI_ERROR_NOT_FOUND when the style has no source named source_id.
  • MAPLIBRE_NATIVE_FFI_ERROR_INVALID_ARGUMENT when the source named source_id isn’t a GeoJSON source, when data isn’t valid GeoJSON, or when the source clusters and data isn’t a feature collection of points. The source keeps its data.
  • MAPLIBRE_NATIVE_FFI_ERROR_CANCELLED when newer data for the source replaces data while it waits, or when the source’s URL, its removal, a style load, or the map’s release replaces the source’s data before data is ready.
  • MAPLIBRE_NATIVE_FFI_ERROR_INVALID_STATE while the style isn’t loaded, as maplibre_native_ffi_map_set_style_url_async() describes.

Without callback, nothing reports whether the call succeeds.

This method completes asynchronously. Use maplibre_native_ffi_map_set_geo_json_source_data_finish() inside the GAsyncReadyCallback to obtain the result of the operation.

Parameters

source_id

Type: const char*

The UTF-8 text.

The data is owned by the caller of the method.
The value is a NUL terminated UTF-8 string.
data

Type: const char*

The UTF-8 text.

The data is owned by the caller of the method.
The value is a NUL terminated UTF-8 string.
callback

Type: GAsyncReadyCallback

The callback to call when the call finishes.

The argument can be NULL.
user_data

Type: gpointer

The data to pass to callback.

The argument can be NULL.
The data is owned by the caller of the method.