|
MapLibre Native C API
Public C ABI for the MapLibre Native wrapper.
|
Go to the source code of this file.
Data Structures | |
| struct | mln_image_stretch |
| struct | mln_image_content |
| struct | mln_style_source_info |
| struct | mln_style_tile_source_options |
| struct | mln_geojson_source_options |
| struct | mln_canonical_tile_id |
| struct | mln_custom_geometry_source_options |
| struct | mln_custom_mvt_vector_source_options |
| struct | mln_premultiplied_rgba8_image |
| struct | mln_style_image_options |
| struct | mln_style_image_info |
| struct | mln_style_transition_options |
Enumerations | |
| enum | mln_style_source_type : uint32_t |
| enum | mln_style_source_info_field : uint32_t { MLN_STYLE_SOURCE_INFO_URL = 1U << 0U , MLN_STYLE_SOURCE_INFO_TILEJSON = 1U << 1U , MLN_STYLE_SOURCE_INFO_BOUNDS = 1U << 2U , MLN_STYLE_SOURCE_INFO_TILE_SIZE = 1U << 3U , MLN_STYLE_SOURCE_INFO_VECTOR_ENCODING = 1U << 4U , MLN_STYLE_SOURCE_INFO_RASTER_ENCODING = 1U << 5U } |
| enum | mln_style_tile_source_option_field : uint32_t |
| enum | mln_style_tile_scheme : uint32_t |
| enum | mln_style_vector_tile_encoding : uint32_t |
| enum | mln_style_raster_dem_encoding : uint32_t |
| enum | mln_style_image_text_fit : uint32_t |
| enum | mln_style_layer_visibility : uint32_t |
| enum | mln_geojson_source_option_field : uint32_t |
| enum | mln_custom_geometry_source_option_field : uint32_t |
| enum | mln_custom_mvt_vector_source_option_field : uint32_t |
| enum | mln_style_image_option_field : uint32_t |
| enum | mln_style_transition_option_field : uint32_t |
| enum | mln_location_indicator_image_kind : uint32_t |
Public C API declarations for style sources, layers, and images.
| typedef struct mln_canonical_tile_id mln_canonical_tile_id |
Canonical tile identity used by custom geometry and custom MVT vector source callbacks.
Field mask values for mln_custom_geometry_source_options.
| typedef struct mln_custom_geometry_source_options mln_custom_geometry_source_options |
Options for custom geometry sources.
| typedef void(* mln_custom_geometry_source_release_callback) (void *user_data) |
Releases a custom geometry source's callback context.
| typedef void(* mln_custom_geometry_source_tile_callback) (void *user_data, mln_canonical_tile_id tile_id) |
Callback invoked for custom geometry source tile requests and cancels.
Field mask values for mln_custom_mvt_vector_source_options.
| typedef struct mln_custom_mvt_vector_source_options mln_custom_mvt_vector_source_options |
Options for custom MVT vector sources.
| typedef void(* mln_custom_mvt_vector_source_release_callback) (void *user_data) |
Releases a custom MVT vector source's callback context.
| typedef void(* mln_custom_mvt_vector_source_tile_callback) (void *user_data, mln_canonical_tile_id tile_id) |
Callback invoked for custom MVT vector source tile requests and cancels.
Field mask values for mln_geojson_source_options.
| typedef struct mln_geojson_source_options mln_geojson_source_options |
Options for GeoJSON sources.
MapLibre Native fixes these options when the source is created, so mln_map_set_geojson_source_url() keeps the options the source was added with, and mln_map_set_geojson_source_data() requires data prepared with matching options.
| typedef struct mln_image_content mln_image_content |
Content-box insets in image pixels, measured from the image's top-left.
MapLibre places a symbol's text inside this box when icon-text-fit applies.
| typedef struct mln_image_stretch mln_image_stretch |
One stretchable interval along an image axis, in image pixels.
MapLibre scales only the stretchable intervals when it resizes the image, so the pixels outside them keep their size. An interval runs from a lower from to a higher to, and the intervals along one axis run in increasing order without overlapping. mln_map_set_style_image() rejects intervals that break that shape.
Location indicator image-name properties.
| typedef struct mln_premultiplied_rgba8_image mln_premultiplied_rgba8_image |
Caller-owned premultiplied RGBA8 image pixels.
| typedef struct mln_style_image_info mln_style_image_info |
Fixed metadata for one runtime style image.
| typedef enum mln_style_image_option_field mln_style_image_option_field |
Field mask values for mln_style_image_options.
| typedef struct mln_style_image_options mln_style_image_options |
Options for runtime style images.
| typedef enum mln_style_image_text_fit mln_style_image_text_fit |
How a stretchable image fits text along one axis.
| typedef enum mln_style_layer_visibility mln_style_layer_visibility |
Layer visibility values used by the layer visibility accessors.
DEM raster encoding values used by mln_style_tile_source_options.
| typedef struct mln_style_source_info mln_style_source_info |
Fixed source metadata returned by mln_map_get_style_source_info().
| typedef enum mln_style_source_info_field mln_style_source_info_field |
Fields available in mln_style_source_info.
| typedef enum mln_style_source_type mln_style_source_type |
Style source type values returned by mln_map_get_style_source_type().
| typedef enum mln_style_tile_scheme mln_style_tile_scheme |
Tile URL coordinate scheme values used by mln_style_tile_source_options.
Field mask values for mln_style_tile_source_options.
| typedef struct mln_style_tile_source_options mln_style_tile_source_options |
Options for vector and raster tile sources.
Field mask values for mln_style_transition_options.
| typedef struct mln_style_transition_options mln_style_transition_options |
Global style transition options.
These control how the style animates paint property changes and whether symbol placement changes cross-fade. They are distinct from camera animation options, which time camera moves.
A paint property's own style-spec transition, such as "fill-color-transition", overrides these for that property. These apply to every property that declares none.
Vector tile encoding values used by mln_style_tile_source_options.
| enum mln_custom_geometry_source_option_field : uint32_t |
Field mask values for mln_custom_geometry_source_options.
| enum mln_custom_mvt_vector_source_option_field : uint32_t |
Field mask values for mln_custom_mvt_vector_source_options.
| enum mln_geojson_source_option_field : uint32_t |
Field mask values for mln_geojson_source_options.
| enum mln_location_indicator_image_kind : uint32_t |
Location indicator image-name properties.
| enum mln_style_image_option_field : uint32_t |
Field mask values for mln_style_image_options.
| enum mln_style_image_text_fit : uint32_t |
How a stretchable image fits text along one axis.
| enum mln_style_layer_visibility : uint32_t |
Layer visibility values used by the layer visibility accessors.
| enum mln_style_raster_dem_encoding : uint32_t |
DEM raster encoding values used by mln_style_tile_source_options.
| enum mln_style_source_info_field : uint32_t |
Fields available in mln_style_source_info.
| Enumerator | |
|---|---|
| MLN_STYLE_SOURCE_INFO_URL | The source retains a URL. Copy it with mln_map_copy_style_source_url(). |
| MLN_STYLE_SOURCE_INFO_TILEJSON | The tile source was defined with an inline TileJSON description. |
| MLN_STYLE_SOURCE_INFO_BOUNDS | The inline TileJSON description contains geographic bounds. |
| MLN_STYLE_SOURCE_INFO_TILE_SIZE | The source exposes a tile size. |
| MLN_STYLE_SOURCE_INFO_VECTOR_ENCODING | The source exposes a vector tile encoding. |
| MLN_STYLE_SOURCE_INFO_RASTER_ENCODING | The source exposes a DEM raster encoding. |
| enum mln_style_source_type : uint32_t |
Style source type values returned by mln_map_get_style_source_type().
| enum mln_style_tile_scheme : uint32_t |
Tile URL coordinate scheme values used by mln_style_tile_source_options.
| enum mln_style_tile_source_option_field : uint32_t |
Field mask values for mln_style_tile_source_options.
| enum mln_style_transition_option_field : uint32_t |
Field mask values for mln_style_transition_options.
| enum mln_style_vector_tile_encoding : uint32_t |
Vector tile encoding values used by mln_style_tile_source_options.
| mln_custom_geometry_source_options mln_custom_geometry_source_options_default | ( | void | ) |
Returns default custom geometry source options.
| mln_custom_mvt_vector_source_options mln_custom_mvt_vector_source_options_default | ( | void | ) |
Returns default custom MVT vector source options.
| mln_status mln_geojson_source_data_create | ( | mln_buffer_view | data, |
| const mln_geojson_source_options * | options, | ||
| mln_geojson_source_data * | out_data ) |
Prepares GeoJSON source data for installation on a map.
data and options are borrowed for the call. The UTF-8 GeoJSON bytes are parsed and tiled (or clustered) into the index a GeoJSON source consumes, which is the expensive part of a data update. options may be null for defaults; the options are baked into the prepared data and must match the options of every source the data is installed on.
When options enable clustering, the data must be a feature collection whose every feature carries point geometry. Data that does not is rejected, and the thread-local diagnostic names the constraint.
This entry point is callable from any thread and touches no runtime or map, so a host prepares data on a worker thread and installs it on the map owner thread. The prepared data is immutable; create, read, and destroy may each happen on different threads.
*out_data must be MLN_HANDLE_NULL on entry. On success it receives an owned handle the host releases with mln_geojson_source_data_destroy(). Installing the data borrows the handle, so one prepared handle may be installed on any number of sources and destroyed at any time afterward.
Returns:
| void mln_geojson_source_data_destroy | ( | mln_geojson_source_data | data | ) |
Releases prepared GeoJSON source data.
Callable from any thread. A null or already-released handle is a no-op. Sources the data was installed on keep their own reference, so destroying the handle never invalidates a source.
| mln_geojson_source_options mln_geojson_source_options_default | ( | void | ) |
Returns default GeoJSON source options.
| mln_status mln_map_add_color_relief_layer | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| mln_buffer_view | source_id, | ||
| mln_buffer_view | before_layer_id ) |
Adds a color-relief layer for a raster DEM source.
layer_id, source_id, and before_layer_id are borrowed for the call. Passing an empty before_layer_id appends the layer; otherwise the layer is inserted before that existing layer. Use mln_map_set_layer_property() with color-relief-color to set the color ramp expression.
Returns:
| mln_status mln_map_add_custom_geometry_source | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| const mln_custom_geometry_source_options * | options ) |
Adds a custom geometry source.
source_id is borrowed for the call. options is borrowed for the call, but the callback function pointers and user_data pointer are retained by value. The callback functions and user_data must remain valid until the source is removed, the style is replaced, or the map is destroyed, and until any in-flight callback invocation has returned. For URL loads, style replacement occurs when the new style loads, not when the load request is accepted. For inline JSON loads, style replacement completes before mln_map_set_style_json() returns successfully.
fetch_tile and cancel_tile may run on arbitrary native worker threads, may be concurrent with owner-thread map calls, and must not call thread-affine map APIs directly. Queue work back to the map owner thread before calling mln_map_set_custom_geometry_source_tile_data() or invalidation functions. Callbacks must not throw, panic, longjmp, or otherwise unwind through the C ABI. cancel_tile is best-effort and may be repeated or race with fetch_tile.
Custom geometry sources belong to the current style. Replacing the style drops sources that were added to the previous style.
A host that owns callback state frees it in options.release_user_data, which this API invokes once after it stops referencing user_data. See mln_custom_geometry_source_options.release_user_data.
Returns:
| mln_status mln_map_add_custom_mvt_vector_source | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| const mln_custom_mvt_vector_source_options * | options ) |
Adds a custom MVT vector source.
source_id is borrowed for the call. options is borrowed for the call, but the callback function pointers and user_data pointer are retained by value. The callback functions and user_data must remain valid until the source is removed, the style is replaced, or the map is destroyed, and until any in-flight callback invocation has returned. For URL loads, style replacement occurs when the new style loads, not when the load request is accepted. For inline JSON loads, style replacement completes before mln_map_set_style_json() returns successfully.
fetch_tile and cancel_tile may run on arbitrary native worker threads, may be concurrent with owner-thread map calls, and must not call thread-affine map APIs directly. Queue work back to the map owner thread before calling mln_map_set_custom_mvt_vector_source_tile_data(), mln_map_set_custom_mvt_vector_source_tile_error(), or mln_map_invalidate_custom_mvt_vector_source_tile(). Callbacks must not throw, panic, longjmp, or otherwise unwind through the C ABI. cancel_tile is best-effort and may be repeated or race with fetch_tile.
Custom MVT vector sources belong to the current style. Replacing the style drops sources that were added to the previous style. A layer that draws this source names a source-layer that exists inside the MVT bytes the host delivers.
A host that owns callback state frees it in options.release_user_data, which this API invokes once after it stops referencing user_data. See mln_custom_mvt_vector_source_options.release_user_data.
Returns:
| mln_status mln_map_add_geojson_source_data | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| mln_geojson_source_data | data ) |
Adds a GeoJSON source with prepared inline data.
source_id is borrowed for the call. data names a live handle from mln_geojson_source_data_create(); the call borrows the handle and retains the prepared index, and the source adopts the options the data was prepared with, fixed for the lifetime of the source.
Returns:
| mln_status mln_map_add_geojson_source_url | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| mln_buffer_view | url, | ||
| const mln_geojson_source_options * | options ) |
Adds a GeoJSON source with URL data.
source_id, url, and options are borrowed for the call. The source loads GeoJSON from url through MapLibre Native's resource system. options may be null for defaults, and the options are fixed for the lifetime of the source.
Returns:
| mln_status mln_map_add_hillshade_layer | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| mln_buffer_view | source_id, | ||
| mln_buffer_view | before_layer_id ) |
Adds a hillshade layer for a raster DEM source.
layer_id, source_id, and before_layer_id are borrowed for the call. Passing an empty before_layer_id appends the layer; otherwise the layer is inserted before that existing layer.
Returns:
| mln_status mln_map_add_image_source_image | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| const mln_lat_lng * | coordinates, | ||
| size_t | coordinate_count, | ||
| const mln_premultiplied_rgba8_image * | image ) |
Adds an image source with inline image pixels.
source_id, coordinates, image, and image pixels are borrowed for the call. coordinates must contain exactly four coordinates in top-left, top-right, bottom-right, bottom-left order. The function copies accepted coordinates and pixels into the current style before return.
Image sources belong to the current style. Loading another style URL or JSON document drops sources that were added to the previous style.
Returns:
| mln_status mln_map_add_image_source_url | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| const mln_lat_lng * | coordinates, | ||
| size_t | coordinate_count, | ||
| mln_buffer_view | url ) |
Adds an image source that loads its image from a URL.
source_id, coordinates, and url are borrowed for the call. coordinates must contain exactly four coordinates in top-left, top-right, bottom-right, bottom-left order. The function copies accepted strings and coordinates into the current style before return. Later URL load or decode failures are reported through runtime events.
Image sources belong to the current style. Loading another style URL or JSON document drops sources that were added to the previous style.
Returns:
| mln_status mln_map_add_location_indicator_layer | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| mln_buffer_view | before_layer_id ) |
Adds a source-free location indicator layer.
layer_id and before_layer_id are borrowed for the call. Passing an empty before_layer_id appends the layer; otherwise the layer is inserted before that existing layer.
Returns:
| mln_status mln_map_add_raster_dem_source_tiles | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| const mln_buffer_view * | tiles, | ||
| size_t | tile_count, | ||
| const mln_style_tile_source_options * | options ) |
Adds a raster DEM source with inline tile URLs.
source_id and tile URL views are borrowed for the call. The function copies accepted strings into MapLibre Native before return. options may be null for defaults.
Returns:
| mln_status mln_map_add_raster_dem_source_url | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| mln_buffer_view | url, | ||
| const mln_style_tile_source_options * | options ) |
Adds a raster DEM source with a TileJSON URL.
source_id and url are borrowed for the call. options may be null for defaults. For URL sources, tile_size and raster_encoding are used when their field bits are set.
Returns:
| mln_status mln_map_add_raster_source_tiles | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| const mln_buffer_view * | tiles, | ||
| size_t | tile_count, | ||
| const mln_style_tile_source_options * | options ) |
Adds a raster source with inline tile URLs.
source_id and tile URL views are borrowed for the call. The function copies accepted strings into MapLibre Native before return. options may be null for defaults.
Returns:
| mln_status mln_map_add_raster_source_url | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| mln_buffer_view | url, | ||
| const mln_style_tile_source_options * | options ) |
Adds a raster source with a TileJSON URL.
source_id and url are borrowed for the call. options may be null for defaults. For URL sources, only tile_size is used when its field bit is set.
Returns:
| mln_status mln_map_add_style_layer_json | ( | mln_map | map, |
| mln_buffer_view | layer_json, | ||
| mln_buffer_view | before_layer_id ) |
Adds one style layer from a full style-spec layer JSON object.
This is the insertion path for every style-spec layer type. The typed adders above exist for reasons beyond construction: mln_map_add_hillshade_layer() and mln_map_add_color_relief_layer() validate that the source is a raster DEM source, and mln_map_add_location_indicator_layer() pairs with typed per-frame setters that take coordinates in C API order.
layer_json and before_layer_id are borrowed for the call. layer_json must contain id and type members. Passing an empty before_layer_id appends the layer; otherwise the layer is inserted before that existing layer.
Returns:
| mln_status mln_map_add_style_source_json | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| mln_buffer_view | source_json ) |
Adds one style source from a style-spec source JSON object.
source_id and source_json are borrowed for the call. source_json is the object that appears under sources[source_id] in a style document. The function parses and copies the accepted source into MapLibre Native before return.
Returns:
| mln_status mln_map_add_vector_source_tiles | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| const mln_buffer_view * | tiles, | ||
| size_t | tile_count, | ||
| const mln_style_tile_source_options * | options ) |
Adds a vector source with inline tile URLs.
source_id and tile URL views are borrowed for the call. The function copies accepted strings into MapLibre Native before return. options may be null for defaults.
Returns:
| mln_status mln_map_add_vector_source_url | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| mln_buffer_view | url, | ||
| const mln_style_tile_source_options * | options ) |
Adds a vector source with a TileJSON URL.
source_id and url are borrowed for the call. options may be null for defaults. For URL sources, min_zoom, max_zoom, and vector_encoding override values from the loaded TileJSON when their field bits are set.
Returns:
| mln_status mln_map_copy_layer_source_id | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| char * | out_source_id, | ||
| size_t | source_id_capacity, | ||
| size_t * | out_source_id_size ) |
Copies one layer's source ID into caller-owned memory.
layer_id is borrowed for the call. On success, out_source_id_size receives the byte length excluding any null terminator, and 0 when the layer carries no source.
Passing null for out_source_id with a capacity of 0 is a size probe: it reports the required byte length and succeeds, so a caller can size a buffer without treating the result as a failure. With a non-null out_source_id, a capacity smaller than the required length still reports that length and returns MLN_STATUS_INVALID_ARGUMENT.
Returns:
| mln_status mln_map_copy_layer_source_layer | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| char * | out_source_layer, | ||
| size_t | source_layer_capacity, | ||
| size_t * | out_source_layer_size ) |
Copies one layer's source-layer ID into caller-owned memory.
layer_id is borrowed for the call. On success, out_source_layer_size receives the byte length excluding any null terminator, and 0 when the layer carries no source-layer.
Passing null for out_source_layer with a capacity of 0 is a size probe: it reports the required byte length and succeeds, so a caller can size a buffer without treating the result as a failure. With a non-null out_source_layer, a capacity smaller than the required length still reports that length and returns MLN_STATUS_INVALID_ARGUMENT.
Returns:
| mln_status mln_map_copy_style_image_premultiplied_rgba8 | ( | mln_map | map, |
| mln_buffer_view | image_id, | ||
| uint8_t * | out_pixels, | ||
| size_t | pixel_capacity, | ||
| size_t * | out_byte_length, | ||
| bool * | out_found ) |
Copies one runtime style image as tightly packed premultiplied RGBA8 pixels.
image_id is borrowed for the call. On success, out_byte_length receives the required byte length. When out_found is false, out_byte_length receives 0.
Passing null for out_pixels with a capacity of 0 is a size probe: it reports the required byte length and succeeds, so a caller can size a buffer without treating the result as a failure. With a non-null out_pixels, a capacity smaller than the required length still reports that length and returns MLN_STATUS_INVALID_ARGUMENT.
Returns:
| mln_status mln_map_copy_style_image_stretches | ( | mln_map | map, |
| mln_buffer_view | image_id, | ||
| mln_image_stretch * | out_stretch_x, | ||
| size_t | stretch_x_capacity, | ||
| size_t * | out_stretch_x_count, | ||
| mln_image_stretch * | out_stretch_y, | ||
| size_t | stretch_y_capacity, | ||
| size_t * | out_stretch_y_count, | ||
| bool * | out_found ) |
Copies one runtime style image's stretchable intervals.
image_id is borrowed for the call. Each output array may be null only when its capacity is 0. On success, out_stretch_x_count and out_stretch_y_count receive the interval counts, and both receive 0 when out_found is false.
Passing null for both arrays with both capacities 0 is a size probe: it reports the required counts and succeeds. With a non-null array, a capacity smaller than that axis's count still reports the counts and returns MLN_STATUS_INVALID_ARGUMENT.
Returns:
| mln_status mln_map_copy_style_source_attribution | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| char * | out_attribution, | ||
| size_t | attribution_capacity, | ||
| size_t * | out_attribution_size, | ||
| bool * | out_found ) |
Copies one style source attribution string into caller-owned memory.
source_id is borrowed for the call. On success, out_attribution_size receives the byte length of the attribution, excluding any null terminator. When out_found is false or the source has no attribution, out_attribution_size receives 0.
Passing null for out_attribution with a capacity of 0 is a size probe: it reports the required byte length and succeeds, so a caller can size a buffer without treating the result as a failure. With a non-null out_attribution, a capacity smaller than the required length still reports that length and returns MLN_STATUS_INVALID_ARGUMENT.
Returns:
| mln_status mln_map_copy_style_source_url | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| char * | out_url, | ||
| size_t | url_capacity, | ||
| size_t * | out_url_size, | ||
| bool * | out_found ) |
Copies one style source URL into caller-owned memory.
source_id is borrowed for the call. On success, out_url_size receives the URL byte length, excluding any null terminator. When out_found is false or the source has no URL, out_url_size receives 0.
Passing null for out_url with a capacity of 0 is a size probe. It reports the required byte length and succeeds. With a non-null out_url, a capacity smaller than the required length still reports that length and returns MLN_STATUS_INVALID_ARGUMENT.
Returns:
| mln_status mln_map_get_image_source_coordinates | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| mln_lat_lng * | out_coordinates, | ||
| size_t | coordinate_capacity, | ||
| size_t * | out_coordinate_count, | ||
| bool * | out_found ) |
Copies image source coordinates.
On success, out_found reports whether source_id exists. When found, out_coordinate_count receives 4. If coordinate_capacity is less than 4, out_coordinate_count still receives 4 and the function returns MLN_STATUS_INVALID_ARGUMENT.
Returns:
| mln_status mln_map_get_layer_filter | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| mln_buffer * | out_filter ) |
Serializes one layer filter as a style-spec JSON value.
On success, *out_filter receives an owned UTF-8 JSON buffer. Destroy it with mln_buffer_destroy(). Missing filters return null buffers.
Returns:
| mln_status mln_map_get_layer_max_zoom | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| double * | out_max_zoom ) |
Reads the highest zoom at which one layer draws.
A layer with no upper bound reports INFINITY.
Returns:
| mln_status mln_map_get_layer_min_zoom | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| double * | out_min_zoom ) |
Reads the lowest zoom at which one layer draws.
A layer with no lower bound reports -INFINITY.
Returns:
| mln_status mln_map_get_layer_property | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| mln_buffer_view | property_name, | ||
| mln_buffer * | out_value ) |
Serializes one layer property as a style-spec JSON value.
On success, *out_value receives an owned UTF-8 JSON buffer. Destroy it with mln_buffer_destroy(). Undefined native style properties return null buffers.
Returns:
| mln_status mln_map_get_layer_visibility | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| uint32_t * | out_visibility ) |
Reads whether one layer draws.
On success, *out_visibility receives an mln_style_layer_visibility value.
Returns:
| mln_status mln_map_get_style_image_info | ( | mln_map | map, |
| mln_buffer_view | image_id, | ||
| mln_style_image_info * | out_info, | ||
| bool * | out_found ) |
Copies fixed metadata for one runtime style image.
On success, out_found reports whether image_id exists. When not found, out_info receives default image metadata.
Returns:
| mln_status mln_map_get_style_layer_json | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| mln_buffer * | out_layer, | ||
| bool * | out_found ) |
Serializes one style layer as a full style-spec layer JSON object.
On success, out_found reports whether layer_id exists. When found, *out_layer receives an owned UTF-8 JSON buffer. Destroy it with mln_buffer_destroy().
Returns:
| mln_status mln_map_get_style_layer_type | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| mln_buffer_view * | out_layer_type, | ||
| bool * | out_found ) |
Borrows one style layer type string.
On success, out_found reports whether layer_id exists. When found, out_layer_type receives a view of a static style-spec layer type string.
Returns:
| mln_status mln_map_get_style_light_property | ( | mln_map | map, |
| mln_buffer_view | property_name, | ||
| mln_buffer * | out_value ) |
Serializes one style light property as a style-spec JSON value.
On success, *out_value receives an owned UTF-8 JSON buffer. Destroy it with mln_buffer_destroy(). Undefined native style light properties return null buffers.
Returns:
| mln_status mln_map_get_style_source_info | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| mln_style_source_info * | out_info, | ||
| bool * | out_found ) |
Copies fixed metadata for one style source.
The returned struct contains string lengths and fixed inline TileJSON fields, not string contents. Use mln_map_copy_style_source_attribution() and mln_map_copy_style_source_url() to copy individual strings, and mln_map_get_style_source_tile_urls() to copy inline tile URLs. The source ID is the lookup key and is also available through style source ID lists.
Returns:
| mln_status mln_map_get_style_source_tile_urls | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| mln_style_string_list * | out_tile_urls, | ||
| bool * | out_found ) |
Copies one style source's inline TileJSON tile URLs into an owned list.
On success, out_found reports whether source_id exists. When found, *out_tile_urls receives an owned list. A URL-backed tile source and every source without inline TileJSON return an empty list. Loading a URL-backed source does not change this result. Destroy the list with mln_style_string_list_destroy().
Returns:
| mln_status mln_map_get_style_source_type | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| uint32_t * | out_source_type, | ||
| bool * | out_found ) |
Gets one style source type.
On success, out_found reports whether source_id exists. When found, out_source_type receives one of mln_style_source_type.
Returns:
| mln_status mln_map_get_style_transition_options | ( | mln_map | map, |
| mln_style_transition_options * | out_options ) |
Reads the style's global transition options.
On success, *out_options receives the last-known transition configuration. Duration and delay report through their field-mask bits, because MapLibre Native leaves either one unset until a style or a host sets it.
A map that has loaded no style yet reports duration and delay unset. A style carrying no "transition" member reports a 300 millisecond duration, while a style carrying one reports only the members that object names, so a style whose transition declares a delay alone reports no duration. Read the field-mask bits rather than assuming a loaded style sets either.
MLN_STYLE_TRANSITION_OPTION_ENABLE_PLACEMENT_TRANSITIONS is always set on return and reports nothing about the field.
Returns:
| mln_status mln_map_invalidate_custom_geometry_source_region | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| mln_lat_lng_bounds | bounds ) |
Invalidates custom geometry source data inside one geographic region.
Returns:
| mln_status mln_map_invalidate_custom_geometry_source_tile | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| mln_canonical_tile_id | tile_id ) |
Invalidates custom geometry source data for one canonical tile.
Returns:
| mln_status mln_map_invalidate_custom_mvt_vector_source_tile | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| mln_canonical_tile_id | tile_id ) |
Invalidates custom MVT vector source data for one canonical tile.
Returns:
| mln_status mln_map_list_style_layer_ids | ( | mln_map | map, |
| mln_style_id_list * | out_layer_ids ) |
Copies style layer IDs in style order.
On success, *out_layer_ids receives an owned list handle. Destroy it with mln_style_id_list_destroy().
Returns:
| mln_status mln_map_list_style_source_ids | ( | mln_map | map, |
| mln_style_id_list * | out_source_ids ) |
Copies style source IDs in style order.
On success, *out_source_ids receives an owned list handle. Destroy it with mln_style_id_list_destroy().
Returns:
| mln_status mln_map_move_style_layer | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| mln_buffer_view | before_layer_id ) |
Moves one style layer before another layer or to the top.
layer_id and before_layer_id are borrowed for the call. Passing an empty before_layer_id moves the layer to the top of the style order.
Returns:
| mln_status mln_map_remove_style_image | ( | mln_map | map, |
| mln_buffer_view | image_id, | ||
| bool * | out_removed ) |
Removes one runtime style image by ID.
image_id is borrowed for the call. On success, out_removed reports whether an image existed and was removed.
Returns:
| mln_status mln_map_remove_style_layer | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| bool * | out_removed ) |
Removes one style layer by ID.
layer_id is borrowed for the call. On success, out_removed reports whether a layer existed and was removed.
Returns:
| mln_status mln_map_remove_style_source | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| bool * | out_removed ) |
Removes one style source by ID.
source_id is borrowed for the call. On success, out_removed reports whether a source existed and was removed.
Returns:
| mln_status mln_map_set_custom_geometry_source_tile_data | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| mln_canonical_tile_id | tile_id, | ||
| mln_buffer_view | data ) |
Sets custom geometry source data for one canonical tile.
source_id and UTF-8 GeoJSON data are borrowed for the call and parsed before return.
Returns:
| mln_status mln_map_set_custom_mvt_vector_source_tile_data | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| mln_canonical_tile_id | tile_id, | ||
| mln_buffer_view | data ) |
Sets custom MVT vector source data for one canonical tile.
source_id and the MVT protobuf bytes are borrowed for the call. The function copies accepted bytes before return. A zero-length view, including a null pointer with size 0, is an empty tile.
MapLibre ignores the bytes when that tile is not awaiting a response after fetch_tile, including after cancel_tile, and this call still returns MLN_STATUS_OK after validation.
Returns:
| mln_status mln_map_set_custom_mvt_vector_source_tile_error | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| mln_canonical_tile_id | tile_id, | ||
| mln_buffer_view | message ) |
Reports a custom MVT vector source error for one canonical tile.
source_id and the UTF-8 diagnostic message are borrowed for the call. The function copies accepted bytes before return. An empty message is accepted.
MapLibre ignores the error when that tile is not awaiting a response after fetch_tile, including after cancel_tile, and this call still returns MLN_STATUS_OK after validation.
Returns:
| mln_status mln_map_set_geojson_source_data | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| mln_geojson_source_data | data ) |
Updates one GeoJSON source with prepared inline data.
source_id is borrowed for the call. data names a live handle from mln_geojson_source_data_create(); the call borrows the handle and retains the prepared index, which makes this a cheap install: the expensive parse and tiling already happened when the data was prepared. Requested tiles are still sliced out of the index on a worker unless synchronous tiling is on.
The data must have been prepared with options equal to the options the source was added with. Cluster aggregation expressions compare by parsed equality, so equivalent cluster_properties JSON matches regardless of formatting. A mismatch is rejected, because MapLibre Native fixes a source's options at creation and data prepared under different options would tile inconsistently with them.
Returns:
| mln_status mln_map_set_geojson_source_synchronous_tiling | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| bool | enabled ) |
Overrides one GeoJSON source's synchronous tiling at runtime.
source_id is borrowed for the call. While enabled is true, the source slices requested tiles inline during the update pass, as if the source's options had set synchronous_tiling; false restores the option the source was added with. The override applies to update passes after this call returns. Hosts enable it around high-frequency small updates, such as a tracked position, so each installed update reaches the next rendered frame.
Returns:
| mln_status mln_map_set_geojson_source_url | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| mln_buffer_view | url ) |
Updates one GeoJSON source to load data from a URL.
source_id and url are borrowed for the call. The source keeps the mln_geojson_source_options it was added with.
Returns:
| mln_status mln_map_set_image_source_coordinates | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| const mln_lat_lng * | coordinates, | ||
| size_t | coordinate_count ) |
Updates image source coordinates.
coordinates is borrowed for the call and must contain exactly four coordinates in top-left, top-right, bottom-right, bottom-left order. The function copies accepted coordinates into MapLibre Native before return.
Returns:
| mln_status mln_map_set_image_source_image | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| const mln_premultiplied_rgba8_image * | image ) |
Updates an image source with inline image pixels.
source_id, image, and image pixels are borrowed for the call. The function copies accepted pixels into MapLibre Native before return.
Returns:
| mln_status mln_map_set_image_source_url | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| mln_buffer_view | url ) |
Updates an image source to load its image from a URL.
source_id and url are borrowed for the call. Later URL load or decode failures are reported through runtime events.
Returns:
| mln_status mln_map_set_layer_filter | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| const mln_buffer_view * | filter ) |
Sets or clears one layer filter.
layer_id and filter are borrowed for the call. Passing null for filter clears the layer filter. Non-null filters use the MapLibre style-spec filter JSON representation. The function parses and copies the accepted filter into MapLibre Native's typed filter expression storage before return.
Returns:
| mln_status mln_map_set_layer_max_zoom | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| double | max_zoom ) |
Sets the highest zoom at which one layer draws.
Pass INFINITY for no upper bound. MapLibre Native stores the zoom range as single-precision floats, so this narrows the value.
Returns:
| mln_status mln_map_set_layer_min_zoom | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| double | min_zoom ) |
Sets the lowest zoom at which one layer draws.
Pass -INFINITY for no lower bound. MapLibre Native stores the zoom range as single-precision floats, so this narrows the value.
Returns:
| mln_status mln_map_set_layer_property | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| mln_buffer_view | property_name, | ||
| mln_buffer_view | value ) |
Sets one layer property using its MapLibre style-spec property name.
layer_id, property_name, and value are borrowed for the call. value is a style-spec JSON value. Expressions use style-spec expression JSON arrays. The function parses and copies the accepted value into MapLibre Native's typed style property storage before return.
Returns:
| mln_status mln_map_set_layer_source_id | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| mln_buffer_view | source_id ) |
Sets one layer's source ID.
layer_id and source_id are borrowed for the call and copied into MapLibre Native's layer storage before return. This does not require the named source to exist yet; MapLibre reports an unresolved source through style events.
Only layer types that require a source carry a source ID; this rejects the others, such as background and custom.
Returns:
| mln_status mln_map_set_layer_source_layer | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| mln_buffer_view | source_layer ) |
Sets one layer's source-layer ID.
layer_id and source_layer are borrowed for the call and copied into MapLibre Native's layer storage before return. Passing an empty source_layer clears it.
Only layer types that require a source carry a source-layer; this rejects the others, such as background and custom.
Returns:
| mln_status mln_map_set_layer_visibility | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| uint32_t | visibility ) |
Sets whether one layer draws.
visibility is an mln_style_layer_visibility value.
Returns:
| mln_status mln_map_set_location_indicator_accuracy_radius | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| double | radius ) |
Sets a location indicator layer accuracy radius in logical pixels.
Returns:
| mln_status mln_map_set_location_indicator_bearing | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| double | bearing ) |
Sets a location indicator layer bearing in degrees.
Returns:
| mln_status mln_map_set_location_indicator_image_name | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| uint32_t | image_kind, | ||
| mln_buffer_view | image_id ) |
Sets one location indicator image-name property.
image_id is borrowed for the call and copied into native style storage. The named style image does not need to exist when this function is called.
Returns:
| mln_status mln_map_set_location_indicator_location | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| mln_lat_lng | coordinate, | ||
| double | altitude ) |
Sets a location indicator layer location.
coordinate uses normal C API latitude/longitude order. The underlying style property is written as [latitude, longitude, altitude], matching the order the renderer reads it back in.
Returns:
| mln_status mln_map_set_style_image | ( | mln_map | map, |
| mln_buffer_view | image_id, | ||
| const mln_premultiplied_rgba8_image * | image, | ||
| const mln_style_image_options * | options ) |
Sets one runtime style image.
image_id, image, and image pixels are borrowed for the call. The function copies accepted pixel bytes into the current style before return. If image_id already exists, the native image is replaced.
Runtime style images belong to the current style. Loading another style URL or JSON document drops images that were added to the previous style.
Returns:
| mln_status mln_map_set_style_light_json | ( | mln_map | map, |
| mln_buffer_view | light_json ) |
Sets the style light from a style-spec light JSON object.
light_json is borrowed for the call. The function parses and copies the accepted light into MapLibre Native before return.
Returns:
| mln_status mln_map_set_style_light_property | ( | mln_map | map, |
| mln_buffer_view | property_name, | ||
| mln_buffer_view | value ) |
Sets one style light property using its MapLibre style-spec property name.
property_name and value are borrowed for the call. value is a style-spec JSON value. The function parses and copies the accepted value into MapLibre Native's typed light property storage before return.
Returns:
| mln_status mln_map_set_style_transition_options | ( | mln_map | map, |
| const mln_style_transition_options * | options ) |
Sets the style's global transition options.
options is borrowed for the call and copied into MapLibre Native before return. Omitted duration and delay fields clear the style-wide override, so this call replaces the whole transition configuration rather than merging into it.
Loading a style replaces these options with the ones that style declares, so a host that overrides them applies the override after the style loads.
Returns:
| mln_status mln_map_style_image_exists | ( | mln_map | map, |
| mln_buffer_view | image_id, | ||
| bool * | out_exists ) |
Reports whether a runtime style image ID exists.
Returns:
| mln_status mln_map_style_layer_exists | ( | mln_map | map, |
| mln_buffer_view | layer_id, | ||
| bool * | out_exists ) |
Reports whether a style layer ID exists.
Returns:
| mln_status mln_map_style_source_exists | ( | mln_map | map, |
| mln_buffer_view | source_id, | ||
| bool * | out_exists ) |
Reports whether a style source ID exists.
Returns:
| mln_premultiplied_rgba8_image mln_premultiplied_rgba8_image_default | ( | void | ) |
Returns a default premultiplied RGBA8 image descriptor.
| mln_status mln_style_id_list_count | ( | mln_style_id_list | list, |
| size_t * | out_count ) |
Gets the number of IDs in a style ID list handle.
Returns:
| void mln_style_id_list_destroy | ( | mln_style_id_list | list | ) |
Destroys a style ID list handle. Null is accepted as a no-op.
| mln_status mln_style_id_list_get | ( | mln_style_id_list | list, |
| size_t | index, | ||
| mln_buffer_view * | out_id ) |
Borrows one ID from a style ID list handle.
On success, out_id receives a view into list-owned storage. The view remains valid until the list is destroyed.
Returns:
| mln_style_image_info mln_style_image_info_default | ( | void | ) |
Returns default runtime style image metadata.
| mln_style_image_options mln_style_image_options_default | ( | void | ) |
Returns default runtime style image options.
| mln_status mln_style_string_list_count | ( | mln_style_string_list | list, |
| size_t * | out_count ) |
Gets the number of strings in a style string list handle.
Returns:
| void mln_style_string_list_destroy | ( | mln_style_string_list | list | ) |
Destroys a style string list handle. Null is accepted as a no-op.
| mln_status mln_style_string_list_get | ( | mln_style_string_list | list, |
| size_t | index, | ||
| mln_buffer_view * | out_value ) |
Borrows one string from a style string list handle.
On success, out_value receives a view into list-owned storage. The view remains valid until the list is destroyed.
Returns:
| mln_style_tile_source_options mln_style_tile_source_options_default | ( | void | ) |
Returns default tile source options.
| mln_style_transition_options mln_style_transition_options_default | ( | void | ) |
Returns default global style transition options.