CameraProjection

Provides an imperative API to interact with the projection of the map, such as converting coordinates or querying what's visible.

Functions

Link copied to clipboard
fun positionFromScreenLocation(offset: DpOffset): Position

Returns a position that corresponds to the given offset from the top-left corner of the map composable.

Link copied to clipboard
fun queryRenderedFeatures(offset: DpOffset, layerIds: Set<String>? = null, predicate: Expression<BooleanValue> = const(true)): List<Feature>

Returns a list of features that are rendered at the given offset from the top-left corner of the map composable, optionally limited to layers with the given layerIds and filtered by the given predicate. The result is sorted by render order, i.e. the feature in front is first in the list.

fun queryRenderedFeatures(rect: DpRect, layerIds: Set<String>? = null, predicate: Expression<BooleanValue> = const(true)): List<Feature>

Returns a list of features whose rendered geometry intersect with the given rect, optionally limited to layers with the given layerIds and filtered by the given predicate. The result is sorted by render order, i.e. the feature in front is first in the list.

Link copied to clipboard

Returns the smallest bounding box that contains the currently visible area.

Link copied to clipboard

Returns the currently visible area, which is a four-sided polygon spanned by the four points each at one corner of the map composable. If the camera has tilt (pitch), this polygon is a trapezoid instead of a rectangle.

Link copied to clipboard
fun screenLocationFromPosition(position: Position): DpOffset

Returns an offset from the top-left corner of the map composable that corresponds to the given position. This works for positions that are off-screen, too.