MapLibre Native C API
Public C ABI for the MapLibre Native wrapper.
Loading...
Searching...
No Matches
query.h File Reference

Go to the source code of this file.

Data Structures

struct  mln_screen_box
struct  mln_screen_line_string
union  mln_rendered_query_geometry_data
struct  mln_rendered_query_geometry
struct  mln_rendered_feature_query_options
struct  mln_source_feature_query_options
struct  mln_rendered_feature
struct  mln_source_feature

Typedefs

typedef enum mln_rendered_query_geometry_type mln_rendered_query_geometry_type
typedef struct mln_screen_box mln_screen_box
typedef struct mln_screen_line_string mln_screen_line_string
typedef union mln_rendered_query_geometry_data mln_rendered_query_geometry_data
typedef struct mln_rendered_query_geometry mln_rendered_query_geometry
typedef enum mln_rendered_feature_query_option_field mln_rendered_feature_query_option_field
typedef uint32_t mln_rendered_feature_query_option_fields
typedef struct mln_rendered_feature_query_options mln_rendered_feature_query_options
typedef enum mln_source_feature_query_option_field mln_source_feature_query_option_field
typedef uint32_t mln_source_feature_query_option_fields
typedef struct mln_source_feature_query_options mln_source_feature_query_options
typedef struct mln_rendered_feature mln_rendered_feature
typedef struct mln_source_feature mln_source_feature

Enumerations

enum  mln_rendered_query_geometry_type : uint32_t { MLN_RENDERED_QUERY_GEOMETRY_TYPE_POINT = 1 , MLN_RENDERED_QUERY_GEOMETRY_TYPE_BOX = 2 , MLN_RENDERED_QUERY_GEOMETRY_TYPE_LINE_STRING = 3 }
enum  mln_rendered_feature_query_option_field : uint32_t { MLN_RENDERED_FEATURE_QUERY_OPTION_LAYER_IDS = 1U << 0U }
enum  mln_source_feature_query_option_field : uint32_t { MLN_SOURCE_FEATURE_QUERY_OPTION_SOURCE_LAYER_IDS = 1U << 0U }

Functions

mln_status mln_render_session_query_rendered_features (mln_render_session session, const mln_rendered_query_geometry *geometry, const mln_rendered_feature_query_options *options, const mln_completion *completion, mln_diagnostic *out_diagnostic)
mln_status mln_render_session_query_source_features (mln_render_session session, mln_buffer_view source_id, const mln_source_feature_query_options *options, const mln_completion *completion, mln_diagnostic *out_diagnostic)
mln_status mln_render_session_get_cluster_children (mln_render_session session, mln_buffer_view source_id, uint32_t cluster_id, const mln_completion *completion, mln_diagnostic *out_diagnostic)
mln_status mln_render_session_get_cluster_leaves (mln_render_session session, mln_buffer_view source_id, uint32_t cluster_id, uint32_t limit, uint32_t offset, const mln_completion *completion, mln_diagnostic *out_diagnostic)
mln_status mln_render_session_get_cluster_expansion_zoom (mln_render_session session, mln_buffer_view source_id, uint32_t cluster_id, const mln_completion *completion, mln_diagnostic *out_diagnostic)

Detailed Description

Find the features on the map or in a source.

Typedef Documentation

◆ mln_rendered_feature

typedef struct mln_rendered_feature mln_rendered_feature

A feature that a rendered feature query found.

◆ mln_rendered_feature_query_option_field

◆ mln_rendered_feature_query_option_fields

◆ mln_rendered_feature_query_options

typedef struct mln_rendered_feature_query_options mln_rendered_feature_query_options

Options for a rendered feature query.

◆ mln_rendered_query_geometry

typedef struct mln_rendered_query_geometry mln_rendered_query_geometry

The screen area that a rendered feature query covers.

◆ mln_rendered_query_geometry_data

typedef union mln_rendered_query_geometry_data mln_rendered_query_geometry_data

The point, box, or line of a rendered feature query.

◆ mln_rendered_query_geometry_type

The shape of the screen area that a rendered feature query covers.

◆ mln_screen_box

typedef struct mln_screen_box mln_screen_box

A rectangle of the screen, from its min corner to its max corner.

◆ mln_screen_line_string

typedef struct mln_screen_line_string mln_screen_line_string

A line through points on the screen.

◆ mln_source_feature

typedef struct mln_source_feature mln_source_feature

A feature that a source feature query found.

◆ mln_source_feature_query_option_field

◆ mln_source_feature_query_option_fields

◆ mln_source_feature_query_options

typedef struct mln_source_feature_query_options mln_source_feature_query_options

Options for a source feature query.

Enumeration Type Documentation

◆ mln_rendered_feature_query_option_field

The fields that mln_rendered_feature_query_options sets.

Enumerator
MLN_RENDERED_FEATURE_QUERY_OPTION_LAYER_IDS 

◆ mln_rendered_query_geometry_type

The shape of the screen area that a rendered feature query covers.

Enumerator
MLN_RENDERED_QUERY_GEOMETRY_TYPE_POINT 
MLN_RENDERED_QUERY_GEOMETRY_TYPE_BOX 
MLN_RENDERED_QUERY_GEOMETRY_TYPE_LINE_STRING 

◆ mln_source_feature_query_option_field

The fields that mln_source_feature_query_options sets.

Enumerator
MLN_SOURCE_FEATURE_QUERY_OPTION_SOURCE_LAYER_IDS 

Function Documentation

◆ mln_render_session_get_cluster_children()

mln_status mln_render_session_get_cluster_children ( mln_render_session session,
mln_buffer_view source_id,
uint32_t cluster_id,
const mln_completion * completion,
mln_diagnostic * out_diagnostic )

Reads the children of a cluster in a clustered GeoJSON source.

cluster_id is the "cluster_id" property of a cluster feature. The result is a GeoJSON feature collection of the clusters and points that the cluster splits into at the next zoom level.

The query reads the source's data from the session's most recent render attempt, so a change to the data shows once the session tries to render again.

A cluster ID belongs to one version of the source's data. After the data changes, feature queries can return IDs from the earlier version until the source's tiles reload, and such an ID completes with MLN_STATUS_NOT_FOUND or names a different cluster. Query the features again for current IDs.

Completes with:

  • MLN_STATUS_NOT_FOUND when the session's most recent render attempt had no source named source_id, or the source has no cluster cluster_id.
  • MLN_STATUS_INVALID_ARGUMENT when the source isn't a GeoJSON source with clustering turned on.

◆ mln_render_session_get_cluster_expansion_zoom()

mln_status mln_render_session_get_cluster_expansion_zoom ( mln_render_session session,
mln_buffer_view source_id,
uint32_t cluster_id,
const mln_completion * completion,
mln_diagnostic * out_diagnostic )

Reads the zoom level at which a cluster of a clustered GeoJSON source splits.

cluster_id is the "cluster_id" property of a cluster feature. At the result's zoom level, the cluster splits into two or more clusters or points.

A cluster ID can go out of date as mln_render_session_get_cluster_children() describes.

Completes with:

  • MLN_STATUS_NOT_FOUND when the session's most recent render attempt had no source named source_id, or the source has no cluster cluster_id.
  • MLN_STATUS_INVALID_ARGUMENT when the source isn't a GeoJSON source with clustering turned on.

◆ mln_render_session_get_cluster_leaves()

mln_status mln_render_session_get_cluster_leaves ( mln_render_session session,
mln_buffer_view source_id,
uint32_t cluster_id,
uint32_t limit,
uint32_t offset,
const mln_completion * completion,
mln_diagnostic * out_diagnostic )

Reads the points in a cluster of a clustered GeoJSON source.

cluster_id is the "cluster_id" property of a cluster feature. The result is a GeoJSON feature collection of the original point features. It skips the first offset points and then holds up to limit of them, so a limit of 0 gives an empty collection.

A cluster ID can go out of date as mln_render_session_get_cluster_children() describes.

Completes with:

  • MLN_STATUS_NOT_FOUND when the session's most recent render attempt had no source named source_id, or the source has no cluster cluster_id.
  • MLN_STATUS_INVALID_ARGUMENT when the source isn't a GeoJSON source with clustering turned on.

◆ mln_render_session_query_rendered_features()

mln_status mln_render_session_query_rendered_features ( mln_render_session session,
const mln_rendered_query_geometry * geometry,
const mln_rendered_feature_query_options * options,
const mln_completion * completion,
mln_diagnostic * out_diagnostic )

Finds the features that the session drew in an area of the screen.

The query reads the last frame that the session rendered. A feature that several layers draw appears once for each layer.

◆ mln_render_session_query_source_features()

mln_status mln_render_session_query_source_features ( mln_render_session session,
mln_buffer_view source_id,
const mln_source_feature_query_options * options,
const mln_completion * completion,
mln_diagnostic * out_diagnostic )

Finds the features of the source named source_id.

The query covers only the tiles that the source has loaded for the current view. A source loads tiles only while a visible layer uses it.