Method

MaplibreNativeFfiMapset_style_url_async

Declaration [src]

void
maplibre_native_ffi_map_set_style_url_async (
  MaplibreNativeFfiMap* self,
  const char* url,
  GAsyncReadyCallback callback,
  gpointer user_data
)

Description [src]

Loads the map’s style from url.

The command completes once the style document has loaded and parsed. The style’s sources, sprites, and glyphs then load in the background.

The map’s style is loaded from the time a style document parses until the next call to this function. While the style isn’t loaded, the commands that change it complete with MAPLIBRE_NATIVE_FFI_ERROR_INVALID_STATE. To change a new map’s style without a style document, first load an empty style, such as {"version":8,"sources":{},"layers":[]}.

See mln_map_set_style_url in the C API reference.

It fails with these errors:

  • MAPLIBRE_NATIVE_FFI_ERROR_NATIVE_ERROR when the style document fails to load or isn’t a valid style.
  • MAPLIBRE_NATIVE_FFI_ERROR_CANCELLED when the map is released, or this function or maplibre_native_ffi_map_set_style_json_async() loads another style, before the style document parses.

Without callback, nothing reports whether the call succeeds.

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

Parameters

url

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.