maplibre_native_ffi

Low-level Python bindings generated from the MapLibre C API.

The maplibre-native-ffi distribution holds this package, and a runtime distribution holds the native extension for one render backend: maplibre-native-ffi-runtime-opengl, maplibre-native-ffi-runtime-metal, or maplibre-native-ffi-runtime-vulkan. Windows also offers the MinGW flavors maplibre-native-ffi-runtime-opengl-mingw and maplibre-native-ffi-runtime-vulkan-mingw. Importing the package raises ImportError unless exactly one runtime is installed.

Commands and ordered queries return concurrent.futures.Future objects. Their results are copied before native completion returns. A command's future resolves only when the command commits, and raises MaplibreError when it fails or is cancelled; discarding submits a command without a future, and native logs its failure as a warning. User done callbacks run on host worker threads in registration order for each future; a callback can submit another operation and wait for its result. Use asyncio.wrap_future to await a binding future from an asyncio task.

A JSON value, annotated Any, is any value that json.dumps takes, so set_style_layer_property("roads", "line-color", "red") needs no inner quotes. A JSON parameter is always a value: None is JSON null, such as the null that restores a layer property's default. In a record member, None is absent, which native reads as empty, as for a filter, an expression input, or cluster properties, where JSON null means nothing. A value that json.dumps rejects raises its error before the call reaches native. Returned JSON is the value that json.loads reads, and absent JSON is None, as JSON null is.

Every callback that Python supplies, and every completion, runs on one dispatcher thread that the binding owns, after native queues the call, so a callback that blocks delays every other one. Waiting for a pending binding future in a callback raises RuntimeError, since that future resolves on the same thread. Hand work that touches thread-bound state, such as an asyncio loop or a Tk or Qt widget, to its thread, for example with loop.call_soon_threadsafe. Native code answers what a call decides itself, so a log record is always consumed. HTTP header transforms take native header rules, and queue locks take only native registrations, since native code waits for both on its own threads.

Interpreter shutdown stops the dispatcher, after the call it is running returns, and drops every call that is still queued.

 1"""Low-level Python bindings generated from the MapLibre C API.
 2
 3The ``maplibre-native-ffi`` distribution holds this package, and a runtime
 4distribution holds the native extension for one render backend:
 5``maplibre-native-ffi-runtime-opengl``, ``maplibre-native-ffi-runtime-metal``,
 6or ``maplibre-native-ffi-runtime-vulkan``. Windows also offers the MinGW
 7flavors ``maplibre-native-ffi-runtime-opengl-mingw`` and
 8``maplibre-native-ffi-runtime-vulkan-mingw``. Importing the package raises
 9``ImportError`` unless exactly one runtime is installed.
10
11Commands and ordered queries return ``concurrent.futures.Future`` objects.
12Their results are copied before native completion returns. A command's future
13resolves only when the command commits, and raises ``MaplibreError`` when it
14fails or is cancelled; ``discarding`` submits a command without a future, and
15native logs its failure as a warning. User done callbacks run on host worker
16threads in registration order for each future; a callback can submit another
17operation and wait for its result. Use ``asyncio.wrap_future`` to await a
18binding future from an asyncio task.
19
20A JSON value, annotated ``Any``, is any value that ``json.dumps`` takes, so
21``set_style_layer_property("roads", "line-color", "red")`` needs no inner
22quotes. A JSON parameter is always a value: ``None`` is JSON null, such as the
23null that restores a layer property's default. In a record member, ``None`` is
24absent, which native reads as empty, as for a filter, an expression input, or
25cluster properties, where JSON null means nothing. A value that ``json.dumps``
26rejects raises its error before the call reaches native. Returned JSON is the
27value that ``json.loads`` reads, and absent JSON is ``None``, as JSON null is.
28
29Every callback that Python supplies, and every completion, runs on one
30dispatcher thread that the binding owns, after native queues the call, so a
31callback that blocks delays every other one. Waiting for a pending binding
32future in a callback raises ``RuntimeError``, since that future resolves on the
33same thread. Hand work that touches thread-bound state, such as an asyncio loop
34or a Tk or Qt widget, to its thread, for example with
35``loop.call_soon_threadsafe``. Native code answers what a call decides itself,
36so a log record is always consumed. HTTP header transforms take native header
37rules, and queue locks take only native registrations, since native code
38waits for both on its own threads.
39
40Interpreter shutdown stops the dispatcher, after the call it is running
41returns, and drops every call that is still queued.
42"""
43
44from ._completion import CommandCompletion
45from .api import *
46from .api import __all__ as _api_exports
47from .errors import AbiVersionMismatchError, MaplibreError
48
49__all__ = [
50    "AbiVersionMismatchError",
51    "CommandCompletion",
52    "MaplibreError",
53]
54
55__all__.extend(_api_exports)
class AbiVersionMismatchError(maplibre_native_ffi.MaplibreError):
21class AbiVersionMismatchError(MaplibreError):
22    """The linked library's ABI version differs from the binding's version."""
23
24    def __init__(self, expected: int, actual: int) -> None:
25        self.expected = expected
26        self.actual = actual
27        super().__init__(
28            Status.UNSUPPORTED,
29            f"unsupported MapLibre Native C ABI version {actual}; expected {expected}",
30        )

The linked library's ABI version differs from the binding's version.

AbiVersionMismatchError(expected: int, actual: int)
24    def __init__(self, expected: int, actual: int) -> None:
25        self.expected = expected
26        self.actual = actual
27        super().__init__(
28            Status.UNSUPPORTED,
29            f"unsupported MapLibre Native C ABI version {actual}; expected {expected}",
30        )
expected
actual
@dataclass(frozen=True, slots=True)
class CommandCompletion:
 7@dataclass(frozen=True, slots=True)
 8class CommandCompletion:
 9    """The generations that a committed command published, which are zero
10    unless it is a map command.
11
12    A command future raises ``MaplibreError`` instead when the command fails
13    or is cancelled.
14    """
15
16    generation: int
17    render_update_generation: int

The generations that a committed command published, which are zero unless it is a map command.

A command future raises MaplibreError instead when the command fails or is cancelled.

CommandCompletion(generation: int, render_update_generation: int)
generation: int
render_update_generation: int
class MaplibreError(builtins.Exception):
 5class MaplibreError(Exception):
 6    """A failed call's status and diagnostic.
 7
 8    ``generation`` is the map snapshot generation that a failed map command
 9    published, and zero for any other failure.
10    """
11
12    def __init__(
13        self, status: Status | int, diagnostic: str = "", generation: int = 0
14    ) -> None:
15        self.status = Status(status)
16        self.diagnostic = diagnostic
17        self.generation = generation
18        super().__init__(f"{self.status.name}: {diagnostic}")

A failed call's status and diagnostic.

generation is the map snapshot generation that a failed map command published, and zero for any other failure.

MaplibreError( status: Status | int, diagnostic: str = '', generation: int = 0)
12    def __init__(
13        self, status: Status | int, diagnostic: str = "", generation: int = 0
14    ) -> None:
15        self.status = Status(status)
16        self.diagnostic = diagnostic
17        self.generation = generation
18        super().__init__(f"{self.status.name}: {diagnostic}")
status
diagnostic
generation
DIAGNOSTIC_MESSAGE_CAPACITY = 4096
FRAME_DEMAND_TOKEN_STILL_IMAGE = 18446744073709551615
TEXTURE_RING_MAX_DEPTH = 8
VULKAN_NON_DISPATCHABLE_HANDLE_NULL = 0
class AcquiredFrameHandle(maplibre_native_ffi._generated_operations._AcquiredFrameHandleOperations, maplibre_native_ffi._lifecycle.NativeHandleMixin):
23quotes. A JSON parameter is always a value: ``None`` is JSON null, such as the

A rendered frame that the caller holds to read or show.

See mln_acquired_frame in the C API reference.

def discard(self) -> None:
144    def discard(self) -> None:
145        """Gives up an acquired frame without saying when your GPU stops reading
146        it.
147
148        Because your GPU may still read the frame's texture, the session
149        never renders into that texture again.
150
151        See `mln_acquired_frame_discard` in the
152        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
153        """
154        return self._native.discard()

Gives up an acquired frame without saying when your GPU stops reading it.

Because your GPU may still read the frame's texture, the session never renders into that texture again.

See mln_acquired_frame_discard in the C API reference.

def android_hardware_buffer( self) -> contextlib.AbstractContextManager[AndroidHardwareBufferFrame]:
156    def android_hardware_buffer(
157        self,
158    ) -> AbstractContextManager[AndroidHardwareBufferFrame]:
159        """Gets the Android hardware buffer of an acquired frame.
160
161        Wait for `AcquiredFrameHandle.producer_sync()` before you read the
162        buffer. Once you release or discard the frame, the session may render
163        into the buffer again. A reference that you take with
164        `AHardwareBuffer_acquire` keeps the buffer's memory, but not its
165        contents.
166
167        Native resources remain valid only inside the `with` block.
168
169        See `mln_acquired_frame_get_android_hardware_buffer` in the
170        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/android_8h.html).
171
172        Errors:
173
174        - `Status.TARGET_LOST` when the session failed, or you detached,
175          abandoned, or disposed it.
176        """
177        return _view(
178            self,
179            lambda: self._native.android_hardware_buffer(),
180            lambda raw: AndroidHardwareBufferFrame._from_native(raw),
181        )

Gets the Android hardware buffer of an acquired frame.

Wait for AcquiredFrameHandle.producer_sync() before you read the buffer. Once you release or discard the frame, the session may render into the buffer again. A reference that you take with AHardwareBuffer_acquire keeps the buffer's memory, but not its contents.

Native resources remain valid only inside the with block.

See mln_acquired_frame_get_android_hardware_buffer in the C API reference.

Errors:

def dma_buf( self) -> contextlib.AbstractContextManager[DmaBufFrame]:
183    def dma_buf(self) -> AbstractContextManager[DmaBufFrame]:
184        """Gets the dmabuf of an acquired frame.
185
186        Wait for `AcquiredFrameHandle.producer_sync()` before you read the
187        buffer. Once you release or discard the frame, the session may render
188        into the buffer again. You can map a buffer with
189        DRM_FORMAT_MOD_LINEAR, which has one plane, with `mmap`, and bracket
190        your reads with DMA_BUF_IOCTL_SYNC.
191
192        The session owns the planes' file descriptors, so don't close them.
193        To keep the buffer after you release the frame, duplicate each file
194        descriptor with `dup`. A duplicate keeps the buffer's memory, but not
195        its contents.
196
197        Native resources remain valid only inside the `with` block.
198
199        See `mln_acquired_frame_get_dma_buf` in the
200        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/linux_8h.html).
201
202        Errors:
203
204        - `Status.TARGET_LOST` when the session failed, or you detached,
205          abandoned, or disposed it.
206        """
207        return _view(
208            self,
209            lambda: self._native.dma_buf(),
210            lambda raw: DmaBufFrame._from_native(raw),
211        )

Gets the dmabuf of an acquired frame.

Wait for AcquiredFrameHandle.producer_sync() before you read the buffer. Once you release or discard the frame, the session may render into the buffer again. You can map a buffer with DRM_FORMAT_MOD_LINEAR, which has one plane, with mmap, and bracket your reads with DMA_BUF_IOCTL_SYNC.

The session owns the planes' file descriptors, so don't close them. To keep the buffer after you release the frame, duplicate each file descriptor with dup. A duplicate keeps the buffer's memory, but not its contents.

Native resources remain valid only inside the with block.

See mln_acquired_frame_get_dma_buf in the C API reference.

Errors:

def dxgi_shared_texture( self) -> contextlib.AbstractContextManager[DxgiSharedTextureFrame]:
213    def dxgi_shared_texture(self) -> AbstractContextManager[DxgiSharedTextureFrame]:
214        """Gets the DXGI shared texture of an acquired frame.
215
216        Wait for `AcquiredFrameHandle.producer_sync()` before you read the
217        texture. Once you release or discard the frame, the session may
218        render into the texture again. Open the handle with
219        `ID3D11Device1::OpenSharedResource1` or
220        `ID3D12Device::OpenSharedHandle`. A texture that you open keeps its
221        memory, but not its contents.
222
223        The session owns the handle, so don't close it. To keep the handle
224        after you release the frame, duplicate it with `DuplicateHandle`.
225
226        Native resources remain valid only inside the `with` block.
227
228        See `mln_acquired_frame_get_dxgi_shared_texture` in the
229        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/win32_8h.html).
230
231        Errors:
232
233        - `Status.TARGET_LOST` when the session failed, or you detached,
234          abandoned, or disposed it.
235        """
236        return _view(
237            self,
238            lambda: self._native.dxgi_shared_texture(),
239            lambda raw: DxgiSharedTextureFrame._from_native(raw),
240        )

Gets the DXGI shared texture of an acquired frame.

Wait for AcquiredFrameHandle.producer_sync() before you read the texture. Once you release or discard the frame, the session may render into the texture again. Open the handle with ID3D11Device1::OpenSharedResource1 or ID3D12Device::OpenSharedHandle. A texture that you open keeps its memory, but not its contents.

The session owns the handle, so don't close it. To keep the handle after you release the frame, duplicate it with DuplicateHandle.

Native resources remain valid only inside the with block.

See mln_acquired_frame_get_dxgi_shared_texture in the C API reference.

Errors:

def io_surface( self) -> contextlib.AbstractContextManager[IoSurfaceFrame]:
242    def io_surface(self) -> AbstractContextManager[IoSurfaceFrame]:
243        """Gets the IOSurface of an acquired frame.
244
245        Wait for `AcquiredFrameHandle.producer_sync()` before you read the
246        surface. Once you release or discard the frame, the session may
247        render into the surface again. For an API that takes a
248        `CVPixelBuffer`, wrap the surface with
249        `CVPixelBufferCreateWithIOSurface`. A reference that you take with
250        `CFRetain`, or a pixel buffer that wraps the surface, keeps the
251        surface's memory, but not its contents.
252
253        Native resources remain valid only inside the `with` block.
254
255        See `mln_acquired_frame_get_io_surface` in the
256        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/apple_8h.html).
257
258        Errors:
259
260        - `Status.TARGET_LOST` when the session failed, or you detached,
261          abandoned, or disposed it.
262        """
263        return _view(
264            self,
265            lambda: self._native.io_surface(),
266            lambda raw: IoSurfaceFrame._from_native(raw),
267        )

Gets the IOSurface of an acquired frame.

Wait for AcquiredFrameHandle.producer_sync() before you read the surface. Once you release or discard the frame, the session may render into the surface again. For an API that takes a CVPixelBuffer, wrap the surface with CVPixelBufferCreateWithIOSurface. A reference that you take with CFRetain, or a pixel buffer that wraps the surface, keeps the surface's memory, but not its contents.

Native resources remain valid only inside the with block.

See mln_acquired_frame_get_io_surface in the C API reference.

Errors:

def metal_texture( self) -> contextlib.AbstractContextManager[MetalTextureFrame]:
269    def metal_texture(self) -> AbstractContextManager[MetalTextureFrame]:
270        """Gets the Metal texture of an acquired frame.
271
272        Native resources remain valid only inside the `with` block.
273
274        See `mln_acquired_frame_get_metal_texture` in the
275        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
276
277        Errors:
278
279        - `Status.TARGET_LOST` when the session failed, or you detached,
280          abandoned, or disposed it.
281        """
282        return _view(
283            self,
284            lambda: self._native.metal_texture(),
285            lambda raw: MetalTextureFrame._from_native(raw),
286        )

Gets the Metal texture of an acquired frame.

Native resources remain valid only inside the with block.

See mln_acquired_frame_get_metal_texture in the C API reference.

Errors:

def open_gl_texture( self) -> contextlib.AbstractContextManager[OpenGlTextureFrame]:
288    def open_gl_texture(self) -> AbstractContextManager[OpenGlTextureFrame]:
289        """Gets the OpenGL texture of an acquired frame.
290
291        Native resources remain valid only inside the `with` block.
292
293        See `mln_acquired_frame_get_open_gl_texture` in the
294        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
295
296        Errors:
297
298        - `Status.TARGET_LOST` when the session failed, or you detached,
299          abandoned, or disposed it.
300        """
301        return _view(
302            self,
303            lambda: self._native.open_gl_texture(),
304            lambda raw: OpenGlTextureFrame._from_native(raw),
305        )

Gets the OpenGL texture of an acquired frame.

Native resources remain valid only inside the with block.

See mln_acquired_frame_get_open_gl_texture in the C API reference.

Errors:

def producer_sync( self) -> contextlib.AbstractContextManager[GpuSync]:
307    def producer_sync(self) -> AbstractContextManager[GpuSync]:
308        """Reads what to wait for before you read an acquired frame's texture.
309
310        Native resources remain valid only inside the `with` block.
311
312        See `mln_acquired_frame_get_producer_sync` in the
313        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
314
315        Errors:
316
317        - `Status.TARGET_LOST` when the session failed, or you detached,
318          abandoned, or disposed it.
319        """
320        return _view(
321            self,
322            lambda: self._native.producer_sync(),
323            lambda raw: GpuSync._from_native(raw),
324        )

Reads what to wait for before you read an acquired frame's texture.

Native resources remain valid only inside the with block.

See mln_acquired_frame_get_producer_sync in the C API reference.

Errors:

def get_result(self) -> RenderFrameResult:
326    def get_result(self) -> RenderFrameResult:
327        """Reads the frame result of an acquired frame.
328
329        It succeeds until you release or discard the frame, whatever the
330        session's state.
331
332        See `mln_acquired_frame_get_result` in the
333        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
334        """
335        return RenderFrameResult._from_native(self._native.get_result())

Reads the frame result of an acquired frame.

It succeeds until you release or discard the frame, whatever the session's state.

See mln_acquired_frame_get_result in the C API reference.

def vulkan_texture( self) -> contextlib.AbstractContextManager[VulkanTextureFrame]:
337    def vulkan_texture(self) -> AbstractContextManager[VulkanTextureFrame]:
338        """Gets the Vulkan image of an acquired frame.
339
340        Native resources remain valid only inside the `with` block.
341
342        See `mln_acquired_frame_get_vulkan_texture` in the
343        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
344
345        Errors:
346
347        - `Status.TARGET_LOST` when the session failed, or you detached,
348          abandoned, or disposed it.
349        """
350        return _view(
351            self,
352            lambda: self._native.vulkan_texture(),
353            lambda raw: VulkanTextureFrame._from_native(raw),
354        )

Gets the Vulkan image of an acquired frame.

Native resources remain valid only inside the with block.

See mln_acquired_frame_get_vulkan_texture in the C API reference.

Errors:

def release( self, consumer_completion: GpuSync) -> None:
356    def release(self, consumer_completion: GpuSync) -> None:
357        """Gives an acquired frame back to the session once you're done reading
358        it.
359
360        `consumer_completion` says when your GPU work that reads the texture
361        finishes. Pass `GpuSyncKind.CPU_COMPLETE` when that work has already
362        finished. The session waits for that point before it renders into the
363        texture again. If that wait fails, such as for an OpenGL fence
364        outside the session's share group, the session fails.
365
366        See `mln_acquired_frame_release` in the
367        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
368
369        Errors:
370
371        - `Status.UNSUPPORTED` when
372          `RenderSessionCapabilities.consumer_sync_kinds` lacks the kind of
373          `consumer_completion`.
374        """
375        return self._native.release(consumer_completion)

Gives an acquired frame back to the session once you're done reading it.

consumer_completion says when your GPU work that reads the texture finishes. Pass GpuSyncKind.CPU_COMPLETE when that work has already finished. The session waits for that point before it renders into the texture again. If that wait fails, such as for an OpenGL fence outside the session's share group, the session fails.

See mln_acquired_frame_release in the C API reference.

Errors:

id: int
43    @property
44    def id(self) -> int:
45        """The native handle value. It stays readable after release."""
46        return int(self._native.id)

The native handle value. It stays readable after release.

@dataclass(frozen=True, slots=True)
class AnchoredMomentum:
1094@dataclass(frozen=True, slots=True)
1095class AnchoredMomentum:
1096    """How a gesture's zoom, bearing, or pitch keeps changing after release.
1097
1098    See `mln_anchored_momentum` in the
1099    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1100    """
1101
1102    velocity: float | None = None
1103    """How fast the value changed at release: zoom levels per second for zoom,
1104    and degrees per second for bearing and pitch. The part moves only when
1105    this is set.
1106    """
1107
1108    anchor: ScreenPoint | None = None
1109    """The screen point that the change keeps in place. Without one, the change
1110    keeps the center of the view in place.
1111    """
1112
1113    decay: MomentumDecay = field(default_factory=lambda: MomentumDecay())
1114
1115    snap: MomentumSnap | None = None
1116    """Where the part settles. Without this, it stays where the gesture and its
1117    glide leave it.
1118    """
1119
1120    @classmethod
1121    def _from_native(cls, raw):
1122        return cls(
1123            velocity=raw["velocity"],
1124            anchor=_maybe(ScreenPoint._from_native, raw["anchor"]),
1125            decay=MomentumDecay._from_native(raw["decay"]),
1126            snap=_maybe(MomentumSnap._from_native, raw["snap"]),
1127        )

How a gesture's zoom, bearing, or pitch keeps changing after release.

See mln_anchored_momentum in the C API reference.

AnchoredMomentum( velocity: float | None = None, anchor: ScreenPoint | None = None, decay: MomentumDecay = <factory>, snap: MomentumSnap | None = None)
velocity: float | None

How fast the value changed at release: zoom levels per second for zoom, and degrees per second for bearing and pitch. The part moves only when this is set.

anchor: ScreenPoint | None

The screen point that the change keeps in place. Without one, the change keeps the center of the view in place.

decay: MomentumDecay
snap: MomentumSnap | None

Where the part settles. Without this, it stays where the gesture and its glide leave it.

@dataclass(frozen=True, slots=True)
class AndroidHardwareBufferFrame:
1130@dataclass(frozen=True, slots=True)
1131class AndroidHardwareBufferFrame:
1132    """The Android hardware buffer of an acquired frame.
1133
1134    See `mln_android_hardware_buffer_frame` in the
1135    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/android_8h.html).
1136    """
1137
1138    width: int
1139
1140    height: int
1141
1142    scale_factor: float
1143
1144    slot: int
1145    """The buffer's index in the ring."""
1146
1147    buffer: int
1148    """The `AHardwareBuffer*`."""
1149
1150    @classmethod
1151    def _from_native(cls, raw):
1152        return cls(
1153            width=raw["width"],
1154            height=raw["height"],
1155            scale_factor=raw["scale_factor"],
1156            slot=raw["slot"],
1157            buffer=raw["buffer"],
1158        )

The Android hardware buffer of an acquired frame.

See mln_android_hardware_buffer_frame in the C API reference.

AndroidHardwareBufferFrame(width: int, height: int, scale_factor: float, slot: int, buffer: int)
width: int
height: int
scale_factor: float
slot: int

The buffer's index in the ring.

buffer: int

The AHardwareBuffer*.

@dataclass(frozen=True, slots=True)
class AndroidHardwareBufferRingDescriptor:
1161@dataclass(frozen=True, slots=True)
1162class AndroidHardwareBufferRingDescriptor:
1163    """A ring of Android hardware buffers that the library allocates, for
1164    `MapHandle.attach_android_hardware_buffer_ring()`.
1165
1166    Each buffer has the map's size in pixels, `logical_size` times the map's
1167    scale factor, and the format AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM. Its
1168    usage is AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT,
1169    AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE, and the bits of `usage`.
1170
1171    See `mln_android_hardware_buffer_ring_descriptor` in the
1172    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/android_8h.html).
1173    """
1174
1175    logical_size: LogicalSize
1176
1177    buffer_count: int
1178    """How many buffers the ring has, from 1 to 8."""
1179
1180    usage: int = 0
1181    """More `AHARDWAREBUFFER_USAGE_*` bits that your reads need, such as
1182    AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN, or zero.
1183    """
1184
1185    @classmethod
1186    def _from_native(cls, raw):
1187        return cls(
1188            logical_size=LogicalSize._from_native(raw["logical_size"]),
1189            buffer_count=raw["buffer_count"],
1190            usage=raw["usage"],
1191        )

A ring of Android hardware buffers that the library allocates, for MapHandle.attach_android_hardware_buffer_ring().

Each buffer has the map's size in pixels, logical_size times the map's scale factor, and the format AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM. Its usage is AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT, AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE, and the bits of usage.

See mln_android_hardware_buffer_ring_descriptor in the C API reference.

AndroidHardwareBufferRingDescriptor( logical_size: LogicalSize, buffer_count: int, usage: int = 0)
logical_size: LogicalSize
buffer_count: int

How many buffers the ring has, from 1 to 8.

usage: int

More AHARDWAREBUFFER_USAGE_* bits that your reads need, such as AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN, or zero.

@dataclass(frozen=True, slots=True)
class AndroidSurfaceDescriptor:
1194@dataclass(frozen=True, slots=True)
1195class AndroidSurfaceDescriptor:
1196    """An Android window to present to, for
1197    `MapHandle.attach_android_surface()`.
1198
1199    Name the window by `window`, or by `jni_env` and `surface`. The session
1200    takes its own reference to the window, so you can release yours once the
1201    call returns.
1202
1203    See `mln_android_surface_descriptor` in the
1204    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/android_8h.html).
1205    """
1206
1207    logical_size: LogicalSize
1208
1209    window: int = 0
1210    """Your `ANativeWindow*`, or null to name the window by `surface`."""
1211
1212    jni_env: int = 0
1213    """The calling thread's `JNIEnv*`, with `surface`."""
1214
1215    surface: int = 0
1216    """An `android.view.Surface`, with `jni_env`."""
1217
1218    @classmethod
1219    def _from_native(cls, raw):
1220        return cls(
1221            logical_size=LogicalSize._from_native(raw["logical_size"]),
1222            window=raw["window"],
1223            jni_env=raw["jni_env"],
1224            surface=raw["surface"],
1225        )

An Android window to present to, for MapHandle.attach_android_surface().

Name the window by window, or by jni_env and surface. The session takes its own reference to the window, so you can release yours once the call returns.

See mln_android_surface_descriptor in the C API reference.

AndroidSurfaceDescriptor( logical_size: LogicalSize, window: int = 0, jni_env: int = 0, surface: int = 0)
logical_size: LogicalSize
window: int

Your ANativeWindow*, or null to name the window by surface.

jni_env: int

The calling thread's JNIEnv*, with surface.

surface: int

An android.view.Surface, with jni_env.

@dataclass(frozen=True, slots=True)
class AndroidSurfaceReplacement:
1228@dataclass(frozen=True, slots=True)
1229class AndroidSurfaceReplacement:
1230    """A new Android window for
1231    `RenderSessionHandle.set_android_surface_target()`.
1232
1233    Name the window by `window`, or by `jni_env` and `surface`. The session
1234    takes its own reference to the window, so you can release yours once the
1235    call returns.
1236
1237    See `mln_android_surface_replacement` in the
1238    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/android_8h.html).
1239    """
1240
1241    logical_size: LogicalSize
1242
1243    window: int = 0
1244    """Your `ANativeWindow*`, or null to name the window by `surface`."""
1245
1246    jni_env: int = 0
1247    """The calling thread's `JNIEnv*`, with `surface`."""
1248
1249    surface: int = 0
1250    """An `android.view.Surface`, with `jni_env`."""
1251
1252    @classmethod
1253    def _from_native(cls, raw):
1254        return cls(
1255            logical_size=LogicalSize._from_native(raw["logical_size"]),
1256            window=raw["window"],
1257            jni_env=raw["jni_env"],
1258            surface=raw["surface"],
1259        )

A new Android window for RenderSessionHandle.set_android_surface_target().

Name the window by window, or by jni_env and surface. The session takes its own reference to the window, so you can release yours once the call returns.

See mln_android_surface_replacement in the C API reference.

AndroidSurfaceReplacement( logical_size: LogicalSize, window: int = 0, jni_env: int = 0, surface: int = 0)
logical_size: LogicalSize
window: int

Your ANativeWindow*, or null to name the window by surface.

jni_env: int

The calling thread's JNIEnv*, with surface.

surface: int

An android.view.Surface, with jni_env.

@dataclass(frozen=True, slots=True)
class AnimationOptions:
1262@dataclass(frozen=True, slots=True)
1263class AnimationOptions:
1264    """How a camera change animates.
1265
1266    See `mln_animation_options` in the
1267    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1268    """
1269
1270    duration_ms: float | None = None
1271
1272    velocity: float | None = None
1273    """The average speed of a fly animation, in screens per second.
1274    `duration_ms` overrides it.
1275    """
1276
1277    min_zoom: float | None = None
1278    """The zoom level at the peak of a fly animation."""
1279
1280    easing: UnitBezier | None = None
1281
1282    transition_id: int | None = None
1283    """An ID that `MapHandle.cancel_camera_transitions_with_id()` cancels the
1284    change by. Several changes can share one.
1285    """
1286
1287    end_handler: CameraTransitionHandler = field(
1288        default_factory=lambda: CameraTransitionHandler()
1289    )
1290
1291    @classmethod
1292    def _from_native(cls, raw):
1293        return cls(
1294            duration_ms=raw["duration_ms"],
1295            velocity=raw["velocity"],
1296            min_zoom=raw["min_zoom"],
1297            easing=_maybe(UnitBezier._from_native, raw["easing"]),
1298            transition_id=raw["transition_id"],
1299            end_handler=CameraTransitionHandler(),
1300        )

How a camera change animates.

See mln_animation_options in the C API reference.

AnimationOptions( duration_ms: float | None = None, velocity: float | None = None, min_zoom: float | None = None, easing: UnitBezier | None = None, transition_id: int | None = None, end_handler: CameraTransitionHandler = <factory>)
duration_ms: float | None
velocity: float | None

The average speed of a fly animation, in screens per second. duration_ms overrides it.

min_zoom: float | None

The zoom level at the peak of a fly animation.

easing: UnitBezier | None
transition_id: int | None

An ID that MapHandle.cancel_camera_transitions_with_id() cancels the change by. Several changes can share one.

@dataclass(frozen=True, slots=True)
class BoundOptions:
1303@dataclass(frozen=True, slots=True)
1304class BoundOptions:
1305    """Limits on the camera, for `MapHandle.set_bounds()`.
1306
1307    See `mln_bound_options` in the
1308    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1309    """
1310
1311    bounds: LatLngBounds | None = None
1312    """The area that the camera's center stays within."""
1313
1314    min_zoom: float | None = None
1315
1316    max_zoom: float | None = None
1317
1318    min_pitch: float | None = None
1319    """The lowest pitch, in degrees."""
1320
1321    max_pitch: float | None = None
1322    """The highest pitch, in degrees."""
1323
1324    unbounded: bool = False
1325
1326    @classmethod
1327    def _from_native(cls, raw):
1328        return cls(
1329            bounds=_maybe(LatLngBounds._from_native, raw["bounds"]),
1330            min_zoom=raw["min_zoom"],
1331            max_zoom=raw["max_zoom"],
1332            min_pitch=raw["min_pitch"],
1333            max_pitch=raw["max_pitch"],
1334            unbounded=raw["unbounded"],
1335        )

Limits on the camera, for MapHandle.set_bounds().

See mln_bound_options in the C API reference.

BoundOptions( bounds: LatLngBounds | None = None, min_zoom: float | None = None, max_zoom: float | None = None, min_pitch: float | None = None, max_pitch: float | None = None, unbounded: bool = False)
bounds: LatLngBounds | None

The area that the camera's center stays within.

min_zoom: float | None
max_zoom: float | None
min_pitch: float | None

The lowest pitch, in degrees.

max_pitch: float | None

The highest pitch, in degrees.

unbounded: bool
class CacheDatabaseOperation(maplibre_native_ffi._enum.UnknownIntEnum):
287class CacheDatabaseOperation(UnknownIntEnum):
288    """A maintenance action on a runtime's cache database.
289
290    The cache database is the file that `RuntimeOptions.cache_path` names. It
291    holds the ambient cache, meaning the resources that maps loaded, and the
292    offline regions.
293
294    See `mln_cache_database_operation` in the
295    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
296    """
297
298    CLEAR = 1
299    INVALIDATE = 2
300    PACK = 3
301    RESET = 4

A maintenance action on a runtime's cache database.

The cache database is the file that RuntimeOptions.cache_path names. It holds the ambient cache, meaning the resources that maps loaded, and the offline regions.

See mln_cache_database_operation in the C API reference.

@dataclass(frozen=True, slots=True)
class Camera:
1338@dataclass(frozen=True, slots=True)
1339class Camera:
1340    """A map's whole camera.
1341
1342    See `mln_camera` in the
1343    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1344    """
1345
1346    center: LatLng = field(default_factory=lambda: LatLng())
1347
1348    center_altitude: float = 0.0
1349    """The altitude of the center, in meters above sea level."""
1350
1351    padding: EdgeInsets = field(default_factory=lambda: EdgeInsets())
1352    """Insets from the map's edges. The camera centers within the rest."""
1353
1354    zoom: float = 0.0
1355
1356    bearing: float = 0.0
1357    """The rotation from north, in degrees."""
1358
1359    pitch: float = 0.0
1360    """The tilt toward the horizon, in degrees. 0 looks straight down."""
1361
1362    roll: float = 0.0
1363    """The roll, in degrees."""
1364
1365    field_of_view: float = 0.0
1366    """The vertical field of view, in degrees."""
1367
1368    @classmethod
1369    def _from_native(cls, raw):
1370        return cls(
1371            center=LatLng._from_native(raw["center"]),
1372            center_altitude=raw["center_altitude"],
1373            padding=EdgeInsets._from_native(raw["padding"]),
1374            zoom=raw["zoom"],
1375            bearing=raw["bearing"],
1376            pitch=raw["pitch"],
1377            roll=raw["roll"],
1378            field_of_view=raw["field_of_view"],
1379        )
1380
1381    def to_options(self) -> CameraOptions:
1382        """Converts this `Camera` to `CameraOptions` that set each of its
1383        members.
1384        """
1385        return CameraOptions(
1386            center=self.center,
1387            center_altitude=self.center_altitude,
1388            padding=self.padding,
1389            zoom=self.zoom,
1390            bearing=self.bearing,
1391            pitch=self.pitch,
1392            roll=self.roll,
1393            field_of_view=self.field_of_view,
1394        )

A map's whole camera.

See mln_camera in the C API reference.

Camera( center: LatLng = <factory>, center_altitude: float = 0.0, padding: EdgeInsets = <factory>, zoom: float = 0.0, bearing: float = 0.0, pitch: float = 0.0, roll: float = 0.0, field_of_view: float = 0.0)
center: LatLng
center_altitude: float

The altitude of the center, in meters above sea level.

padding: EdgeInsets

Insets from the map's edges. The camera centers within the rest.

zoom: float
bearing: float

The rotation from north, in degrees.

pitch: float

The tilt toward the horizon, in degrees. 0 looks straight down.

roll: float

The roll, in degrees.

field_of_view: float

The vertical field of view, in degrees.

def to_options(self) -> CameraOptions:
1381    def to_options(self) -> CameraOptions:
1382        """Converts this `Camera` to `CameraOptions` that set each of its
1383        members.
1384        """
1385        return CameraOptions(
1386            center=self.center,
1387            center_altitude=self.center_altitude,
1388            padding=self.padding,
1389            zoom=self.zoom,
1390            bearing=self.bearing,
1391            pitch=self.pitch,
1392            roll=self.roll,
1393            field_of_view=self.field_of_view,
1394        )

Converts this Camera to CameraOptions that set each of its members.

@dataclass(frozen=True, slots=True)
class CameraBounds:
1397@dataclass(frozen=True, slots=True)
1398class CameraBounds:
1399    """All the limits on a map's camera.
1400
1401    Its members mean the same as those of `BoundOptions`.
1402
1403    See `mln_camera_bounds` in the
1404    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1405    """
1406
1407    bounds: LatLngBounds
1408    """The area that the camera's center stays within. When `unbounded` is true,
1409    it covers the whole world.
1410    """
1411
1412    unbounded: bool
1413    """Whether no area limits the camera's center."""
1414
1415    min_zoom: float
1416
1417    max_zoom: float
1418
1419    min_pitch: float
1420    """The lowest pitch, in degrees."""
1421
1422    max_pitch: float
1423    """The highest pitch, in degrees."""
1424
1425    @classmethod
1426    def _from_native(cls, raw):
1427        return cls(
1428            bounds=LatLngBounds._from_native(raw["bounds"]),
1429            unbounded=raw["unbounded"],
1430            min_zoom=raw["min_zoom"],
1431            max_zoom=raw["max_zoom"],
1432            min_pitch=raw["min_pitch"],
1433            max_pitch=raw["max_pitch"],
1434        )

All the limits on a map's camera.

Its members mean the same as those of BoundOptions.

See mln_camera_bounds in the C API reference.

CameraBounds( bounds: LatLngBounds, unbounded: bool, min_zoom: float, max_zoom: float, min_pitch: float, max_pitch: float)
bounds: LatLngBounds

The area that the camera's center stays within. When unbounded is true, it covers the whole world.

unbounded: bool

Whether no area limits the camera's center.

min_zoom: float
max_zoom: float
min_pitch: float

The lowest pitch, in degrees.

max_pitch: float

The highest pitch, in degrees.

class CameraChangeMode(maplibre_native_ffi._enum.UnknownIntEnum):
304class CameraChangeMode(UnknownIntEnum):
305    """Whether a camera change jumps or animates.
306
307    See `mln_camera_change_mode` in the
308    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
309    """
310
311    IMMEDIATE = 0
312    ANIMATED = 1

Whether a camera change jumps or animates.

See mln_camera_change_mode in the C API reference.

IMMEDIATE = <CameraChangeMode.IMMEDIATE: 0>
ANIMATED = <CameraChangeMode.ANIMATED: 1>
class CameraChangeSource(maplibre_native_ffi._enum.UnknownIntEnum):
315class CameraChangeSource(UnknownIntEnum):
316    """What moved the camera.
317
318    See `mln_camera_change_source` in the
319    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
320    """
321
322    COMMAND = 0
323    GESTURE = 1
324    MOMENTUM = 2

What moved the camera.

See mln_camera_change_source in the C API reference.

MOMENTUM = <CameraChangeSource.MOMENTUM: 2>
@dataclass(frozen=True, slots=True)
class CameraDelta:
1437@dataclass(frozen=True, slots=True)
1438class CameraDelta:
1439    """A change to the camera from where it is now, for gestures.
1440
1441    See `mln_camera_delta` in the
1442    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1443    """
1444
1445    offset: ScreenPoint | None = None
1446    """Moves the map's content this far on the screen, as a drag does."""
1447
1448    scale: float | None = None
1449    """Multiplies the map's scale. 2 zooms in by one level."""
1450
1451    bearing: float | None = None
1452    """Degrees to add to the bearing."""
1453
1454    pitch: float | None = None
1455    """Degrees to add to the pitch."""
1456
1457    anchor: ScreenPoint | None = None
1458    """The screen point that `scale`, `bearing`, and `pitch` keep in place. It
1459    needs one of them, and it combines with `offset` only in a delta without
1460    a duration.
1461    """
1462
1463    momentum: GestureMomentum | None = None
1464    """How the gesture keeps moving after this delta. Only a delta in the
1465    `GesturePhase.END` phase carries it.
1466    """
1467
1468    animation: AnimationOptions = field(default_factory=lambda: AnimationOptions())
1469
1470    gesture_phase: GesturePhase = GesturePhase.NONE
1471
1472    @classmethod
1473    def _from_native(cls, raw):
1474        return cls(
1475            offset=_maybe(ScreenPoint._from_native, raw["offset"]),
1476            scale=raw["scale"],
1477            bearing=raw["bearing"],
1478            pitch=raw["pitch"],
1479            anchor=_maybe(ScreenPoint._from_native, raw["anchor"]),
1480            momentum=_maybe(GestureMomentum._from_native, raw["momentum"]),
1481            animation=AnimationOptions._from_native(raw["animation"]),
1482            gesture_phase=GesturePhase(raw["gesture_phase"]),
1483        )

A change to the camera from where it is now, for gestures.

See mln_camera_delta in the C API reference.

CameraDelta( offset: ScreenPoint | None = None, scale: float | None = None, bearing: float | None = None, pitch: float | None = None, anchor: ScreenPoint | None = None, momentum: GestureMomentum | None = None, animation: AnimationOptions = <factory>, gesture_phase: GesturePhase = <GesturePhase.NONE: 0>)
offset: ScreenPoint | None

Moves the map's content this far on the screen, as a drag does.

scale: float | None

Multiplies the map's scale. 2 zooms in by one level.

bearing: float | None

Degrees to add to the bearing.

pitch: float | None

Degrees to add to the pitch.

anchor: ScreenPoint | None

The screen point that scale, bearing, and pitch keep in place. It needs one of them, and it combines with offset only in a delta without a duration.

momentum: GestureMomentum | None

How the gesture keeps moving after this delta. Only a delta in the GesturePhase.END phase carries it.

animation: AnimationOptions
gesture_phase: GesturePhase
@dataclass(frozen=True, slots=True)
class CameraFitOptions:
1486@dataclass(frozen=True, slots=True)
1487class CameraFitOptions:
1488    """Options for finding the camera that fits an area.
1489
1490    See `mln_camera_fit_options` in the
1491    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1492    """
1493
1494    padding: EdgeInsets | None = None
1495    """Space to leave between the area and each edge of the map. The left and
1496    right insets must add up to less than the map's width, and the top and
1497    bottom to less than its height.
1498    """
1499
1500    bearing: float | None = None
1501    """The rotation from north, in degrees."""
1502
1503    pitch: float | None = None
1504    """The tilt toward the horizon, in degrees."""
1505
1506    @classmethod
1507    def _from_native(cls, raw):
1508        return cls(
1509            padding=_maybe(EdgeInsets._from_native, raw["padding"]),
1510            bearing=raw["bearing"],
1511            pitch=raw["pitch"],
1512        )

Options for finding the camera that fits an area.

See mln_camera_fit_options in the C API reference.

CameraFitOptions( padding: EdgeInsets | None = None, bearing: float | None = None, pitch: float | None = None)
padding: EdgeInsets | None

Space to leave between the area and each edge of the map. The left and right insets must add up to less than the map's width, and the top and bottom to less than its height.

bearing: float | None

The rotation from north, in degrees.

pitch: float | None

The tilt toward the horizon, in degrees.

@dataclass(frozen=True, slots=True)
class CameraFitUpdate:
1515@dataclass(frozen=True, slots=True)
1516class CameraFitUpdate:
1517    """A camera change that fits an area, for
1518    `MapHandle.fit_camera_to_lat_lng_bounds()` and the other fit commands.
1519
1520    A jump uses only the end handler of `animation`, as in `CameraUpdate`.
1521
1522    See `mln_camera_fit_update` in the
1523    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1524    """
1525
1526    mode: CameraUpdateMode = CameraUpdateMode.JUMP
1527
1528    fit: CameraFitOptions = field(default_factory=lambda: CameraFitOptions())
1529
1530    animation: AnimationOptions = field(default_factory=lambda: AnimationOptions())
1531
1532    @classmethod
1533    def _from_native(cls, raw):
1534        return cls(
1535            mode=CameraUpdateMode(raw["mode"]),
1536            fit=CameraFitOptions._from_native(raw["fit"]),
1537            animation=AnimationOptions._from_native(raw["animation"]),
1538        )

A camera change that fits an area, for MapHandle.fit_camera_to_lat_lng_bounds() and the other fit commands.

A jump uses only the end handler of animation, as in CameraUpdate.

See mln_camera_fit_update in the C API reference.

CameraFitUpdate( mode: CameraUpdateMode = <CameraUpdateMode.JUMP: 0>, fit: CameraFitOptions = <factory>, animation: AnimationOptions = <factory>)
animation: AnimationOptions
@dataclass(frozen=True, slots=True)
class CameraOptions:
1541@dataclass(frozen=True, slots=True)
1542class CameraOptions:
1543    """A camera, with only the members that `fields` selects.
1544
1545    See `mln_camera_options` in the
1546    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1547    """
1548
1549    center: LatLng | None = None
1550
1551    center_altitude: float | None = None
1552    """The altitude of the center, in meters above sea level."""
1553
1554    padding: EdgeInsets | None = None
1555    """Insets from the map's edges. The camera centers within the rest."""
1556
1557    anchor: ScreenPoint | None = None
1558    """The screen point that a change to the zoom, bearing, or pitch keeps in
1559    place. A `center` overrides it.
1560    """
1561
1562    zoom: float | None = None
1563
1564    bearing: float | None = None
1565    """The rotation from north, in degrees."""
1566
1567    pitch: float | None = None
1568    """The tilt toward the horizon, in degrees. 0 looks straight down."""
1569
1570    roll: float | None = None
1571    """The roll, in degrees."""
1572
1573    field_of_view: float | None = None
1574    """The vertical field of view, in degrees."""
1575
1576    @classmethod
1577    def _from_native(cls, raw):
1578        return cls(
1579            center=_maybe(LatLng._from_native, raw["center"]),
1580            center_altitude=raw["center_altitude"],
1581            padding=_maybe(EdgeInsets._from_native, raw["padding"]),
1582            anchor=_maybe(ScreenPoint._from_native, raw["anchor"]),
1583            zoom=raw["zoom"],
1584            bearing=raw["bearing"],
1585            pitch=raw["pitch"],
1586            roll=raw["roll"],
1587            field_of_view=raw["field_of_view"],
1588        )

A camera, with only the members that fields selects.

See mln_camera_options in the C API reference.

CameraOptions( center: LatLng | None = None, center_altitude: float | None = None, padding: EdgeInsets | None = None, anchor: ScreenPoint | None = None, zoom: float | None = None, bearing: float | None = None, pitch: float | None = None, roll: float | None = None, field_of_view: float | None = None)
center: LatLng | None
center_altitude: float | None

The altitude of the center, in meters above sea level.

padding: EdgeInsets | None

Insets from the map's edges. The camera centers within the rest.

anchor: ScreenPoint | None

The screen point that a change to the zoom, bearing, or pitch keeps in place. A center overrides it.

zoom: float | None
bearing: float | None

The rotation from north, in degrees.

pitch: float | None

The tilt toward the horizon, in degrees. 0 looks straight down.

roll: float | None

The roll, in degrees.

field_of_view: float | None

The vertical field of view, in degrees.

@dataclass(frozen=True, slots=True)
class CameraQueryResult:
1591@dataclass(frozen=True, slots=True)
1592class CameraQueryResult:
1593    """A map's camera, with the snapshot generation that it matches.
1594
1595    See `mln_camera_query_result` in the
1596    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1597    """
1598
1599    generation: int
1600
1601    camera: Camera
1602
1603    @classmethod
1604    def _from_native(cls, raw):
1605        return cls(
1606            generation=raw["generation"], camera=Camera._from_native(raw["camera"])
1607        )

A map's camera, with the snapshot generation that it matches.

See mln_camera_query_result in the C API reference.

CameraQueryResult( generation: int, camera: Camera)
generation: int
camera: Camera
@dataclass(frozen=True, slots=True)
class CameraTransitionEnd:
1610@dataclass(frozen=True, slots=True)
1611class CameraTransitionEnd:
1612    """The end of a camera change.
1613
1614    See `mln_camera_transition_end` in the
1615    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1616    """
1617
1618    outcome: CameraTransitionOutcome
1619
1620    generation: int
1621    """The generation of the first map snapshot that shows where the change left
1622    the camera, or 0 when the map closed first.
1623    """
1624
1625    velocity: CameraVelocity
1626    """How fast a gesture's momentum still moved when it was cancelled, which
1627    the next gesture can add to its own release velocities. Zero for every
1628    other end.
1629    """
1630
1631    @classmethod
1632    def _from_native(cls, raw):
1633        return cls(
1634            outcome=CameraTransitionOutcome(raw["outcome"]),
1635            generation=raw["generation"],
1636            velocity=CameraVelocity._from_native(raw["velocity"]),
1637        )

The end of a camera change.

See mln_camera_transition_end in the C API reference.

CameraTransitionEnd( outcome: CameraTransitionOutcome, generation: int, velocity: CameraVelocity)
generation: int

The generation of the first map snapshot that shows where the change left the camera, or 0 when the map closed first.

velocity: CameraVelocity

How fast a gesture's momentum still moved when it was cancelled, which the next gesture can add to its own release velocities. Zero for every other end.

class CameraTransitionEndCallback(typing.Protocol):
5863class CameraTransitionEndCallback(Protocol):
5864    """Receives the end of a camera change.
5865
5866    See `mln_camera_transition_end_callback` in the
5867    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
5868    """
5869
5870    def __call__(self, end: CameraTransitionEnd, /) -> None: ...

Receives the end of a camera change.

See mln_camera_transition_end_callback in the C API reference.

CameraTransitionEndCallback(*args, **kwargs)
1903def _no_init_or_replace_init(self, *args, **kwargs):
1904    cls = type(self)
1905
1906    if cls._is_protocol:
1907        raise TypeError('Protocols cannot be instantiated')
1908
1909    # Already using a custom `__init__`. No need to calculate correct
1910    # `__init__` to call. This can lead to RecursionError. See bpo-45121.
1911    if cls.__init__ is not _no_init_or_replace_init:
1912        return
1913
1914    # Initially, `__init__` of a protocol subclass is set to `_no_init_or_replace_init`.
1915    # The first instantiation of the subclass will call `_no_init_or_replace_init` which
1916    # searches for a proper new `__init__` in the MRO. The new `__init__`
1917    # replaces the subclass' old `__init__` (ie `_no_init_or_replace_init`). Subsequent
1918    # instantiation of the protocol subclass will thus use the new
1919    # `__init__` and no longer call `_no_init_or_replace_init`.
1920    for base in cls.__mro__:
1921        init = base.__dict__.get('__init__', _no_init_or_replace_init)
1922        if init is not _no_init_or_replace_init:
1923            cls.__init__ = init
1924            break
1925    else:
1926        # should not happen
1927        cls.__init__ = object.__init__
1928
1929    cls.__init__(self, *args, **kwargs)
@dataclass(frozen=True, slots=True)
class CameraTransitionHandler:
1640@dataclass(frozen=True, slots=True)
1641class CameraTransitionHandler:
1642    """A callback for the end of a camera change, for `AnimationOptions`.
1643
1644    The callback runs once for each camera command, after every part of the
1645    change that the command started has ended.
1646
1647    See `mln_camera_transition_handler` in the
1648    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1649    """
1650
1651    callback: CameraTransitionEndCallback | None = None
1652
1653    def _invoke_callback(self, end):
1654        callback = self.callback
1655        assert callback is not None
1656        return callback(CameraTransitionEnd._from_native(end))

A callback for the end of a camera change, for AnimationOptions.

The callback runs once for each camera command, after every part of the change that the command started has ended.

See mln_camera_transition_handler in the C API reference.

CameraTransitionHandler( callback: CameraTransitionEndCallback | None = None)
callback: CameraTransitionEndCallback | None
class CameraTransitionOutcome(maplibre_native_ffi._enum.UnknownIntEnum):
327class CameraTransitionOutcome(UnknownIntEnum):
328    """How a camera change ended.
329
330    A change that ends in more than one way reports
331    `CameraTransitionOutcome.CANCELLED` if any of it was cancelled, and
332    otherwise `CameraTransitionOutcome.REPLACED` if any of it was replaced.
333
334    See `mln_camera_transition_outcome` in the
335    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
336    """
337
338    COMPLETED = 0
339    CANCELLED = 1
340    CLOSED = 2
341    REPLACED = 3

How a camera change ended.

A change that ends in more than one way reports CameraTransitionOutcome.CANCELLED if any of it was cancelled, and otherwise CameraTransitionOutcome.REPLACED if any of it was replaced.

See mln_camera_transition_outcome in the C API reference.

@dataclass(frozen=True, slots=True)
class CameraUpdate:
1659@dataclass(frozen=True, slots=True)
1660class CameraUpdate:
1661    """A camera change for `MapHandle.update_camera()`.
1662
1663    A jump uses only the end handler of `animation`, and the handler runs as
1664    soon as the camera moves.
1665
1666    See `mln_camera_update` in the
1667    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1668    """
1669
1670    mode: CameraUpdateMode = CameraUpdateMode.JUMP
1671
1672    camera: CameraOptions = field(default_factory=lambda: CameraOptions())
1673
1674    animation: AnimationOptions = field(default_factory=lambda: AnimationOptions())
1675
1676    gesture_phase: GesturePhase = GesturePhase.NONE
1677
1678    @classmethod
1679    def _from_native(cls, raw):
1680        return cls(
1681            mode=CameraUpdateMode(raw["mode"]),
1682            camera=CameraOptions._from_native(raw["camera"]),
1683            animation=AnimationOptions._from_native(raw["animation"]),
1684            gesture_phase=GesturePhase(raw["gesture_phase"]),
1685        )

A camera change for MapHandle.update_camera().

A jump uses only the end handler of animation, and the handler runs as soon as the camera moves.

See mln_camera_update in the C API reference.

CameraUpdate( mode: CameraUpdateMode = <CameraUpdateMode.JUMP: 0>, camera: CameraOptions = <factory>, animation: AnimationOptions = <factory>, gesture_phase: GesturePhase = <GesturePhase.NONE: 0>)
camera: CameraOptions
animation: AnimationOptions
gesture_phase: GesturePhase
class CameraUpdateMode(maplibre_native_ffi._enum.UnknownIntEnum):
344class CameraUpdateMode(UnknownIntEnum):
345    """How a camera command moves the camera.
346
347    See `mln_camera_update_mode` in the
348    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
349    """
350
351    JUMP = 0
352    EASE = 1
353    FLY = 2

How a camera command moves the camera.

See mln_camera_update_mode in the C API reference.

JUMP = <CameraUpdateMode.JUMP: 0>
EASE = <CameraUpdateMode.EASE: 1>
@dataclass(frozen=True, slots=True)
class CameraVelocity:
1688@dataclass(frozen=True, slots=True)
1689class CameraVelocity:
1690    """How fast each part of a camera change moves.
1691
1692    See `mln_camera_velocity` in the
1693    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1694    """
1695
1696    pan: ScreenPoint
1697    """How fast the map's content moves on the screen, in logical pixels per
1698    second.
1699    """
1700
1701    zoom: float
1702    """In zoom levels per second."""
1703
1704    bearing: float
1705    """In degrees per second."""
1706
1707    pitch: float
1708    """In degrees per second."""
1709
1710    @classmethod
1711    def _from_native(cls, raw):
1712        return cls(
1713            pan=ScreenPoint._from_native(raw["pan"]),
1714            zoom=raw["zoom"],
1715            bearing=raw["bearing"],
1716            pitch=raw["pitch"],
1717        )

How fast each part of a camera change moves.

See mln_camera_velocity in the C API reference.

CameraVelocity( pan: ScreenPoint, zoom: float, bearing: float, pitch: float)

How fast the map's content moves on the screen, in logical pixels per second.

zoom: float

In zoom levels per second.

bearing: float

In degrees per second.

pitch: float

In degrees per second.

@dataclass(frozen=True, slots=True)
class CanonicalTileId:
1720@dataclass(frozen=True, slots=True)
1721class CanonicalTileId:
1722    """A tile's zoom level `z`, column `x`, and row `y`, with row 0 at the
1723    north.
1724
1725    See `mln_canonical_tile_id` in the
1726    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1727    """
1728
1729    z: int = 0
1730
1731    x: int = 0
1732
1733    y: int = 0
1734
1735    @classmethod
1736    def _from_native(cls, raw):
1737        return cls(z=raw["z"], x=raw["x"], y=raw["y"])

A tile's zoom level z, column x, and row y, with row 0 at the north.

See mln_canonical_tile_id in the C API reference.

CanonicalTileId(z: int = 0, x: int = 0, y: int = 0)
z: int
x: int
y: int
class ConstrainMode(maplibre_native_ffi._enum.UnknownIntEnum):
356class ConstrainMode(UnknownIntEnum):
357    """How the map keeps the camera within the world or within its bounds.
358
359    See `mln_constrain_mode` in the
360    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
361    """
362
363    NONE = 0
364    HEIGHT_ONLY = 1
365    WIDTH_AND_HEIGHT = 2
366    SCREEN = 3

How the map keeps the camera within the world or within its bounds.

See mln_constrain_mode in the C API reference.

NONE = <ConstrainMode.NONE: 0>
HEIGHT_ONLY = <ConstrainMode.HEIGHT_ONLY: 1>
WIDTH_AND_HEIGHT = <ConstrainMode.WIDTH_AND_HEIGHT: 2>
SCREEN = <ConstrainMode.SCREEN: 3>
@dataclass(frozen=True, slots=True)
class CustomGeometrySourceOptions:
1740@dataclass(frozen=True, slots=True)
1741class CustomGeometrySourceOptions:
1742    """The callbacks and options of a custom geometry source.
1743
1744    Zoom levels are whole numbers from 0 to 32.
1745
1746    See `mln_custom_geometry_source_options` in the
1747    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1748    """
1749
1750    fetch_tile: CustomSourceFetchTileCallback
1751    cancel_tile: CustomSourceCancelTileCallback | None = None
1752    min_zoom: float | None = None
1753
1754    max_zoom: float | None = None
1755
1756    tolerance: float | None = None
1757    """How far, in pixels, simplified geometry can stray from the original."""
1758
1759    tile_size: int | None = None
1760    """The width of a tile in pixels, a power of two no larger than 8192."""
1761
1762    buffer: int | None = None
1763    """The width in pixels of the margin around a tile that holds geometry from
1764    beyond its edges. `buffer` times 8192 / `tile_size` must be at most
1765    65535.
1766    """
1767
1768    clip: bool | None = None
1769    """Whether to cut geometry at the outer edge of a tile's margin."""
1770
1771    wrap: bool | None = None
1772    """Whether to wrap geometry that crosses the antimeridian."""
1773
1774    def _invoke_fetch_tile(self, map, source_id, tile_id):
1775        callback = self.fetch_tile
1776        map = _adopt_value(map, "MapHandle")
1777        return callback(map, source_id, CanonicalTileId._from_native(tile_id))
1778
1779    def _invoke_cancel_tile(self, map, source_id, tile_id):
1780        callback = self.cancel_tile
1781        assert callback is not None
1782        map = _adopt_value(map, "MapHandle")
1783        return callback(map, source_id, CanonicalTileId._from_native(tile_id))

The callbacks and options of a custom geometry source.

Zoom levels are whole numbers from 0 to 32.

See mln_custom_geometry_source_options in the C API reference.

CustomGeometrySourceOptions( fetch_tile: CustomSourceFetchTileCallback, cancel_tile: CustomSourceCancelTileCallback | None = None, min_zoom: float | None = None, max_zoom: float | None = None, tolerance: float | None = None, tile_size: int | None = None, buffer: int | None = None, clip: bool | None = None, wrap: bool | None = None)
cancel_tile: CustomSourceCancelTileCallback | None
min_zoom: float | None
max_zoom: float | None
tolerance: float | None

How far, in pixels, simplified geometry can stray from the original.

tile_size: int | None

The width of a tile in pixels, a power of two no larger than 8192.

buffer: int | None

The width in pixels of the margin around a tile that holds geometry from beyond its edges. buffer times 8192 / tile_size must be at most 65535.

clip: bool | None

Whether to cut geometry at the outer edge of a tile's margin.

wrap: bool | None

Whether to wrap geometry that crosses the antimeridian.

class CustomSourceCancelTileCallback(typing.Protocol):
5873class CustomSourceCancelTileCallback(Protocol):
5874    """Reports that a custom source no longer needs a tile.
5875
5876    `map` and `source_id` name the source.
5877
5878    See `mln_custom_source_cancel_tile_callback` in the
5879    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
5880    """
5881
5882    def __call__(
5883        self, map: MapHandle, source_id: str, tile_id: CanonicalTileId, /
5884    ) -> None: ...

Reports that a custom source no longer needs a tile.

map and source_id name the source.

See mln_custom_source_cancel_tile_callback in the C API reference.

CustomSourceCancelTileCallback(*args, **kwargs)
1903def _no_init_or_replace_init(self, *args, **kwargs):
1904    cls = type(self)
1905
1906    if cls._is_protocol:
1907        raise TypeError('Protocols cannot be instantiated')
1908
1909    # Already using a custom `__init__`. No need to calculate correct
1910    # `__init__` to call. This can lead to RecursionError. See bpo-45121.
1911    if cls.__init__ is not _no_init_or_replace_init:
1912        return
1913
1914    # Initially, `__init__` of a protocol subclass is set to `_no_init_or_replace_init`.
1915    # The first instantiation of the subclass will call `_no_init_or_replace_init` which
1916    # searches for a proper new `__init__` in the MRO. The new `__init__`
1917    # replaces the subclass' old `__init__` (ie `_no_init_or_replace_init`). Subsequent
1918    # instantiation of the protocol subclass will thus use the new
1919    # `__init__` and no longer call `_no_init_or_replace_init`.
1920    for base in cls.__mro__:
1921        init = base.__dict__.get('__init__', _no_init_or_replace_init)
1922        if init is not _no_init_or_replace_init:
1923            cls.__init__ = init
1924            break
1925    else:
1926        # should not happen
1927        cls.__init__ = object.__init__
1928
1929    cls.__init__(self, *args, **kwargs)
class CustomSourceFetchTileCallback(typing.Protocol):
5887class CustomSourceFetchTileCallback(Protocol):
5888    """Asks for the data of a tile in a custom source.
5889
5890    `map` and `source_id` name the source that asks. Return quickly. Once the
5891    data is ready, pass it to
5892    `MapHandle.set_custom_geometry_source_tile_data()` or
5893    `MapHandle.set_custom_vector_source_tile_data()`. If it fails to load,
5894    report that with `MapHandle.set_custom_geometry_source_tile_error()` or
5895    `MapHandle.set_custom_vector_source_tile_error()`.
5896
5897    See `mln_custom_source_fetch_tile_callback` in the
5898    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
5899    """
5900
5901    def __call__(
5902        self, map: MapHandle, source_id: str, tile_id: CanonicalTileId, /
5903    ) -> None: ...

Asks for the data of a tile in a custom source.

map and source_id name the source that asks. Return quickly. Once the data is ready, pass it to MapHandle.set_custom_geometry_source_tile_data() or MapHandle.set_custom_vector_source_tile_data(). If it fails to load, report that with MapHandle.set_custom_geometry_source_tile_error() or MapHandle.set_custom_vector_source_tile_error().

See mln_custom_source_fetch_tile_callback in the C API reference.

CustomSourceFetchTileCallback(*args, **kwargs)
1903def _no_init_or_replace_init(self, *args, **kwargs):
1904    cls = type(self)
1905
1906    if cls._is_protocol:
1907        raise TypeError('Protocols cannot be instantiated')
1908
1909    # Already using a custom `__init__`. No need to calculate correct
1910    # `__init__` to call. This can lead to RecursionError. See bpo-45121.
1911    if cls.__init__ is not _no_init_or_replace_init:
1912        return
1913
1914    # Initially, `__init__` of a protocol subclass is set to `_no_init_or_replace_init`.
1915    # The first instantiation of the subclass will call `_no_init_or_replace_init` which
1916    # searches for a proper new `__init__` in the MRO. The new `__init__`
1917    # replaces the subclass' old `__init__` (ie `_no_init_or_replace_init`). Subsequent
1918    # instantiation of the protocol subclass will thus use the new
1919    # `__init__` and no longer call `_no_init_or_replace_init`.
1920    for base in cls.__mro__:
1921        init = base.__dict__.get('__init__', _no_init_or_replace_init)
1922        if init is not _no_init_or_replace_init:
1923            cls.__init__ = init
1924            break
1925    else:
1926        # should not happen
1927        cls.__init__ = object.__init__
1928
1929    cls.__init__(self, *args, **kwargs)
@dataclass(frozen=True, slots=True)
class CustomVectorSourceOptions:
1786@dataclass(frozen=True, slots=True)
1787class CustomVectorSourceOptions:
1788    """The callbacks and options of a custom vector source.
1789
1790    Zoom levels are whole numbers from 0 to 32.
1791
1792    See `mln_custom_vector_source_options` in the
1793    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1794    """
1795
1796    fetch_tile: CustomSourceFetchTileCallback
1797    cancel_tile: CustomSourceCancelTileCallback | None = None
1798    min_zoom: float | None = None
1799
1800    max_zoom: float | None = None
1801
1802    def _invoke_fetch_tile(self, map, source_id, tile_id):
1803        callback = self.fetch_tile
1804        map = _adopt_value(map, "MapHandle")
1805        return callback(map, source_id, CanonicalTileId._from_native(tile_id))
1806
1807    def _invoke_cancel_tile(self, map, source_id, tile_id):
1808        callback = self.cancel_tile
1809        assert callback is not None
1810        map = _adopt_value(map, "MapHandle")
1811        return callback(map, source_id, CanonicalTileId._from_native(tile_id))

The callbacks and options of a custom vector source.

Zoom levels are whole numbers from 0 to 32.

See mln_custom_vector_source_options in the C API reference.

CustomVectorSourceOptions( fetch_tile: CustomSourceFetchTileCallback, cancel_tile: CustomSourceCancelTileCallback | None = None, min_zoom: float | None = None, max_zoom: float | None = None)
cancel_tile: CustomSourceCancelTileCallback | None
min_zoom: float | None
max_zoom: float | None
@dataclass(frozen=True, slots=True)
class DmaBufFormat:
1814@dataclass(frozen=True, slots=True)
1815class DmaBufFormat:
1816    """A DRM format and modifier that you can import.
1817
1818    See `mln_dma_buf_format` in the
1819    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/linux_8h.html).
1820    """
1821
1822    fourcc: int = 0
1823    """A DRM fourcc code, such as DRM_FORMAT_ABGR8888."""
1824
1825    modifier: int = 0
1826    """A DRM format modifier, such as DRM_FORMAT_MOD_LINEAR."""
1827
1828    @classmethod
1829    def _from_native(cls, raw):
1830        return cls(fourcc=raw["fourcc"], modifier=raw["modifier"])

A DRM format and modifier that you can import.

See mln_dma_buf_format in the C API reference.

DmaBufFormat(fourcc: int = 0, modifier: int = 0)
fourcc: int

A DRM fourcc code, such as DRM_FORMAT_ABGR8888.

modifier: int

A DRM format modifier, such as DRM_FORMAT_MOD_LINEAR.

@dataclass(frozen=True, slots=True)
class DmaBufFrame:
1833@dataclass(frozen=True, slots=True)
1834class DmaBufFrame:
1835    """The dmabuf of an acquired frame.
1836
1837    See `mln_dma_buf_frame` in the
1838    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/linux_8h.html).
1839    """
1840
1841    width: int
1842
1843    height: int
1844
1845    scale_factor: float
1846
1847    slot: int
1848    """The buffer's index in the ring."""
1849
1850    fourcc: int
1851
1852    modifier: int
1853
1854    planes: tuple[DmaBufPlane, ...]
1855    """The buffer's planes, in the order that its fourcc and modifier define.
1856    Import all of them, as EGL_EXT_image_dma_buf_import_modifiers planes 0
1857    and up, or with one `zwp_linux_buffer_params_v1.add` call each.
1858    """
1859
1860    @classmethod
1861    def _from_native(cls, raw):
1862        return cls(
1863            width=raw["width"],
1864            height=raw["height"],
1865            scale_factor=raw["scale_factor"],
1866            slot=raw["slot"],
1867            fourcc=raw["fourcc"],
1868            modifier=raw["modifier"],
1869            planes=tuple(DmaBufPlane._from_native(item) for item in raw["planes"]),
1870        )

The dmabuf of an acquired frame.

See mln_dma_buf_frame in the C API reference.

DmaBufFrame( width: int, height: int, scale_factor: float, slot: int, fourcc: int, modifier: int, planes: tuple[DmaBufPlane, ...])
width: int
height: int
scale_factor: float
slot: int

The buffer's index in the ring.

fourcc: int
modifier: int
planes: tuple[DmaBufPlane, ...]

The buffer's planes, in the order that its fourcc and modifier define. Import all of them, as EGL_EXT_image_dma_buf_import_modifiers planes 0 and up, or with one zwp_linux_buffer_params_v1.add call each.

@dataclass(frozen=True, slots=True)
class DmaBufPlane:
1873@dataclass(frozen=True, slots=True)
1874class DmaBufPlane:
1875    """Where one plane of a dmabuf keeps its data.
1876
1877    See `mln_dma_buf_plane` in the
1878    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/linux_8h.html).
1879    """
1880
1881    fd: int
1882    """The file descriptor of the dmabuf that holds the plane. The planes of a
1883    buffer often share one.
1884    """
1885
1886    offset: int
1887    """The bytes from the start of the dmabuf to the plane's first byte."""
1888
1889    stride: int
1890    """The bytes from the start of one row to the start of the next."""
1891
1892    @classmethod
1893    def _from_native(cls, raw):
1894        return cls(fd=raw["fd"], offset=raw["offset"], stride=raw["stride"])

Where one plane of a dmabuf keeps its data.

See mln_dma_buf_plane in the C API reference.

DmaBufPlane(fd: int, offset: int, stride: int)
fd: int

The file descriptor of the dmabuf that holds the plane. The planes of a buffer often share one.

offset: int

The bytes from the start of the dmabuf to the plane's first byte.

stride: int

The bytes from the start of one row to the start of the next.

@dataclass(frozen=True, slots=True)
class DmaBufRingDescriptor:
1897@dataclass(frozen=True, slots=True)
1898class DmaBufRingDescriptor:
1899    """A ring of dmabufs that the library allocates, for
1900    `MapHandle.attach_dma_buf_ring()`.
1901
1902    Each buffer has the map's size in pixels and a format and modifier from
1903    `formats`. The library renders only DRM_FORMAT_ABGR8888 and
1904    DRM_FORMAT_ARGB8888. A modifier can give a buffer more planes than its
1905    format has, such as a plane of compression metadata, and the library
1906    takes any such modifier that its GPU can render into and share.
1907
1908    See `mln_dma_buf_ring_descriptor` in the
1909    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/linux_8h.html).
1910    """
1911
1912    logical_size: LogicalSize
1913
1914    buffer_count: int
1915    """How many buffers the ring has, from 1 to 8."""
1916
1917    formats: Sequence[DmaBufFormat]
1918    """The formats and modifiers that your reader imports, most preferred first,
1919    such as those that eglQueryDmaBufModifiersEXT() reports.
1920    """
1921
1922    def __post_init__(self):
1923        object.__setattr__(self, "formats", _sequence(self.formats))
1924
1925    @classmethod
1926    def _from_native(cls, raw):
1927        return cls(
1928            logical_size=LogicalSize._from_native(raw["logical_size"]),
1929            buffer_count=raw["buffer_count"],
1930            formats=tuple(DmaBufFormat._from_native(item) for item in raw["formats"]),
1931        )

A ring of dmabufs that the library allocates, for MapHandle.attach_dma_buf_ring().

Each buffer has the map's size in pixels and a format and modifier from formats. The library renders only DRM_FORMAT_ABGR8888 and DRM_FORMAT_ARGB8888. A modifier can give a buffer more planes than its format has, such as a plane of compression metadata, and the library takes any such modifier that its GPU can render into and share.

See mln_dma_buf_ring_descriptor in the C API reference.

DmaBufRingDescriptor( logical_size: LogicalSize, buffer_count: int, formats: Sequence[DmaBufFormat])
logical_size: LogicalSize
buffer_count: int

How many buffers the ring has, from 1 to 8.

formats: Sequence[DmaBufFormat]

The formats and modifiers that your reader imports, most preferred first, such as those that eglQueryDmaBufModifiersEXT() reports.

@dataclass(frozen=True, slots=True)
class DxgiSharedTextureFrame:
1934@dataclass(frozen=True, slots=True)
1935class DxgiSharedTextureFrame:
1936    """The DXGI shared texture of an acquired frame.
1937
1938    See `mln_dxgi_shared_texture_frame` in the
1939    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/win32_8h.html).
1940    """
1941
1942    width: int
1943
1944    height: int
1945
1946    scale_factor: float
1947
1948    slot: int
1949    """The texture's index in the ring."""
1950
1951    format: int
1952    """The texture's `DXGI_FORMAT`."""
1953
1954    handle: int
1955    """The texture's shared NT `HANDLE`."""
1956
1957    @classmethod
1958    def _from_native(cls, raw):
1959        return cls(
1960            width=raw["width"],
1961            height=raw["height"],
1962            scale_factor=raw["scale_factor"],
1963            slot=raw["slot"],
1964            format=raw["format"],
1965            handle=raw["handle"],
1966        )

The DXGI shared texture of an acquired frame.

See mln_dxgi_shared_texture_frame in the C API reference.

DxgiSharedTextureFrame( width: int, height: int, scale_factor: float, slot: int, format: int, handle: int)
width: int
height: int
scale_factor: float
slot: int

The texture's index in the ring.

format: int

The texture's DXGI_FORMAT.

handle: int

The texture's shared NT HANDLE.

@dataclass(frozen=True, slots=True)
class DxgiSharedTextureRingDescriptor:
1969@dataclass(frozen=True, slots=True)
1970class DxgiSharedTextureRingDescriptor:
1971    """A ring of DXGI shared textures that the library allocates, for
1972    `MapHandle.attach_dxgi_shared_texture_ring()`.
1973
1974    Each texture is a D3D11 2D texture with the map's size in pixels and the
1975    format DXGI_FORMAT_B8G8R8A8_UNORM. It binds as a shader resource and a
1976    render target, and is shared through an NT handle.
1977
1978    See `mln_dxgi_shared_texture_ring_descriptor` in the
1979    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/win32_8h.html).
1980    """
1981
1982    logical_size: LogicalSize
1983
1984    texture_count: int
1985    """How many textures the ring has, from 1 to 8."""
1986
1987    @classmethod
1988    def _from_native(cls, raw):
1989        return cls(
1990            logical_size=LogicalSize._from_native(raw["logical_size"]),
1991            texture_count=raw["texture_count"],
1992        )

A ring of DXGI shared textures that the library allocates, for MapHandle.attach_dxgi_shared_texture_ring().

Each texture is a D3D11 2D texture with the map's size in pixels and the format DXGI_FORMAT_B8G8R8A8_UNORM. It binds as a shader resource and a render target, and is shared through an NT handle.

See mln_dxgi_shared_texture_ring_descriptor in the C API reference.

DxgiSharedTextureRingDescriptor( logical_size: LogicalSize, texture_count: int)
logical_size: LogicalSize
texture_count: int

How many textures the ring has, from 1 to 8.

@dataclass(frozen=True, slots=True)
class EdgeInsets:
1995@dataclass(frozen=True, slots=True)
1996class EdgeInsets:
1997    """Distances in logical pixels from each edge of the map.
1998
1999    See `mln_edge_insets` in the
2000    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
2001    """
2002
2003    top: float = 0.0
2004
2005    left: float = 0.0
2006
2007    bottom: float = 0.0
2008
2009    right: float = 0.0
2010
2011    @classmethod
2012    def _from_native(cls, raw):
2013        return cls(
2014            top=raw["top"], left=raw["left"], bottom=raw["bottom"], right=raw["right"]
2015        )

Distances in logical pixels from each edge of the map.

See mln_edge_insets in the C API reference.

EdgeInsets( top: float = 0.0, left: float = 0.0, bottom: float = 0.0, right: float = 0.0)
top: float
left: float
bottom: float
right: float
@dataclass(frozen=True, slots=True)
class EglContextDescriptor:
2018@dataclass(frozen=True, slots=True)
2019class EglContextDescriptor:
2020    """The EGL objects that a render session makes its OpenGL context from.
2021
2022    See `mln_egl_context_descriptor` in the
2023    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html).
2024    """
2025
2026    display: int
2027    """An `EGLDisplay`."""
2028
2029    config: int
2030    """An `EGLConfig`."""
2031
2032    share_context: int = 0
2033    """Your `EGLContext`, for a shared context."""
2034
2035    client_api: OpenGlClientApi = OpenGlClientApi.UNSPECIFIED
2036    """The API of a dedicated context. A shared context uses the API of yours."""
2037
2038    get_proc_address: int = 0
2039    """Your `eglGetProcAddress`, or null to use the system's."""
2040
2041    @classmethod
2042    def _from_native(cls, raw):
2043        return cls(
2044            display=raw["display"],
2045            config=raw["config"],
2046            share_context=raw["share_context"],
2047            client_api=OpenGlClientApi(raw["client_api"]),
2048            get_proc_address=raw["get_proc_address"],
2049        )

The EGL objects that a render session makes its OpenGL context from.

See mln_egl_context_descriptor in the C API reference.

EglContextDescriptor( display: int, config: int, share_context: int = 0, client_api: OpenGlClientApi = <OpenGlClientApi.UNSPECIFIED: 0>, get_proc_address: int = 0)
display: int

An EGLDisplay.

config: int

An EGLConfig.

share_context: int

Your EGLContext, for a shared context.

client_api: OpenGlClientApi

The API of a dedicated context. A shared context uses the API of yours.

get_proc_address: int

Your eglGetProcAddress, or null to use the system's.

@dataclass(frozen=True, slots=True)
class FeatureIdDoubleValueVariant:
115@dataclass(frozen=True, slots=True)
116class FeatureIdDoubleValueVariant:
117    """A finite number."""
118
119    value: float
120    _tag = 4
121
122    @classmethod
123    def _from_native(cls, raw):
124        return cls(raw)

A finite number.

FeatureIdDoubleValueVariant(value: float)
value: float
@dataclass(frozen=True, slots=True)
class FeatureIdIntValueVariant:
105@dataclass(frozen=True, slots=True)
106class FeatureIdIntValueVariant:
107    value: int
108    _tag = 3
109
110    @classmethod
111    def _from_native(cls, raw):
112        return cls(raw)
FeatureIdIntValueVariant(value: int)
value: int
@dataclass(frozen=True, slots=True)
class FeatureIdStringValueVariant:
85@dataclass(frozen=True, slots=True)
86class FeatureIdStringValueVariant:
87    value: str
88    _tag = 1
89
90    @classmethod
91    def _from_native(cls, raw):
92        return cls(raw)
FeatureIdStringValueVariant(value: str)
value: str
@dataclass(frozen=True, slots=True)
class FeatureIdUintValueVariant:
 95@dataclass(frozen=True, slots=True)
 96class FeatureIdUintValueVariant:
 97    value: int
 98    _tag = 2
 99
100    @classmethod
101    def _from_native(cls, raw):
102        return cls(raw)
FeatureIdUintValueVariant(value: int)
value: int
@dataclass(frozen=True, slots=True)
class FeatureStateSelector:
2068@dataclass(frozen=True, slots=True)
2069class FeatureStateSelector:
2070    """The features whose state to set, read, or remove.
2071
2072    See `mln_feature_state_selector` in the
2073    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
2074    """
2075
2076    source_id: str
2077
2078    source_layer_id: str = ""
2079    """The source layer, for a vector source. Empty for other sources."""
2080
2081    feature_id: FeatureId | None = None
2082    """The feature's ID. Setting or reading state needs it. Without it,
2083    `MapHandle.remove_feature_state()` removes the state of every feature in
2084    the source layer.
2085    """
2086
2087    state_key: str = ""
2088    """The one key that `MapHandle.remove_feature_state()` removes. It needs
2089    `feature_id`. Empty removes every key.
2090    """
2091
2092    @classmethod
2093    def _from_native(cls, raw):
2094        return cls(
2095            source_id=raw["source_id"],
2096            source_layer_id=raw["source_layer_id"],
2097            feature_id=None
2098            if raw["feature_id"] is None
2099            else (
2100                _copy_variant(
2101                    raw["feature_id"],
2102                    {
2103                        "string_value": FeatureIdStringValueVariant,
2104                        "uint_value": FeatureIdUintValueVariant,
2105                        "int_value": FeatureIdIntValueVariant,
2106                        "double_value": FeatureIdDoubleValueVariant,
2107                    },
2108                    None,
2109                )
2110            ),
2111            state_key=raw["state_key"],
2112        )

The features whose state to set, read, or remove.

See mln_feature_state_selector in the C API reference.

FeatureStateSelector( source_id: str, source_layer_id: str = '', feature_id: FeatureId | None = None, state_key: str = '')
source_id: str
source_layer_id: str

The source layer, for a vector source. Empty for other sources.

feature_id: FeatureId | None

The feature's ID. Setting or reading state needs it. Without it, MapHandle.remove_feature_state() removes the state of every feature in the source layer.

state_key: str

The one key that MapHandle.remove_feature_state() removes. It needs feature_id. Empty removes every key.

@dataclass(frozen=True, slots=True)
class FrameDemand:
2115@dataclass(frozen=True, slots=True)
2116class FrameDemand:
2117    """A demand for one frame.
2118
2119    See `mln_frame_demand` in the
2120    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
2121    """
2122
2123    flags: FrameDemandFlag = field(default_factory=lambda: FrameDemandFlag(0))
2124
2125    token: int = 0
2126    """A value of your choice that the demand's frame result carries."""
2127
2128    @classmethod
2129    def _from_native(cls, raw):
2130        return cls(flags=FrameDemandFlag(raw["flags"]), token=raw["token"])

A demand for one frame.

See mln_frame_demand in the C API reference.

FrameDemand( flags: FrameDemandFlag = <factory>, token: int = 0)
token: int

A value of your choice that the demand's frame result carries.

class FrameDemandFlag(enum.IntFlag):
369class FrameDemandFlag(IntFlag):
370    """How a frame demand behaves.
371
372    Without flags, a demand draws a frame when the map changed since the last
373    one, and otherwise finishes with `RenderResult.NO_UPDATE`. A session with
374    a surface target shows each frame that it draws.
375
376    See `mln_frame_demand_flag` in the
377    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
378    """
379
380    FORCE = 1
381    WAIT_FOR_UPDATE = 4

How a frame demand behaves.

Without flags, a demand draws a frame when the map changed since the last one, and otherwise finishes with RenderResult.NO_UPDATE. A session with a surface target shows each frame that it draws.

See mln_frame_demand_flag in the C API reference.

FORCE = <FrameDemandFlag.FORCE: 1>
WAIT_FOR_UPDATE = <FrameDemandFlag.WAIT_FOR_UPDATE: 4>
class FramePacerHandle(maplibre_native_ffi._generated_operations._FramePacerHandleOperations, maplibre_native_ffi._lifecycle.ScopedHandleMixin):
49__all__ = [
50    "AbiVersionMismatchError",
51    "CommandCompletion",
52    "MaplibreError",
53]

Demands render sessions' frames at a display's refreshes.

See mln_frame_pacer in the C API reference.

def release(self) -> None:
381    def release(self) -> None:
382        """Releases a frame pacer.
383
384        Render sessions that use the pacer stay paced until you release them
385        or set another pacer.
386
387        See `mln_frame_pacer_release` in the
388        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
389        """
390        return self._native.release()

Releases a frame pacer.

Render sessions that use the pacer stay paced until you release them or set another pacer.

See mln_frame_pacer_release in the C API reference.

id: int
69    @property
70    def id(self) -> int:
71        """The native handle value. It stays readable after release."""
72        return int(self._native.id)

The native handle value. It stays readable after release.

@dataclass(frozen=True, slots=True)
class FramePacerOptions:
2133@dataclass(frozen=True, slots=True)
2134class FramePacerOptions:
2135    """Options for creating a frame pacer.
2136
2137    See `mln_frame_pacer_options` in the
2138    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
2139    """
2140
2141    maximum_frames_per_second: int | None = None
2142    """The most frames per second that the pacer demands, greater than zero. The
2143    pacer skips display refreshes to stay within it. By default, it can
2144    demand frames at every refresh.
2145    """
2146
2147    @classmethod
2148    def _from_native(cls, raw):
2149        return cls(maximum_frames_per_second=raw["maximum_frames_per_second"])

Options for creating a frame pacer.

See mln_frame_pacer_options in the C API reference.

FramePacerOptions(maximum_frames_per_second: int | None = None)
maximum_frames_per_second: int | None

The most frames per second that the pacer demands, greater than zero. The pacer skips display refreshes to stay within it. By default, it can demand frames at every refresh.

@dataclass(frozen=True, slots=True)
class FreeCamera:
2152@dataclass(frozen=True, slots=True)
2153class FreeCamera:
2154    """A map camera's whole position and orientation in three dimensions.
2155
2156    Its members mean the same as those of `FreeCameraOptions`.
2157
2158    See `mln_free_camera` in the
2159    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
2160    """
2161
2162    position: Vec3
2163
2164    orientation: Quaternion
2165
2166    @classmethod
2167    def _from_native(cls, raw):
2168        return cls(
2169            position=Vec3._from_native(raw["position"]),
2170            orientation=Quaternion._from_native(raw["orientation"]),
2171        )

A map camera's whole position and orientation in three dimensions.

Its members mean the same as those of FreeCameraOptions.

See mln_free_camera in the C API reference.

FreeCamera( position: Vec3, orientation: Quaternion)
position: Vec3
orientation: Quaternion
@dataclass(frozen=True, slots=True)
class FreeCameraOptions:
2174@dataclass(frozen=True, slots=True)
2175class FreeCameraOptions:
2176    """The camera's position and orientation in three dimensions.
2177
2178    See `mln_free_camera_options` in the
2179    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
2180    """
2181
2182    position: Vec3 | None = None
2183    """The camera's position in Web Mercator units, where the world is 1 wide,
2184    (0, 0) is its northwest corner, and (1, 1) is its southeast corner. `z`
2185    is the altitude in the same units.
2186    """
2187
2188    orientation: Quaternion | None = None
2189    """The camera's rotation from looking straight down with north at the top of
2190    the screen.
2191    """
2192
2193    @classmethod
2194    def _from_native(cls, raw):
2195        return cls(
2196            position=_maybe(Vec3._from_native, raw["position"]),
2197            orientation=_maybe(Quaternion._from_native, raw["orientation"]),
2198        )

The camera's position and orientation in three dimensions.

See mln_free_camera_options in the C API reference.

FreeCameraOptions( position: Vec3 | None = None, orientation: Quaternion | None = None)
position: Vec3 | None

The camera's position in Web Mercator units, where the world is 1 wide, (0, 0) is its northwest corner, and (1, 1) is its southeast corner. z is the altitude in the same units.

orientation: Quaternion | None

The camera's rotation from looking straight down with north at the top of the screen.

@dataclass(frozen=True, slots=True)
class GeoJsonSourceOptions:
2201@dataclass(frozen=True, slots=True)
2202class GeoJsonSourceOptions:
2203    """Options for a GeoJSON
2204    \\[source\\](https://maplibre.org/maplibre-style-spec/sources/#geojson).
2205
2206    Zoom levels are whole numbers.
2207
2208    See `mln_geo_json_source_options` in the
2209    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
2210    """
2211
2212    min_zoom: float | None = None
2213
2214    max_zoom: float | None = None
2215
2216    tolerance: float | None = None
2217
2218    cluster_max_zoom: float | None = None
2219    """The last zoom level that has clusters, at most 30."""
2220
2221    cluster_properties: Any = None
2222    """The `clusterProperties` object, or empty for none."""
2223
2224    buffer: int | None = None
2225
2226    cluster_radius: int | None = None
2227
2228    cluster_min_points: int | None = None
2229    """At most 4294967295 on a 32-bit target."""
2230
2231    line_metrics: bool | None = None
2232
2233    cluster: bool | None = None
2234
2235    @classmethod
2236    def _from_native(cls, raw):
2237        return cls(
2238            min_zoom=raw["min_zoom"],
2239            max_zoom=raw["max_zoom"],
2240            tolerance=raw["tolerance"],
2241            cluster_max_zoom=raw["cluster_max_zoom"],
2242            cluster_properties=raw["cluster_properties"],
2243            buffer=raw["buffer"],
2244            cluster_radius=raw["cluster_radius"],
2245            cluster_min_points=raw["cluster_min_points"],
2246            line_metrics=raw["line_metrics"],
2247            cluster=raw["cluster"],
2248        )

Options for a GeoJSON [source](https://maplibre.org/maplibre-style-spec/sources/#geojson).

Zoom levels are whole numbers.

See mln_geo_json_source_options in the C API reference.

GeoJsonSourceOptions( min_zoom: float | None = None, max_zoom: float | None = None, tolerance: float | None = None, cluster_max_zoom: float | None = None, cluster_properties: Any = None, buffer: int | None = None, cluster_radius: int | None = None, cluster_min_points: int | None = None, line_metrics: bool | None = None, cluster: bool | None = None)
min_zoom: float | None
max_zoom: float | None
tolerance: float | None
cluster_max_zoom: float | None

The last zoom level that has clusters, at most 30.

cluster_properties: Any

The clusterProperties object, or empty for none.

buffer: int | None
cluster_radius: int | None
cluster_min_points: int | None

At most 4294967295 on a 32-bit target.

line_metrics: bool | None
cluster: bool | None
@dataclass(frozen=True, slots=True)
class GestureMomentum:
2251@dataclass(frozen=True, slots=True)
2252class GestureMomentum:
2253    """How a gesture keeps moving the camera after the user lets go.
2254
2255    A part moves only when its velocity is set, and each part slows on its
2256    own. Every part defaults to `MomentumDecayModel.FRICTION` with a
2257    half-life of 140 ms, and these other defaults:
2258
2259    - Pan stops at 10 logical pixels per second, needs a release of at least
2260      200, and counts a release faster than 10000 as 10000.
2261    - Zoom stops at 0.01 levels per second and moves at most 2.5 levels. Its
2262      snap settles on the nearest whole level.
2263    - Bearing stops at 1 degree per second and needs a release of at least
2264      60. Its snap settles on north within 7 degrees.
2265    - Pitch stops at 1 degree per second and needs a release of at least 5.
2266      Its snap settles flat within 7 degrees.
2267
2268    See `mln_gesture_momentum` in the
2269    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
2270    """
2271
2272    pan: PanMomentum = field(default_factory=lambda: PanMomentum())
2273
2274    zoom: AnchoredMomentum = field(default_factory=lambda: AnchoredMomentum())
2275
2276    bearing: AnchoredMomentum = field(default_factory=lambda: AnchoredMomentum())
2277
2278    pitch: AnchoredMomentum = field(default_factory=lambda: AnchoredMomentum())
2279
2280    @classmethod
2281    def _from_native(cls, raw):
2282        return cls(
2283            pan=PanMomentum._from_native(raw["pan"]),
2284            zoom=AnchoredMomentum._from_native(raw["zoom"]),
2285            bearing=AnchoredMomentum._from_native(raw["bearing"]),
2286            pitch=AnchoredMomentum._from_native(raw["pitch"]),
2287        )

How a gesture keeps moving the camera after the user lets go.

A part moves only when its velocity is set, and each part slows on its own. Every part defaults to MomentumDecayModel.FRICTION with a half-life of 140 ms, and these other defaults:

  • Pan stops at 10 logical pixels per second, needs a release of at least 200, and counts a release faster than 10000 as 10000.
  • Zoom stops at 0.01 levels per second and moves at most 2.5 levels. Its snap settles on the nearest whole level.
  • Bearing stops at 1 degree per second and needs a release of at least
    1. Its snap settles on north within 7 degrees.
  • Pitch stops at 1 degree per second and needs a release of at least 5. Its snap settles flat within 7 degrees.

See mln_gesture_momentum in the C API reference.

GestureMomentum( pan: PanMomentum = <factory>, zoom: AnchoredMomentum = <factory>, bearing: AnchoredMomentum = <factory>, pitch: AnchoredMomentum = <factory>)
bearing: AnchoredMomentum
class GesturePhase(maplibre_native_ffi._enum.UnknownIntEnum):
384class GesturePhase(UnknownIntEnum):
385    """Where a camera change falls in a gesture that the user makes.
386
387    `GesturePhase.BEGIN` and `GesturePhase.UPDATE` mark a gesture in
388    progress, and `GesturePhase.END` and `GesturePhase.CANCEL` end it.
389
390    See `mln_gesture_phase` in the
391    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
392    """
393
394    NONE = 0
395    BEGIN = 1
396    UPDATE = 2
397    END = 3
398    CANCEL = 4

Where a camera change falls in a gesture that the user makes.

GesturePhase.BEGIN and GesturePhase.UPDATE mark a gesture in progress, and GesturePhase.END and GesturePhase.CANCEL end it.

See mln_gesture_phase in the C API reference.

NONE = <GesturePhase.NONE: 0>
BEGIN = <GesturePhase.BEGIN: 1>
UPDATE = <GesturePhase.UPDATE: 2>
END = <GesturePhase.END: 3>
CANCEL = <GesturePhase.CANCEL: 4>
@dataclass(frozen=True, slots=True)
class GpuSync:
2290@dataclass(frozen=True, slots=True)
2291class GpuSync:
2292    """A point in GPU work that the other side waits for before using a texture.
2293
2294    See `mln_gpu_sync` in the
2295    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html).
2296    """
2297
2298    kind: GpuSyncKind = GpuSyncKind.CPU_COMPLETE
2299
2300    handle: int = 0
2301    """The object to wait on, for the kinds that name one."""
2302
2303    value: int = 0
2304
2305    @classmethod
2306    def _from_native(cls, raw):
2307        return cls(
2308            kind=GpuSyncKind(raw["kind"]), handle=raw["handle"], value=raw["value"]
2309        )

A point in GPU work that the other side waits for before using a texture.

See mln_gpu_sync in the C API reference.

GpuSync( kind: GpuSyncKind = <GpuSyncKind.CPU_COMPLETE: 0>, handle: int = 0, value: int = 0)
kind: GpuSyncKind
handle: int

The object to wait on, for the kinds that name one.

value: int
class GpuSyncKind(maplibre_native_ffi._enum.UnknownIntEnum):
401class GpuSyncKind(UnknownIntEnum):
402    """How one side waits for the other's GPU work on a shared texture.
403
404    A sync file descriptor or an OpenGL fence signals once, so when
405    `AcquiredFrameHandle.release()` succeeds, the session takes the one you
406    pass. A Vulkan timeline semaphore, Metal shared event, or D3D12 fence
407    counts up with each frame, so the one you pass stays yours. Keep it valid
408    until a detach or release of the session completes.
409
410    See `mln_gpu_sync_kind` in the
411    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html).
412    """
413
414    CPU_COMPLETE = 0
415    OPEN_GL_FENCE = 1
416    QUEUE_ORDER = 2
417    VULKAN_TIMELINE_SEMAPHORE = 3
418    SYNC_FD = 4
419    METAL_SHARED_EVENT = 5
420    D3D12_FENCE = 6

How one side waits for the other's GPU work on a shared texture.

A sync file descriptor or an OpenGL fence signals once, so when AcquiredFrameHandle.release() succeeds, the session takes the one you pass. A Vulkan timeline semaphore, Metal shared event, or D3D12 fence counts up with each frame, so the one you pass stays yours. Keep it valid until a detach or release of the session completes.

See mln_gpu_sync_kind in the C API reference.

CPU_COMPLETE = <GpuSyncKind.CPU_COMPLETE: 0>
OPEN_GL_FENCE = <GpuSyncKind.OPEN_GL_FENCE: 1>
QUEUE_ORDER = <GpuSyncKind.QUEUE_ORDER: 2>
VULKAN_TIMELINE_SEMAPHORE = <GpuSyncKind.VULKAN_TIMELINE_SEMAPHORE: 3>
SYNC_FD = <GpuSyncKind.SYNC_FD: 4>
METAL_SHARED_EVENT = <GpuSyncKind.METAL_SHARED_EVENT: 5>
D3D12_FENCE = <GpuSyncKind.D3D12_FENCE: 6>
class GpuSyncKindFlag(enum.IntFlag):
423class GpuSyncKindFlag(IntFlag):
424    """A GPU sync kind, as a bit in a set.
425
426    See `mln_gpu_sync_kind_flag` in the
427    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html).
428    """
429
430    CPU_COMPLETE = 1
431    OPEN_GL_FENCE = 2
432    QUEUE_ORDER = 4
433    VULKAN_TIMELINE_SEMAPHORE = 8
434    SYNC_FD = 16
435    METAL_SHARED_EVENT = 32
436    D3D12_FENCE = 64

A GPU sync kind, as a bit in a set.

See mln_gpu_sync_kind_flag in the C API reference.

CPU_COMPLETE = <GpuSyncKindFlag.CPU_COMPLETE: 1>
OPEN_GL_FENCE = <GpuSyncKindFlag.OPEN_GL_FENCE: 2>
QUEUE_ORDER = <GpuSyncKindFlag.QUEUE_ORDER: 4>
VULKAN_TIMELINE_SEMAPHORE = <GpuSyncKindFlag.VULKAN_TIMELINE_SEMAPHORE: 8>
SYNC_FD = <GpuSyncKindFlag.SYNC_FD: 16>
METAL_SHARED_EVENT = <GpuSyncKindFlag.METAL_SHARED_EVENT: 32>
D3D12_FENCE = <GpuSyncKindFlag.D3D12_FENCE: 64>
@dataclass(frozen=True, slots=True)
class HttpHeader:
2312@dataclass(frozen=True, slots=True)
2313class HttpHeader:
2314    """An HTTP header.
2315
2316    See `mln_http_header` in the
2317    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
2318    """
2319
2320    name: str
2321
2322    value: str = ""
2323
2324    @classmethod
2325    def _from_native(cls, raw):
2326        return cls(name=raw["name"], value=raw["value"])

An HTTP header.

See mln_http_header in the C API reference.

HttpHeader(name: str, value: str = '')
name: str
value: str
@dataclass(frozen=True, slots=True)
class HttpHeaderRule:
2329@dataclass(frozen=True, slots=True)
2330class HttpHeaderRule:
2331    """Headers to add to the HTTP requests whose URL matches a pattern.
2332
2333    See `mln_http_header_rule` in the
2334    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
2335    """
2336
2337    kinds: ResourceKindFlag = field(default_factory=lambda: ResourceKindFlag(0))
2338    """The kinds of resource that the rule covers. Zero covers every kind."""
2339
2340    flags: UrlMatchFlag = field(default_factory=lambda: UrlMatchFlag(0))
2341
2342    url: str = ""
2343
2344    headers: Sequence[HttpHeader] = ()
2345
2346    def __post_init__(self):
2347        object.__setattr__(self, "headers", _sequence(self.headers))
2348
2349    @classmethod
2350    def _from_native(cls, raw):
2351        return cls(
2352            kinds=ResourceKindFlag(raw["kinds"]),
2353            flags=UrlMatchFlag(raw["flags"]),
2354            url=raw["url"],
2355            headers=tuple(HttpHeader._from_native(item) for item in raw["headers"]),
2356        )

Headers to add to the HTTP requests whose URL matches a pattern.

See mln_http_header_rule in the C API reference.

HttpHeaderRule( kinds: ResourceKindFlag = <factory>, flags: UrlMatchFlag = <factory>, url: str = '', headers: Sequence[HttpHeader] = ())

The kinds of resource that the rule covers. Zero covers every kind.

flags: UrlMatchFlag
url: str
headers: Sequence[HttpHeader]
@dataclass(frozen=True, slots=True)
class HttpHeaderTransform:
2359@dataclass(frozen=True, slots=True)
2360class HttpHeaderTransform:
2361    """Headers to add to HTTP requests, for
2362    `RuntimeHandle.set_http_header_transform()`.
2363
2364    See `mln_http_header_transform` in the
2365    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
2366    """
2367
2368    rules: Sequence[HttpHeaderRule] = ()
2369    """The first rule that matches a request adds its headers, and no other."""
2370
2371    def __post_init__(self):
2372        object.__setattr__(self, "rules", _sequence(self.rules))

Headers to add to HTTP requests, for RuntimeHandle.set_http_header_transform().

See mln_http_header_transform in the C API reference.

HttpHeaderTransform( rules: Sequence[HttpHeaderRule] = ())
rules: Sequence[HttpHeaderRule]

The first rule that matches a request adds its headers, and no other.

@dataclass(frozen=True, slots=True)
class ImageContent:
2375@dataclass(frozen=True, slots=True)
2376class ImageContent:
2377    """The area of an image, in image pixels, that text fits inside.
2378
2379    See `mln_image_content` in the
2380    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
2381    """
2382
2383    left: float = 0.0
2384
2385    top: float = 0.0
2386
2387    right: float = 0.0
2388
2389    bottom: float = 0.0
2390
2391    @classmethod
2392    def _from_native(cls, raw):
2393        return cls(
2394            left=raw["left"], top=raw["top"], right=raw["right"], bottom=raw["bottom"]
2395        )

The area of an image, in image pixels, that text fits inside.

See mln_image_content in the C API reference.

ImageContent( left: float = 0.0, top: float = 0.0, right: float = 0.0, bottom: float = 0.0)
left: float
top: float
right: float
bottom: float
@dataclass(frozen=True, slots=True)
class ImageStretch:
2398@dataclass(frozen=True, slots=True)
2399class ImageStretch:
2400    """A range of image pixels, from `from` to `to`, that stretches to fit text.
2401
2402    See `mln_image_stretch` in the
2403    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
2404    """
2405
2406    from_: float = 0.0
2407
2408    to: float = 0.0
2409
2410    @classmethod
2411    def _from_native(cls, raw):
2412        return cls(from_=raw["from_"], to=raw["to"])

A range of image pixels, from from to to, that stretches to fit text.

See mln_image_stretch in the C API reference.

ImageStretch(from_: float = 0.0, to: float = 0.0)
from_: float
to: float
@dataclass(frozen=True, slots=True)
class IoSurfaceFrame:
2415@dataclass(frozen=True, slots=True)
2416class IoSurfaceFrame:
2417    """The IOSurface of an acquired frame.
2418
2419    See `mln_io_surface_frame` in the
2420    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/apple_8h.html).
2421    """
2422
2423    width: int
2424
2425    height: int
2426
2427    scale_factor: float
2428
2429    slot: int
2430    """The surface's index in the ring."""
2431
2432    surface: int
2433    """The `IOSurfaceRef`."""
2434
2435    @classmethod
2436    def _from_native(cls, raw):
2437        return cls(
2438            width=raw["width"],
2439            height=raw["height"],
2440            scale_factor=raw["scale_factor"],
2441            slot=raw["slot"],
2442            surface=raw["surface"],
2443        )

The IOSurface of an acquired frame.

See mln_io_surface_frame in the C API reference.

IoSurfaceFrame( width: int, height: int, scale_factor: float, slot: int, surface: int)
width: int
height: int
scale_factor: float
slot: int

The surface's index in the ring.

surface: int

The IOSurfaceRef.

@dataclass(frozen=True, slots=True)
class IoSurfaceRingDescriptor:
2446@dataclass(frozen=True, slots=True)
2447class IoSurfaceRingDescriptor:
2448    """A ring of IOSurfaces that the library allocates, for
2449    `MapHandle.attach_io_surface_ring()`.
2450
2451    Each surface has the map's size in pixels, `logical_size` times the map's
2452    scale factor, and the pixel format kCVPixelFormatType_32BGRA, which Metal
2453    names MTLPixelFormatBGRA8Unorm.
2454
2455    See `mln_io_surface_ring_descriptor` in the
2456    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/apple_8h.html).
2457    """
2458
2459    logical_size: LogicalSize
2460
2461    buffer_count: int
2462    """How many surfaces the ring has, from 1 to 8."""
2463
2464    context: MetalContextDescriptor = field(
2465        default_factory=lambda: MetalContextDescriptor()
2466    )
2467    """The MTLDevice to render with. A null device picks the system's default."""
2468
2469    @classmethod
2470    def _from_native(cls, raw):
2471        return cls(
2472            logical_size=LogicalSize._from_native(raw["logical_size"]),
2473            buffer_count=raw["buffer_count"],
2474            context=MetalContextDescriptor._from_native(raw["context"]),
2475        )

A ring of IOSurfaces that the library allocates, for MapHandle.attach_io_surface_ring().

Each surface has the map's size in pixels, logical_size times the map's scale factor, and the pixel format kCVPixelFormatType_32BGRA, which Metal names MTLPixelFormatBGRA8Unorm.

See mln_io_surface_ring_descriptor in the C API reference.

IoSurfaceRingDescriptor( logical_size: LogicalSize, buffer_count: int, context: MetalContextDescriptor = <factory>)
logical_size: LogicalSize
buffer_count: int

How many surfaces the ring has, from 1 to 8.

The MTLDevice to render with. A null device picks the system's default.

@dataclass(frozen=True, slots=True)
class LatLng:
2478@dataclass(frozen=True, slots=True)
2479class LatLng:
2480    """A geographic coordinate, in degrees.
2481
2482    See `mln_lat_lng` in the
2483    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
2484    """
2485
2486    latitude: float = 0.0
2487
2488    longitude: float = 0.0
2489
2490    @classmethod
2491    def _from_native(cls, raw):
2492        return cls(latitude=raw["latitude"], longitude=raw["longitude"])

A geographic coordinate, in degrees.

See mln_lat_lng in the C API reference.

LatLng(latitude: float = 0.0, longitude: float = 0.0)
latitude: float
longitude: float
@dataclass(frozen=True, slots=True)
class LatLngBounds:
2495@dataclass(frozen=True, slots=True)
2496class LatLngBounds:
2497    """A rectangle of coordinates, from its southwest to its northeast corner.
2498
2499    See `mln_lat_lng_bounds` in the
2500    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
2501    """
2502
2503    southwest: LatLng = field(default_factory=lambda: LatLng())
2504
2505    northeast: LatLng = field(default_factory=lambda: LatLng())
2506
2507    @classmethod
2508    def _from_native(cls, raw):
2509        return cls(
2510            southwest=LatLng._from_native(raw["southwest"]),
2511            northeast=LatLng._from_native(raw["northeast"]),
2512        )

A rectangle of coordinates, from its southwest to its northeast corner.

See mln_lat_lng_bounds in the C API reference.

LatLngBounds( southwest: LatLng = <factory>, northeast: LatLng = <factory>)
southwest: LatLng
northeast: LatLng
class LogCallback(typing.Protocol):
5906class LogCallback(Protocol):
5907    """Receives a log message.
5908
5909    The callback runs on the binding's dispatcher thread, after native queues
5910    the call.
5911
5912    See `mln_log_callback` in the
5913    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/logging_8h.html).
5914    """
5915
5916    def __call__(
5917        self, severity: LogSeverity, event: LogEvent, code: int, message: str, /
5918    ) -> None: ...

Receives a log message.

The callback runs on the binding's dispatcher thread, after native queues the call.

See mln_log_callback in the C API reference.

LogCallback(*args, **kwargs)
1903def _no_init_or_replace_init(self, *args, **kwargs):
1904    cls = type(self)
1905
1906    if cls._is_protocol:
1907        raise TypeError('Protocols cannot be instantiated')
1908
1909    # Already using a custom `__init__`. No need to calculate correct
1910    # `__init__` to call. This can lead to RecursionError. See bpo-45121.
1911    if cls.__init__ is not _no_init_or_replace_init:
1912        return
1913
1914    # Initially, `__init__` of a protocol subclass is set to `_no_init_or_replace_init`.
1915    # The first instantiation of the subclass will call `_no_init_or_replace_init` which
1916    # searches for a proper new `__init__` in the MRO. The new `__init__`
1917    # replaces the subclass' old `__init__` (ie `_no_init_or_replace_init`). Subsequent
1918    # instantiation of the protocol subclass will thus use the new
1919    # `__init__` and no longer call `_no_init_or_replace_init`.
1920    for base in cls.__mro__:
1921        init = base.__dict__.get('__init__', _no_init_or_replace_init)
1922        if init is not _no_init_or_replace_init:
1923            cls.__init__ = init
1924            break
1925    else:
1926        # should not happen
1927        cls.__init__ = object.__init__
1928
1929    cls.__init__(self, *args, **kwargs)
class LogEvent(maplibre_native_ffi._enum.UnknownIntEnum):
439class LogEvent(UnknownIntEnum):
440    """The part of the library that logged a message.
441
442    See `mln_log_event` in the
443    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/logging_8h.html).
444    """
445
446    GENERAL = 0
447    SETUP = 1
448    SHADER = 2
449    PARSE_STYLE = 3
450    PARSE_TILE = 4
451    RENDER = 5
452    STYLE = 6
453    DATABASE = 7
454    HTTP_REQUEST = 8
455    SPRITE = 9
456    IMAGE = 10
457    GRAPHICS_BACKEND = 11
458    JNI = 12
459    ANDROID = 13
460    CRASH = 14
461    GLYPH = 15
462    TIMING = 16

The part of the library that logged a message.

See mln_log_event in the C API reference.

GENERAL = <LogEvent.GENERAL: 0>
SETUP = <LogEvent.SETUP: 1>
SHADER = <LogEvent.SHADER: 2>
PARSE_STYLE = <LogEvent.PARSE_STYLE: 3>
PARSE_TILE = <LogEvent.PARSE_TILE: 4>
RENDER = <LogEvent.RENDER: 5>
STYLE = <LogEvent.STYLE: 6>
DATABASE = <LogEvent.DATABASE: 7>
HTTP_REQUEST = <LogEvent.HTTP_REQUEST: 8>
SPRITE = <LogEvent.SPRITE: 9>
IMAGE = <LogEvent.IMAGE: 10>
GRAPHICS_BACKEND = <LogEvent.GRAPHICS_BACKEND: 11>
JNI = <LogEvent.JNI: 12>
ANDROID = <LogEvent.ANDROID: 13>
CRASH = <LogEvent.CRASH: 14>
GLYPH = <LogEvent.GLYPH: 15>
TIMING = <LogEvent.TIMING: 16>
@dataclass(frozen=True, slots=True)
class LogHandler:
2515@dataclass(frozen=True, slots=True)
2516class LogHandler:
2517    """A log callback, for `set_log_callback()`.
2518
2519    The callback runs on the binding's dispatcher thread, after native queues
2520    the call.
2521
2522    See `mln_log_handler` in the
2523    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/logging_8h.html).
2524    """
2525
2526    callback: LogCallback
2527    platform_severities: LogSeverityFlag = field(
2528        default_factory=lambda: LogSeverityFlag(0)
2529    )
2530    """The severities that also go to the platform's log, as they do without a
2531    callback. 0 sends none. A message of these severities goes to the
2532    platform's log even when the handler's queue can't accept it.
2533    """
2534
2535    def _invoke_callback(self, severity, event, code, message):
2536        callback = self.callback
2537        return callback(LogSeverity(severity), LogEvent(event), code, message)

A log callback, for set_log_callback().

The callback runs on the binding's dispatcher thread, after native queues the call.

See mln_log_handler in the C API reference.

LogHandler( callback: LogCallback, platform_severities: LogSeverityFlag = <factory>)
callback: LogCallback
platform_severities: LogSeverityFlag

The severities that also go to the platform's log, as they do without a callback. 0 sends none. A message of these severities goes to the platform's log even when the handler's queue can't accept it.

class LogSeverity(maplibre_native_ffi._enum.UnknownIntEnum):
465class LogSeverity(UnknownIntEnum):
466    """The severity of a log message.
467
468    See `mln_log_severity` in the
469    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/logging_8h.html).
470    """
471
472    INFO = 1
473    WARNING = 2
474    ERROR = 3

The severity of a log message.

See mln_log_severity in the C API reference.

INFO = <LogSeverity.INFO: 1>
WARNING = <LogSeverity.WARNING: 2>
ERROR = <LogSeverity.ERROR: 3>
class LogSeverityFlag(enum.IntFlag):
477class LogSeverityFlag(IntFlag):
478    """A log severity, as a bit in a set.
479
480    See `mln_log_severity_flag` in the
481    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/logging_8h.html).
482    """
483
484    INFO = 2
485    WARNING = 4
486    ERROR = 8
487    DEFAULT = 6
488    ALL = 14

A log severity, as a bit in a set.

See mln_log_severity_flag in the C API reference.

INFO = <LogSeverityFlag.INFO: 2>
WARNING = <LogSeverityFlag.WARNING: 4>
ERROR = <LogSeverityFlag.ERROR: 8>
DEFAULT = <LogSeverityFlag.DEFAULT: 6>
ALL = <LogSeverityFlag.ALL: 14>
@dataclass(frozen=True, slots=True)
class LogicalExtent:
2540@dataclass(frozen=True, slots=True)
2541class LogicalExtent:
2542    """A size in logical pixels, and the physical pixels in each logical pixel.
2543
2544    See `mln_logical_extent` in the
2545    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
2546    """
2547
2548    width: int = 0
2549
2550    height: int = 0
2551
2552    scale_factor: float = 0.0
2553
2554    @classmethod
2555    def _from_native(cls, raw):
2556        return cls(
2557            width=raw["width"], height=raw["height"], scale_factor=raw["scale_factor"]
2558        )

A size in logical pixels, and the physical pixels in each logical pixel.

See mln_logical_extent in the C API reference.

LogicalExtent(width: int = 0, height: int = 0, scale_factor: float = 0.0)
width: int
height: int
scale_factor: float
@dataclass(frozen=True, slots=True)
class LogicalSize:
2561@dataclass(frozen=True, slots=True)
2562class LogicalSize:
2563    """A size in logical pixels, which the map's scale factor turns into pixels.
2564
2565    See `mln_logical_size` in the
2566    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
2567    """
2568
2569    width: int = 0
2570
2571    height: int = 0
2572
2573    @classmethod
2574    def _from_native(cls, raw):
2575        return cls(width=raw["width"], height=raw["height"])

A size in logical pixels, which the map's scale factor turns into pixels.

See mln_logical_size in the C API reference.

LogicalSize(width: int = 0, height: int = 0)
width: int
height: int
class MapDebugFlag(enum.IntFlag):
491class MapDebugFlag(IntFlag):
492    """A debug overlay that the map draws.
493
494    See `mln_map_debug_flag` in the
495    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
496    """
497
498    TILE_BORDERS = 2
499    PARSE_STATUS = 4
500    TIMESTAMPS = 8
501    COLLISION = 16
502    OVERDRAW = 32
503    STENCIL_CLIP = 64
504    DEPTH_BUFFER = 128

A debug overlay that the map draws.

See mln_map_debug_flag in the C API reference.

TILE_BORDERS = <MapDebugFlag.TILE_BORDERS: 2>
PARSE_STATUS = <MapDebugFlag.PARSE_STATUS: 4>
TIMESTAMPS = <MapDebugFlag.TIMESTAMPS: 8>
COLLISION = <MapDebugFlag.COLLISION: 16>
OVERDRAW = <MapDebugFlag.OVERDRAW: 32>
STENCIL_CLIP = <MapDebugFlag.STENCIL_CLIP: 64>
DEPTH_BUFFER = <MapDebugFlag.DEPTH_BUFFER: 128>
class MapHandle(maplibre_native_ffi._generated_operations._MapHandleOperations, maplibre_native_ffi._lifecycle.ScopedHandleMixin):

A map, with its style and camera.

See mln_map in the C API reference.

def add_custom_geometry_source( self, source_id: str, options: CustomGeometrySourceOptions) -> concurrent.futures._base.Future[CommandCompletion]:
396    def add_custom_geometry_source(
397        self, source_id: str, options: CustomGeometrySourceOptions
398    ) -> Future[CommandCompletion]:
399        """Adds a source whose GeoJSON tiles come from callbacks.
400
401        See `mln_map_add_custom_geometry_source` in the
402        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
403
404        Errors:
405
406        - `Status.ALREADY_EXISTS` when the style already has a source named
407          `source_id`.
408        - `Status.INVALID_STATE` while the style isn't loaded, as
409          `MapHandle.set_style_url()` describes.
410        """
411        return self._native.add_custom_geometry_source(source_id, options)

Adds a source whose GeoJSON tiles come from callbacks.

See mln_map_add_custom_geometry_source in the C API reference.

Errors:

def add_custom_vector_source( self, source_id: str, options: CustomVectorSourceOptions) -> concurrent.futures._base.Future[CommandCompletion]:
413    def add_custom_vector_source(
414        self, source_id: str, options: CustomVectorSourceOptions
415    ) -> Future[CommandCompletion]:
416        """Adds a source whose vector tiles come from callbacks.
417
418        See `mln_map_add_custom_vector_source` in the
419        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
420
421        Errors:
422
423        - `Status.ALREADY_EXISTS` when the style already has a source named
424          `source_id`.
425        - `Status.INVALID_STATE` while the style isn't loaded, as
426          `MapHandle.set_style_url()` describes.
427        """
428        return self._native.add_custom_vector_source(source_id, options)

Adds a source whose vector tiles come from callbacks.

See mln_map_add_custom_vector_source in the C API reference.

Errors:

def add_geo_json_source( self, source_id: str, options: GeoJsonSourceOptions | None = None, attribution: str | None = None) -> concurrent.futures._base.Future[CommandCompletion]:
430    def add_geo_json_source(
431        self,
432        source_id: str,
433        options: GeoJsonSourceOptions | None = None,
434        attribution: str | None = None,
435    ) -> Future[CommandCompletion]:
436        """Adds a GeoJSON source with no data.
437
438        Give it data with `MapHandle.set_geo_json_source_data()` or
439        `MapHandle.set_geo_json_source_url()`. Its options stay fixed for as
440        long as the style holds it.
441
442        `attribution` is the source's
443        \\[attribution\\](https://maplibre.org/maplibre-style-spec/sources/#attribution),
444        or empty for none.
445
446        See `mln_map_add_geo_json_source` in the
447        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
448
449        Errors:
450
451        - `Status.INVALID_ARGUMENT` when an option in `options` is out of
452          range.
453        - `Status.ALREADY_EXISTS` when the style already has a source named
454          `source_id`.
455        - `Status.INVALID_STATE` while the style isn't loaded, as
456          `MapHandle.set_style_url()` describes.
457        """
458        return self._native.add_geo_json_source(source_id, options, attribution)

Adds a GeoJSON source with no data.

Give it data with MapHandle.set_geo_json_source_data() or MapHandle.set_geo_json_source_url(). Its options stay fixed for as long as the style holds it.

attribution is the source's [attribution](https://maplibre.org/maplibre-style-spec/sources/#attribution), or empty for none.

See mln_map_add_geo_json_source in the C API reference.

Errors:

def add_image_source_image( self, source_id: str, coordinates: Sequence[LatLng], image: PremultipliedRgba8Image) -> concurrent.futures._base.Future[CommandCompletion]:
460    def add_image_source_image(
461        self,
462        source_id: str,
463        coordinates: Sequence[LatLng],
464        image: PremultipliedRgba8Image,
465    ) -> Future[CommandCompletion]:
466        """Adds an image source that shows `image`.
467
468        `coordinates` are the image's four corners, clockwise from the top
469        left.
470
471        See `mln_map_add_image_source_image` in the
472        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
473
474        Errors:
475
476        - `Status.ALREADY_EXISTS` when the style already has a source named
477          `source_id`.
478        - `Status.INVALID_STATE` while the style isn't loaded, as
479          `MapHandle.set_style_url()` describes.
480        """
481        return self._native.add_image_source_image(source_id, coordinates, image)

Adds an image source that shows image.

coordinates are the image's four corners, clockwise from the top left.

See mln_map_add_image_source_image in the C API reference.

Errors:

def add_style_layer_json( self, layer_json: Any, before_layer_id: str | None = None) -> concurrent.futures._base.Future[CommandCompletion]:
483    def add_style_layer_json(
484        self, layer_json: Any, before_layer_id: str | None = None
485    ) -> Future[CommandCompletion]:
486        """Adds a layer to the map's style.
487
488        `layer_json` is a
489        \\[layer\\](https://maplibre.org/maplibre-style-spec/layers/) object.
490        The layer goes below the layer named `before_layer_id`, or above
491        every layer when `before_layer_id` is empty.
492
493        See `mln_map_add_style_layer_json` in the
494        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
495
496        Errors:
497
498        - `Status.NOT_FOUND` when the style has no layer named
499          `before_layer_id`, or no source with the ID that the layer uses.
500        - `Status.ALREADY_EXISTS` when the style already has a layer with the
501          new layer's ID.
502        - `Status.INVALID_STATE` while the style isn't loaded, as
503          `MapHandle.set_style_url()` describes.
504        """
505        return self._native.add_style_layer_json(layer_json, before_layer_id)

Adds a layer to the map's style.

layer_json is a [layer](https://maplibre.org/maplibre-style-spec/layers/) object. The layer goes below the layer named before_layer_id, or above every layer when before_layer_id is empty.

See mln_map_add_style_layer_json in the C API reference.

Errors:

def add_style_source_json( self, source_id: str, source_json: Any) -> concurrent.futures._base.Future[CommandCompletion]:
507    def add_style_source_json(
508        self, source_id: str, source_json: Any
509    ) -> Future[CommandCompletion]:
510        """Adds a source to the map's style.
511
512        `source_json` is a
513        \\[source\\](https://maplibre.org/maplibre-style-spec/sources/) object.
514
515        See `mln_map_add_style_source_json` in the
516        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
517
518        Errors:
519
520        - `Status.ALREADY_EXISTS` when the style already has a source named
521          `source_id`.
522        - `Status.INVALID_STATE` while the style isn't loaded, as
523          `MapHandle.set_style_url()` describes.
524        """
525        return self._native.add_style_source_json(source_id, source_json)

Adds a source to the map's style.

source_json is a [source](https://maplibre.org/maplibre-style-spec/sources/) object.

See mln_map_add_style_source_json in the C API reference.

Errors:

def apply_camera_delta( self, delta: CameraDelta) -> concurrent.futures._base.Future[CommandCompletion]:
527    def apply_camera_delta(self, delta: CameraDelta) -> Future[CommandCompletion]:
528        """Moves the camera relative to where it is, as a gesture does.
529
530        `delta` can pan the map's content by an offset on the screen, scale
531        the zoom, and add to the bearing and pitch. An anchor keeps one
532        screen point in place while the scale, bearing, or pitch changes. An
533        anchor needs one of those changes, and combines with an offset only
534        when the delta has no animation. The function finishes when the map
535        applies the delta, before an animation ends.
536
537        A delta that replaces an animated one starts from where that
538        animation left the camera, so the rest of the replaced change never
539        happens. To reach an exact camera, use `MapHandle.update_camera()`.
540
541        A delta in the end phase can carry momentum, which keeps the camera
542        moving from the gesture's release velocities and slows it on each
543        rendered frame. The gesture lasts until the momentum ends: the
544        snapshot keeps `gesture_in_progress` set, and camera events report
545        `CameraChangeSource.MOMENTUM`. With momentum, `animation` sets only
546        `transition_id` and the end handler, which runs when the gesture
547        ends.
548
549        A delta in the begin phase, `MapHandle.cancel_camera_transitions()`,
550        or a cancellation by that ID stops the momentum. A later command that
551        sets a field stops only the parts of the momentum that move that
552        field. On a tilted map, the pan moves the map's content the same
553        distance on the screen in every direction.
554
555        See `mln_map_apply_camera_delta` in the
556        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
557        """
558        return self._native.apply_camera_delta(delta)

Moves the camera relative to where it is, as a gesture does.

delta can pan the map's content by an offset on the screen, scale the zoom, and add to the bearing and pitch. An anchor keeps one screen point in place while the scale, bearing, or pitch changes. An anchor needs one of those changes, and combines with an offset only when the delta has no animation. The function finishes when the map applies the delta, before an animation ends.

A delta that replaces an animated one starts from where that animation left the camera, so the rest of the replaced change never happens. To reach an exact camera, use MapHandle.update_camera().

A delta in the end phase can carry momentum, which keeps the camera moving from the gesture's release velocities and slows it on each rendered frame. The gesture lasts until the momentum ends: the snapshot keeps gesture_in_progress set, and camera events report CameraChangeSource.MOMENTUM. With momentum, animation sets only transition_id and the end handler, which runs when the gesture ends.

A delta in the begin phase, MapHandle.cancel_camera_transitions(), or a cancellation by that ID stops the momentum. A later command that sets a field stops only the parts of the momentum that move that field. On a tilted map, the pan moves the map's content the same distance on the screen in every direction.

See mln_map_apply_camera_delta in the C API reference.

def attach_android_hardware_buffer_ring( self, descriptor: AndroidHardwareBufferRingDescriptor, device: VulkanDeviceHandle | None, options: RenderSessionAttachOptions) -> RenderSessionHandle:
560    def attach_android_hardware_buffer_ring(
561        self,
562        descriptor: AndroidHardwareBufferRingDescriptor,
563        device: VulkanDeviceHandle | None,
564        options: RenderSessionAttachOptions,
565    ) -> RenderSessionHandle:
566        """Creates a session that renders the map into a ring of Android
567        hardware buffers that the library allocates.
568
569        Acquire each frame with `RenderSessionHandle.acquire_frame()`, and
570        get its buffer with `AcquiredFrameHandle.android_hardware_buffer()`.
571        `RenderSessionHandle.resize()` gives the ring new buffers of the new
572        size.
573
574        A Vulkan build renders with `device`, or, when `device` is null, with
575        a device that the library creates. An OpenGL build uses an EGL
576        context on the default display, and `device` must be null. Attach
577        with `RenderDriverKind.CORE_WORKER`.
578
579        To show the buffers through Android's UI, such as with
580        `Bitmap.wrapHardwareBuffer`, attach without `GpuSyncKindFlag.SYNC_FD`
581        in `RenderSessionAttachOptions.producer_sync_kinds`, so that each
582        frame finishes before you acquire it. Keep each frame acquired until
583        the next one replaces it on screen, then release it with
584        `GpuSyncKind.CPU_COMPLETE`. Give the ring 3 buffers, so the session
585        can render while you hold two frames.
586
587        See `mln_map_attach_android_hardware_buffer_ring` in the
588        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/android_8h.html).
589
590        Errors:
591
592        - `Status.UNSUPPORTED` when Android is older than 8.0, API level 26,
593          or when the graphics context can't render into hardware buffers:
594          the Vulkan device lacks
595          VK_ANDROID_external_memory_android_hardware_buffer, or the EGL
596          display lacks EGL_ANDROID_get_native_client_buffer or
597          EGL_ANDROID_image_native_buffer.
598        - `Status.NATIVE_ERROR` when the library can't create its Vulkan
599          device or initialize the default EGL display.
600        """
601        raw = self._native.attach_android_hardware_buffer_ring(
602            descriptor, None if device is None else device._native, options
603        )
604        return _adopt_value(raw["session"], "RenderSessionHandle", self, raw["ready"])

Creates a session that renders the map into a ring of Android hardware buffers that the library allocates.

Acquire each frame with RenderSessionHandle.acquire_frame(), and get its buffer with AcquiredFrameHandle.android_hardware_buffer(). RenderSessionHandle.resize() gives the ring new buffers of the new size.

A Vulkan build renders with device, or, when device is null, with a device that the library creates. An OpenGL build uses an EGL context on the default display, and device must be null. Attach with RenderDriverKind.CORE_WORKER.

To show the buffers through Android's UI, such as with Bitmap.wrapHardwareBuffer, attach without GpuSyncKindFlag.SYNC_FD in RenderSessionAttachOptions.producer_sync_kinds, so that each frame finishes before you acquire it. Keep each frame acquired until the next one replaces it on screen, then release it with GpuSyncKind.CPU_COMPLETE. Give the ring 3 buffers, so the session can render while you hold two frames.

See mln_map_attach_android_hardware_buffer_ring in the C API reference.

Errors:

  • Status.UNSUPPORTED when Android is older than 8.0, API level 26, or when the graphics context can't render into hardware buffers: the Vulkan device lacks VK_ANDROID_external_memory_android_hardware_buffer, or the EGL display lacks EGL_ANDROID_get_native_client_buffer or EGL_ANDROID_image_native_buffer.
  • Status.NATIVE_ERROR when the library can't create its Vulkan device or initialize the default EGL display.
def attach_android_surface( self, descriptor: AndroidSurfaceDescriptor, device: VulkanDeviceHandle | None, options: RenderSessionAttachOptions) -> RenderSessionHandle:
606    def attach_android_surface(
607        self,
608        descriptor: AndroidSurfaceDescriptor,
609        device: VulkanDeviceHandle | None,
610        options: RenderSessionAttachOptions,
611    ) -> RenderSessionHandle:
612        """Creates a session that presents the map to an Android window, with a
613        graphics context that the library creates.
614
615        A Vulkan build presents with `device`, or, when `device` is null,
616        with a device that the library creates. An OpenGL build uses an EGL
617        context on the default display, and `device` must be null. Attach
618        with `RenderDriverKind.CORE_WORKER`.
619
620        When the platform destroys the window, such as in
621        `SurfaceHolder.Callback.surfaceDestroyed`, release the target with
622        `RenderSessionHandle.release_target()`, or give the session a new
623        window with `RenderSessionHandle.set_android_surface_target()`,
624        without waiting for that to complete. The session keeps its own
625        reference to the window and stays usable for the next window. A frame
626        to the destroyed window finishes with
627        `RenderResult.TARGET_NOT_READY`, or with `RenderResult.RENDERED` if
628        the window went away while the frame was presenting.
629
630        See `mln_map_attach_android_surface` in the
631        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/android_8h.html).
632
633        Errors:
634
635        - `Status.INVALID_ARGUMENT` when `surface` has no window, such as
636          after the platform destroyed it.
637        - `Status.UNSUPPORTED` when you created `device` without
638          `VulkanDeviceOptions.presentation`.
639        - `Status.UNSUPPORTED` when the GPU or the Vulkan loader can't
640          present.
641        - `Status.NATIVE_ERROR` when the library can't create the graphics
642          context or the window's surface.
643        """
644        raw = self._native.attach_android_surface(
645            descriptor, None if device is None else device._native, options
646        )
647        return _adopt_value(raw["session"], "RenderSessionHandle", self, raw["ready"])

Creates a session that presents the map to an Android window, with a graphics context that the library creates.

A Vulkan build presents with device, or, when device is null, with a device that the library creates. An OpenGL build uses an EGL context on the default display, and device must be null. Attach with RenderDriverKind.CORE_WORKER.

When the platform destroys the window, such as in SurfaceHolder.Callback.surfaceDestroyed, release the target with RenderSessionHandle.release_target(), or give the session a new window with RenderSessionHandle.set_android_surface_target(), without waiting for that to complete. The session keeps its own reference to the window and stays usable for the next window. A frame to the destroyed window finishes with RenderResult.TARGET_NOT_READY, or with RenderResult.RENDERED if the window went away while the frame was presenting.

See mln_map_attach_android_surface in the C API reference.

Errors:

def attach_dma_buf_ring( self, descriptor: DmaBufRingDescriptor, device: VulkanDeviceHandle | None, options: RenderSessionAttachOptions) -> RenderSessionHandle:
649    def attach_dma_buf_ring(
650        self,
651        descriptor: DmaBufRingDescriptor,
652        device: VulkanDeviceHandle | None,
653        options: RenderSessionAttachOptions,
654    ) -> RenderSessionHandle:
655        """Creates a session that renders the map into a ring of dmabufs that
656        the library allocates.
657
658        Acquire each frame with `RenderSessionHandle.acquire_frame()`, and
659        get its buffer with `AcquiredFrameHandle.dma_buf()`.
660        `RenderSessionHandle.resize()` gives the ring new buffers of the new
661        size.
662
663        A Vulkan build renders with `device`, or, when `device` is null, with
664        a device that the library creates. An OpenGL build uses an EGL
665        context of its own, and `device` must be null. Attach with
666        `RenderDriverKind.CORE_WORKER`.
667
668        For a reader that waits on no sync file, such as a Wayland compositor
669        without explicit synchronization, attach without
670        `GpuSyncKindFlag.SYNC_FD` in
671        `RenderSessionAttachOptions.producer_sync_kinds`, so that each frame
672        finishes before you acquire it. Keep each frame acquired until its
673        reader is done with the buffer. Give the ring 3 buffers, so the
674        session can render while you hold two frames.
675
676        See `mln_map_attach_dma_buf_ring` in the
677        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/linux_8h.html).
678
679        Errors:
680
681        - `Status.UNSUPPORTED` when the graphics context can't render into a
682          dmabuf of any of `formats`.
683        - `Status.NATIVE_ERROR` when the library can't create its Vulkan
684          device or initialize an EGL display.
685        """
686        raw = self._native.attach_dma_buf_ring(
687            descriptor, None if device is None else device._native, options
688        )
689        return _adopt_value(raw["session"], "RenderSessionHandle", self, raw["ready"])

Creates a session that renders the map into a ring of dmabufs that the library allocates.

Acquire each frame with RenderSessionHandle.acquire_frame(), and get its buffer with AcquiredFrameHandle.dma_buf(). RenderSessionHandle.resize() gives the ring new buffers of the new size.

A Vulkan build renders with device, or, when device is null, with a device that the library creates. An OpenGL build uses an EGL context of its own, and device must be null. Attach with RenderDriverKind.CORE_WORKER.

For a reader that waits on no sync file, such as a Wayland compositor without explicit synchronization, attach without GpuSyncKindFlag.SYNC_FD in RenderSessionAttachOptions.producer_sync_kinds, so that each frame finishes before you acquire it. Keep each frame acquired until its reader is done with the buffer. Give the ring 3 buffers, so the session can render while you hold two frames.

See mln_map_attach_dma_buf_ring in the C API reference.

Errors:

  • Status.UNSUPPORTED when the graphics context can't render into a dmabuf of any of formats.
  • Status.NATIVE_ERROR when the library can't create its Vulkan device or initialize an EGL display.
def attach_dxgi_shared_texture_ring( self, descriptor: DxgiSharedTextureRingDescriptor, device: VulkanDeviceHandle | None, options: RenderSessionAttachOptions) -> RenderSessionHandle:
691    def attach_dxgi_shared_texture_ring(
692        self,
693        descriptor: DxgiSharedTextureRingDescriptor,
694        device: VulkanDeviceHandle | None,
695        options: RenderSessionAttachOptions,
696    ) -> RenderSessionHandle:
697        """Creates a session that renders the map into a ring of DXGI shared
698        textures that the library allocates.
699
700        Acquire each frame with `RenderSessionHandle.acquire_frame()`, and
701        get its texture with `AcquiredFrameHandle.dxgi_shared_texture()`.
702        `RenderSessionHandle.resize()` gives the ring new textures of the new
703        size.
704
705        The session renders with the Vulkan device `device`, or, when
706        `device` is null, with one that the library creates. The textures
707        belong to the device's GPU, so open them on a D3D11 or D3D12 device
708        of the same adapter. To pick the GPU, create `device` with
709        `VulkanDeviceOptions.device_luid` set to your adapter's LUID. Attach
710        with `RenderDriverKind.CORE_WORKER`.
711
712        For a reader that waits on no fence, such as Flutter's texture
713        registrar, attach without `GpuSyncKindFlag.D3D12_FENCE` in
714        `RenderSessionAttachOptions.producer_sync_kinds`, so that each frame
715        finishes before you acquire it. Release a frame with
716        `GpuSyncKind.CPU_COMPLETE` only once the reader has finished with its
717        texture.
718
719        See `mln_map_attach_dxgi_shared_texture_ring` in the
720        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/win32_8h.html).
721
722        Errors:
723
724        - `Status.UNSUPPORTED` in an OpenGL build, or when the GPU can't
725          share the textures: D3D11 has no adapter with the Vulkan device's
726          LUID or can't share textures through NT handles, or the device
727          lacks VK_KHR_external_memory_win32 or can't import D3D11 textures.
728        - `Status.NATIVE_ERROR` when the library can't create its Vulkan
729          device or a D3D11 device on the adapter.
730        """
731        raw = self._native.attach_dxgi_shared_texture_ring(
732            descriptor, None if device is None else device._native, options
733        )
734        return _adopt_value(raw["session"], "RenderSessionHandle", self, raw["ready"])

Creates a session that renders the map into a ring of DXGI shared textures that the library allocates.

Acquire each frame with RenderSessionHandle.acquire_frame(), and get its texture with AcquiredFrameHandle.dxgi_shared_texture(). RenderSessionHandle.resize() gives the ring new textures of the new size.

The session renders with the Vulkan device device, or, when device is null, with one that the library creates. The textures belong to the device's GPU, so open them on a D3D11 or D3D12 device of the same adapter. To pick the GPU, create device with VulkanDeviceOptions.device_luid set to your adapter's LUID. Attach with RenderDriverKind.CORE_WORKER.

For a reader that waits on no fence, such as Flutter's texture registrar, attach without GpuSyncKindFlag.D3D12_FENCE in RenderSessionAttachOptions.producer_sync_kinds, so that each frame finishes before you acquire it. Release a frame with GpuSyncKind.CPU_COMPLETE only once the reader has finished with its texture.

See mln_map_attach_dxgi_shared_texture_ring in the C API reference.

Errors:

  • Status.UNSUPPORTED in an OpenGL build, or when the GPU can't share the textures: D3D11 has no adapter with the Vulkan device's LUID or can't share textures through NT handles, or the device lacks VK_KHR_external_memory_win32 or can't import D3D11 textures.
  • Status.NATIVE_ERROR when the library can't create its Vulkan device or a D3D11 device on the adapter.
def attach_io_surface_ring( self, descriptor: IoSurfaceRingDescriptor, options: RenderSessionAttachOptions) -> RenderSessionHandle:
736    def attach_io_surface_ring(
737        self, descriptor: IoSurfaceRingDescriptor, options: RenderSessionAttachOptions
738    ) -> RenderSessionHandle:
739        """Creates a session that renders the map into a ring of IOSurfaces that
740        the library allocates.
741
742        Acquire each frame with `RenderSessionHandle.acquire_frame()`, and
743        get its surface with `AcquiredFrameHandle.io_surface()`.
744        `RenderSessionHandle.resize()` gives the ring new surfaces of the new
745        size. Attach with `RenderDriverKind.CORE_WORKER`.
746
747        To hand frames to a reader that can't wait on an event, such as
748        Flutter's `copyPixelBuffer`, attach without
749        `GpuSyncKindFlag.METAL_SHARED_EVENT` in
750        `RenderSessionAttachOptions.producer_sync_kinds`, so that each frame
751        finishes before you acquire it. Release a frame with
752        `GpuSyncKind.CPU_COMPLETE` only once the reader has finished with its
753        surface.
754
755        See `mln_map_attach_io_surface_ring` in the
756        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/apple_8h.html).
757
758        Errors:
759
760        - `Status.UNSUPPORTED` when `supported_render_backend_mask()` lacks
761          `RenderBackendFlag.METAL`.
762        - `Status.NATIVE_ERROR` when `context` names no device and the system
763          has no Metal device.
764        """
765        raw = self._native.attach_io_surface_ring(descriptor, options)
766        return _adopt_value(raw["session"], "RenderSessionHandle", self, raw["ready"])

Creates a session that renders the map into a ring of IOSurfaces that the library allocates.

Acquire each frame with RenderSessionHandle.acquire_frame(), and get its surface with AcquiredFrameHandle.io_surface(). RenderSessionHandle.resize() gives the ring new surfaces of the new size. Attach with RenderDriverKind.CORE_WORKER.

To hand frames to a reader that can't wait on an event, such as Flutter's copyPixelBuffer, attach without GpuSyncKindFlag.METAL_SHARED_EVENT in RenderSessionAttachOptions.producer_sync_kinds, so that each frame finishes before you acquire it. Release a frame with GpuSyncKind.CPU_COMPLETE only once the reader has finished with its surface.

See mln_map_attach_io_surface_ring in the C API reference.

Errors:

def attach_metal_borrowed_texture( self, descriptor: MetalBorrowedTextureDescriptor, options: RenderSessionAttachOptions) -> RenderSessionHandle:
768    def attach_metal_borrowed_texture(
769        self,
770        descriptor: MetalBorrowedTextureDescriptor,
771        options: RenderSessionAttachOptions,
772    ) -> RenderSessionHandle:
773        """Creates a session that renders the map into a ring of your Metal
774        textures.
775
776        See `mln_map_attach_metal_borrowed_texture` in the
777        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
778
779        Errors:
780
781        - `Status.UNSUPPORTED` when `supported_render_backend_mask()` lacks
782          `RenderBackendFlag.METAL`, or when the target supports none of the
783          `producer_sync_kinds` in `options`.
784        """
785        raw = self._native.attach_metal_borrowed_texture(descriptor, options)
786        return _adopt_value(raw["session"], "RenderSessionHandle", self, raw["ready"])

Creates a session that renders the map into a ring of your Metal textures.

See mln_map_attach_metal_borrowed_texture in the C API reference.

Errors:

def attach_metal_surface( self, descriptor: MetalSurfaceDescriptor, options: RenderSessionAttachOptions) -> RenderSessionHandle:
788    def attach_metal_surface(
789        self, descriptor: MetalSurfaceDescriptor, options: RenderSessionAttachOptions
790    ) -> RenderSessionHandle:
791        """Creates a session that renders the map to a Metal layer.
792
793        See `mln_map_attach_metal_surface` in the
794        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html).
795
796        Errors:
797
798        - `Status.UNSUPPORTED` when `supported_render_backend_mask()` lacks
799          `RenderBackendFlag.METAL`.
800        """
801        raw = self._native.attach_metal_surface(descriptor, options)
802        return _adopt_value(raw["session"], "RenderSessionHandle", self, raw["ready"])

Creates a session that renders the map to a Metal layer.

See mln_map_attach_metal_surface in the C API reference.

Errors:

def attach_offscreen( self, descriptor: OffscreenDescriptor, options: RenderSessionAttachOptions, device: OffscreenDeviceHandle | None = None) -> RenderSessionHandle:
804    def attach_offscreen(
805        self,
806        descriptor: OffscreenDescriptor,
807        options: RenderSessionAttachOptions,
808        device: OffscreenDeviceHandle | None = None,
809    ) -> RenderSessionHandle:
810        """Attaches a render session that renders the map offscreen.
811
812        Read each image's pixels with `RenderSessionHandle.read_texture()`.
813
814        The session renders on `device`. When `device` is null, the session
815        creates a device with the default options, and releases it when the
816        session ends.
817
818        See `mln_map_attach_offscreen` in the
819        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/offscreen_8h.html).
820
821        Errors:
822
823        - `Status.INVALID_STATE` when the map already has a render session.
824        - `Status.NATIVE_ERROR` when `device` is null and the platform can't
825          create a device.
826        """
827        raw = self._native.attach_offscreen(
828            descriptor, options, None if device is None else device._native
829        )
830        return _adopt_value(raw["session"], "RenderSessionHandle", self, raw["ready"])

Attaches a render session that renders the map offscreen.

Read each image's pixels with RenderSessionHandle.read_texture().

The session renders on device. When device is null, the session creates a device with the default options, and releases it when the session ends.

See mln_map_attach_offscreen in the C API reference.

Errors:

def attach_open_gl_borrowed_texture( self, descriptor: OpenGlBorrowedTextureDescriptor, options: RenderSessionAttachOptions) -> RenderSessionHandle:
832    def attach_open_gl_borrowed_texture(
833        self,
834        descriptor: OpenGlBorrowedTextureDescriptor,
835        options: RenderSessionAttachOptions,
836    ) -> RenderSessionHandle:
837        """Creates a session that renders the map into a ring of your OpenGL
838        textures.
839
840        See `mln_map_attach_open_gl_borrowed_texture` in the
841        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
842
843        Errors:
844
845        - `Status.UNSUPPORTED` when
846          `open_gl_supported_context_provider_mask()` lacks the context's
847          platform, or when the target supports none of the
848          `producer_sync_kinds` in `options`.
849        """
850        raw = self._native.attach_open_gl_borrowed_texture(descriptor, options)
851        return _adopt_value(raw["session"], "RenderSessionHandle", self, raw["ready"])

Creates a session that renders the map into a ring of your OpenGL textures.

See mln_map_attach_open_gl_borrowed_texture in the C API reference.

Errors:

def attach_open_gl_surface( self, descriptor: OpenGlSurfaceDescriptor, options: RenderSessionAttachOptions) -> RenderSessionHandle:
853    def attach_open_gl_surface(
854        self, descriptor: OpenGlSurfaceDescriptor, options: RenderSessionAttachOptions
855    ) -> RenderSessionHandle:
856        """Creates a session that renders the map to an OpenGL surface.
857
858        See `mln_map_attach_open_gl_surface` in the
859        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html).
860
861        Errors:
862
863        - `Status.UNSUPPORTED` when
864          `open_gl_supported_context_provider_mask()` lacks the context's
865          platform.
866        """
867        raw = self._native.attach_open_gl_surface(descriptor, options)
868        return _adopt_value(raw["session"], "RenderSessionHandle", self, raw["ready"])

Creates a session that renders the map to an OpenGL surface.

See mln_map_attach_open_gl_surface in the C API reference.

Errors:

def attach_vulkan_borrowed_texture( self, descriptor: VulkanBorrowedTextureDescriptor, options: RenderSessionAttachOptions) -> RenderSessionHandle:
870    def attach_vulkan_borrowed_texture(
871        self,
872        descriptor: VulkanBorrowedTextureDescriptor,
873        options: RenderSessionAttachOptions,
874    ) -> RenderSessionHandle:
875        """Creates a session that renders the map into a ring of your Vulkan
876        images.
877
878        See `mln_map_attach_vulkan_borrowed_texture` in the
879        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
880
881        Errors:
882
883        - `Status.UNSUPPORTED` when `supported_render_backend_mask()` lacks
884          `RenderBackendFlag.VULKAN`, or when the target supports none of the
885          `producer_sync_kinds` in `options`.
886        """
887        raw = self._native.attach_vulkan_borrowed_texture(descriptor, options)
888        return _adopt_value(raw["session"], "RenderSessionHandle", self, raw["ready"])

Creates a session that renders the map into a ring of your Vulkan images.

See mln_map_attach_vulkan_borrowed_texture in the C API reference.

Errors:

def attach_vulkan_surface( self, descriptor: VulkanSurfaceDescriptor, options: RenderSessionAttachOptions) -> RenderSessionHandle:
890    def attach_vulkan_surface(
891        self, descriptor: VulkanSurfaceDescriptor, options: RenderSessionAttachOptions
892    ) -> RenderSessionHandle:
893        """Creates a session that renders the map to a Vulkan surface.
894
895        See `mln_map_attach_vulkan_surface` in the
896        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html).
897
898        Errors:
899
900        - `Status.UNSUPPORTED` when `supported_render_backend_mask()` lacks
901          `RenderBackendFlag.VULKAN`.
902        """
903        raw = self._native.attach_vulkan_surface(descriptor, options)
904        return _adopt_value(raw["session"], "RenderSessionHandle", self, raw["ready"])

Creates a session that renders the map to a Vulkan surface.

See mln_map_attach_vulkan_surface in the C API reference.

Errors:

def attach_wayland_surface( self, descriptor: WaylandSurfaceDescriptor, device: VulkanDeviceHandle | None, options: RenderSessionAttachOptions) -> RenderSessionHandle:
906    def attach_wayland_surface(
907        self,
908        descriptor: WaylandSurfaceDescriptor,
909        device: VulkanDeviceHandle | None,
910        options: RenderSessionAttachOptions,
911    ) -> RenderSessionHandle:
912        """Creates a session that presents the map to a Wayland surface, with a
913        graphics context that the library creates.
914
915        A Vulkan build presents with `device`, or, when `device` is null,
916        with a device that the library creates. An OpenGL build uses an EGL
917        context on the display, and `device` must be null. Attach with
918        `RenderDriverKind.CORE_WORKER`.
919
920        The session presents without waiting for the compositor, so demand at
921        most one frame per display refresh.
922
923        Keep the surface until a release or replacement of the target, or a
924        detach of the session, completes. Keep the display connected until
925        the session's detach completes. In an OpenGL build, if you also use
926        EGL on the display, initialize it before you attach.
927
928        See `mln_map_attach_wayland_surface` in the
929        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/wayland_8h.html).
930
931        Errors:
932
933        - `Status.UNSUPPORTED` when you created `device` without
934          `VulkanDeviceOptions.presentation`.
935        - `Status.UNSUPPORTED` when the GPU or the Vulkan loader can't
936          present to Wayland.
937        - `Status.NATIVE_ERROR` when the library can't create the graphics
938          context or present to the surface.
939        """
940        raw = self._native.attach_wayland_surface(
941            descriptor, None if device is None else device._native, options
942        )
943        return _adopt_value(raw["session"], "RenderSessionHandle", self, raw["ready"])

Creates a session that presents the map to a Wayland surface, with a graphics context that the library creates.

A Vulkan build presents with device, or, when device is null, with a device that the library creates. An OpenGL build uses an EGL context on the display, and device must be null. Attach with RenderDriverKind.CORE_WORKER.

The session presents without waiting for the compositor, so demand at most one frame per display refresh.

Keep the surface until a release or replacement of the target, or a detach of the session, completes. Keep the display connected until the session's detach completes. In an OpenGL build, if you also use EGL on the display, initialize it before you attach.

See mln_map_attach_wayland_surface in the C API reference.

Errors:

def attach_win32_window( self, descriptor: Win32WindowDescriptor, device: VulkanDeviceHandle | None, options: RenderSessionAttachOptions) -> RenderSessionHandle:
945    def attach_win32_window(
946        self,
947        descriptor: Win32WindowDescriptor,
948        device: VulkanDeviceHandle | None,
949        options: RenderSessionAttachOptions,
950    ) -> RenderSessionHandle:
951        """Creates a session that presents the map to a Win32 window, with a
952        graphics context that the library creates.
953
954        A Vulkan build presents with `device`, or, when `device` is null,
955        with a device that the library creates. An OpenGL build uses a WGL
956        context, and `device` must be null. Attach with
957        `RenderDriverKind.CORE_WORKER`.
958
959        An OpenGL build sets the window's pixel format, so don't set one
960        yourself.
961
962        The session presents without waiting for the display, so demand at
963        most one frame per display refresh. While the window is minimized,
964        frame demands finish with `RenderResult.TARGET_NOT_READY`.
965
966        Keep the window until a release or replacement of the target, or a
967        detach of the session, completes.
968
969        See `mln_map_attach_win32_window` in the
970        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/win32_8h.html).
971
972        Errors:
973
974        - `Status.INVALID_ARGUMENT` when `window` isn't a window, or, in an
975          OpenGL build, already has another pixel format.
976        - `Status.INVALID_STATE` when `window` is minimized or has no client
977          area.
978        - `Status.UNSUPPORTED` when you created `device` without
979          `VulkanDeviceOptions.presentation`.
980        - `Status.INVALID_STATE` when `window` was minimized before the
981          attach ran.
982        - `Status.UNSUPPORTED` when the GPU or the Vulkan loader can't
983          present.
984        - `Status.NATIVE_ERROR` when the library can't create the graphics
985          context or present to the window.
986        """
987        raw = self._native.attach_win32_window(
988            descriptor, None if device is None else device._native, options
989        )
990        return _adopt_value(raw["session"], "RenderSessionHandle", self, raw["ready"])

Creates a session that presents the map to a Win32 window, with a graphics context that the library creates.

A Vulkan build presents with device, or, when device is null, with a device that the library creates. An OpenGL build uses a WGL context, and device must be null. Attach with RenderDriverKind.CORE_WORKER.

An OpenGL build sets the window's pixel format, so don't set one yourself.

The session presents without waiting for the display, so demand at most one frame per display refresh. While the window is minimized, frame demands finish with RenderResult.TARGET_NOT_READY.

Keep the window until a release or replacement of the target, or a detach of the session, completes.

See mln_map_attach_win32_window in the C API reference.

Errors:

def begin_command_group( self) -> concurrent.futures._base.Future[CommandCompletion]:
 992    def begin_command_group(self) -> Future[CommandCompletion]:
 993        """Holds back the map's changes from rendering until
 994        `MapHandle.end_command_group()`, so they show in the same frame.
 995
 996        Groups nest, and the changes render when the outermost group ends.
 997
 998        See `mln_map_begin_command_group` in the
 999        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1000        """
1001        return self._native.begin_command_group()

Holds back the map's changes from rendering until MapHandle.end_command_group(), so they show in the same frame.

Groups nest, and the changes render when the outermost group ends.

See mln_map_begin_command_group in the C API reference.

def camera_for_geometry( self, geometry: Any, fit_options: CameraFitOptions | None = None) -> concurrent.futures._base.Future[CameraOptions]:
1003    def camera_for_geometry(
1004        self, geometry: Any, fit_options: CameraFitOptions | None = None
1005    ) -> Future[CameraOptions]:
1006        """Computes a camera that fits a GeoJSON geometry in the map's view.
1007
1008        `geometry` is a GeoJSON geometry object with at least one coordinate,
1009        not a feature. The camera keeps the map's bearing and pitch unless
1010        `fit_options` sets them, and its zoom stays within the map's zoom
1011        limits.
1012
1013        See `mln_map_camera_for_geometry` in the
1014        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
1015
1016        Errors:
1017
1018        - `Status.INVALID_ARGUMENT` when the padding in `fit_options` leaves
1019          no room for the area.
1020        """
1021        return map_future(
1022            self._native.camera_for_geometry(geometry, fit_options),
1023            lambda value: CameraOptions._from_native(value),
1024        )

Computes a camera that fits a GeoJSON geometry in the map's view.

geometry is a GeoJSON geometry object with at least one coordinate, not a feature. The camera keeps the map's bearing and pitch unless fit_options sets them, and its zoom stays within the map's zoom limits.

See mln_map_camera_for_geometry in the C API reference.

Errors:

def camera_for_lat_lng_bounds( self, bounds: LatLngBounds, fit_options: CameraFitOptions | None = None) -> concurrent.futures._base.Future[CameraOptions]:
1026    def camera_for_lat_lng_bounds(
1027        self, bounds: LatLngBounds, fit_options: CameraFitOptions | None = None
1028    ) -> Future[CameraOptions]:
1029        """Computes a camera that fits `bounds` in the map's view.
1030
1031        The camera keeps the map's bearing and pitch unless `fit_options`
1032        sets them, and its zoom stays within the map's zoom limits.
1033
1034        See `mln_map_camera_for_lat_lng_bounds` in the
1035        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
1036
1037        Errors:
1038
1039        - `Status.INVALID_ARGUMENT` when the padding in `fit_options` leaves
1040          no room for the area.
1041        """
1042        return map_future(
1043            self._native.camera_for_lat_lng_bounds(bounds, fit_options),
1044            lambda value: CameraOptions._from_native(value),
1045        )

Computes a camera that fits bounds in the map's view.

The camera keeps the map's bearing and pitch unless fit_options sets them, and its zoom stays within the map's zoom limits.

See mln_map_camera_for_lat_lng_bounds in the C API reference.

Errors:

def camera_for_lat_lngs( self, coordinates: Sequence[LatLng], fit_options: CameraFitOptions | None = None) -> concurrent.futures._base.Future[CameraOptions]:
1047    def camera_for_lat_lngs(
1048        self, coordinates: Sequence[LatLng], fit_options: CameraFitOptions | None = None
1049    ) -> Future[CameraOptions]:
1050        """Computes a camera that fits `coordinates` in the map's view.
1051
1052        `coordinates` must not be empty. The camera keeps the map's bearing
1053        and pitch unless `fit_options` sets them, and its zoom stays within
1054        the map's zoom limits.
1055
1056        See `mln_map_camera_for_lat_lngs` in the
1057        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
1058
1059        Errors:
1060
1061        - `Status.INVALID_ARGUMENT` when the padding in `fit_options` leaves
1062          no room for the area.
1063        """
1064        return map_future(
1065            self._native.camera_for_lat_lngs(coordinates, fit_options),
1066            lambda value: CameraOptions._from_native(value),
1067        )

Computes a camera that fits coordinates in the map's view.

coordinates must not be empty. The camera keeps the map's bearing and pitch unless fit_options sets them, and its zoom stays within the map's zoom limits.

See mln_map_camera_for_lat_lngs in the C API reference.

Errors:

def cancel_camera_transitions( self) -> concurrent.futures._base.Future[CommandCompletion]:
1069    def cancel_camera_transitions(self) -> Future[CommandCompletion]:
1070        """Stops every running camera animation where it is.
1071
1072        The end handler of each stopped animation reports
1073        `CameraTransitionOutcome.CANCELLED`.
1074
1075        See `mln_map_cancel_camera_transitions` in the
1076        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
1077        """
1078        return self._native.cancel_camera_transitions()

Stops every running camera animation where it is.

The end handler of each stopped animation reports CameraTransitionOutcome.CANCELLED.

See mln_map_cancel_camera_transitions in the C API reference.

def cancel_camera_transitions_with_id( self, transition_id: int) -> concurrent.futures._base.Future[CommandCompletion]:
1080    def cancel_camera_transitions_with_id(
1081        self, transition_id: int
1082    ) -> Future[CommandCompletion]:
1083        """Stops the running camera animations whose animation options set
1084        `transition_id`.
1085
1086        Other animations keep running. The end handler of each stopped
1087        animation reports `CameraTransitionOutcome.CANCELLED`.
1088
1089        See `mln_map_cancel_camera_transitions_with_id` in the
1090        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
1091        """
1092        return self._native.cancel_camera_transitions_with_id(transition_id)

Stops the running camera animations whose animation options set transition_id.

Other animations keep running. The end handler of each stopped animation reports CameraTransitionOutcome.CANCELLED.

See mln_map_cancel_camera_transitions_with_id in the C API reference.

def dump_debug_logs( self) -> concurrent.futures._base.Future[CommandCompletion]:
1094    def dump_debug_logs(self) -> Future[CommandCompletion]:
1095        """Logs debugging information about the map's style and sources.
1096
1097        See `mln_map_dump_debug_logs` in the
1098        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
1099        """
1100        return self._native.dump_debug_logs()

Logs debugging information about the map's style and sources.

See mln_map_dump_debug_logs in the C API reference.

def end_command_group( self) -> concurrent.futures._base.Future[CommandCompletion]:
1102    def end_command_group(self) -> Future[CommandCompletion]:
1103        """Ends the group that `MapHandle.begin_command_group()` began.
1104
1105        See `mln_map_end_command_group` in the
1106        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1107        """
1108        return self._native.end_command_group()

Ends the group that MapHandle.begin_command_group() began.

See mln_map_end_command_group in the C API reference.

def fit_camera_to_geometry( self, geometry: Any, update: CameraFitUpdate) -> concurrent.futures._base.Future[CommandCompletion]:
1110    def fit_camera_to_geometry(
1111        self, geometry: Any, update: CameraFitUpdate
1112    ) -> Future[CommandCompletion]:
1113        """Moves the camera to fit a GeoJSON geometry in the map's view, at once
1114        or with an animation.
1115
1116        `geometry` is a GeoJSON geometry object with at least one coordinate,
1117        not a feature. The camera is the one that
1118        `MapHandle.camera_for_geometry()` computes after the commands sent
1119        before this one apply. The function finishes when the map applies the
1120        change, before an animation ends.
1121
1122        See `mln_map_fit_camera_to_geometry` in the
1123        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
1124
1125        Errors:
1126
1127        - `Status.INVALID_ARGUMENT` when the padding in `update` leaves no
1128          room for the area. The camera doesn't move.
1129        """
1130        return self._native.fit_camera_to_geometry(geometry, update)

Moves the camera to fit a GeoJSON geometry in the map's view, at once or with an animation.

geometry is a GeoJSON geometry object with at least one coordinate, not a feature. The camera is the one that MapHandle.camera_for_geometry() computes after the commands sent before this one apply. The function finishes when the map applies the change, before an animation ends.

See mln_map_fit_camera_to_geometry in the C API reference.

Errors:

def fit_camera_to_lat_lng_bounds( self, bounds: LatLngBounds, update: CameraFitUpdate) -> concurrent.futures._base.Future[CommandCompletion]:
1132    def fit_camera_to_lat_lng_bounds(
1133        self, bounds: LatLngBounds, update: CameraFitUpdate
1134    ) -> Future[CommandCompletion]:
1135        """Moves the camera to fit `bounds` in the map's view, at once or with
1136        an animation.
1137
1138        The camera is the one that `MapHandle.camera_for_lat_lng_bounds()`
1139        computes after the commands sent before this one apply. The function
1140        finishes when the map applies the change, before an animation ends.
1141
1142        See `mln_map_fit_camera_to_lat_lng_bounds` in the
1143        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
1144
1145        Errors:
1146
1147        - `Status.INVALID_ARGUMENT` when the padding in `update` leaves no
1148          room for the area. The camera doesn't move.
1149        """
1150        return self._native.fit_camera_to_lat_lng_bounds(bounds, update)

Moves the camera to fit bounds in the map's view, at once or with an animation.

The camera is the one that MapHandle.camera_for_lat_lng_bounds() computes after the commands sent before this one apply. The function finishes when the map applies the change, before an animation ends.

See mln_map_fit_camera_to_lat_lng_bounds in the C API reference.

Errors:

def fit_camera_to_lat_lngs( self, coordinates: Sequence[LatLng], update: CameraFitUpdate) -> concurrent.futures._base.Future[CommandCompletion]:
1152    def fit_camera_to_lat_lngs(
1153        self, coordinates: Sequence[LatLng], update: CameraFitUpdate
1154    ) -> Future[CommandCompletion]:
1155        """Moves the camera to fit `coordinates` in the map's view, at once or
1156        with an animation.
1157
1158        `coordinates` must not be empty. The camera is the one that
1159        `MapHandle.camera_for_lat_lngs()` computes after the commands sent
1160        before this one apply. The function finishes when the map applies the
1161        change, before an animation ends.
1162
1163        See `mln_map_fit_camera_to_lat_lngs` in the
1164        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
1165
1166        Errors:
1167
1168        - `Status.INVALID_ARGUMENT` when the padding in `update` leaves no
1169          room for the area. The camera doesn't move.
1170        """
1171        return self._native.fit_camera_to_lat_lngs(coordinates, update)

Moves the camera to fit coordinates in the map's view, at once or with an animation.

coordinates must not be empty. The camera is the one that MapHandle.camera_for_lat_lngs() computes after the commands sent before this one apply. The function finishes when the map applies the change, before an animation ends.

See mln_map_fit_camera_to_lat_lngs in the C API reference.

Errors:

def get_camera( self) -> concurrent.futures._base.Future[CameraQueryResult]:
1173    def get_camera(self) -> Future[CameraQueryResult]:
1174        """Reads the map's camera.
1175
1176        The query reads the camera after the map applies the commands sent
1177        before it.
1178
1179        See `mln_map_get_camera` in the
1180        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
1181        """
1182        return map_future(
1183            self._native.get_camera(),
1184            lambda value: CameraQueryResult._from_native(value),
1185        )

Reads the map's camera.

The query reads the camera after the map applies the commands sent before it.

See mln_map_get_camera in the C API reference.

def get_feature_state( self, selector: FeatureStateSelector) -> concurrent.futures._base.Future[typing.Any]:
1187    def get_feature_state(self, selector: FeatureStateSelector) -> Future[Any]:
1188        """Reads the state of a feature, as a JSON object.
1189
1190        The object is empty when the feature has no state.
1191
1192        See `mln_map_get_feature_state` in the
1193        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1194        """
1195        return self._native.get_feature_state(selector)

Reads the state of a feature, as a JSON object.

The object is empty when the feature has no state.

See mln_map_get_feature_state in the C API reference.

def get_global_state(self) -> concurrent.futures._base.Future[typing.Any]:
1197    def get_global_state(self) -> Future[Any]:
1198        """Reads the global state of the map's style as a JSON object.
1199
1200        See `mln_map_get_global_state` in the
1201        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1202        """
1203        return self._native.get_global_state()

Reads the global state of the map's style as a JSON object.

See mln_map_get_global_state in the C API reference.

def get_image_source_coordinates( self, source_id: str) -> concurrent.futures._base.Future[tuple[LatLng, ...]]:
1205    def get_image_source_coordinates(
1206        self, source_id: str
1207    ) -> Future[tuple[LatLng, ...]]:
1208        """Reads the corners of an image source's image, clockwise from the top
1209        left.
1210
1211        See `mln_map_get_image_source_coordinates` in the
1212        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1213
1214        Errors:
1215
1216        - `Status.NOT_FOUND` when the style has no source named `source_id`.
1217        - `Status.INVALID_ARGUMENT` when the source named `source_id` isn't
1218          an image source.
1219        """
1220        return map_future(
1221            self._native.get_image_source_coordinates(source_id),
1222            lambda value: tuple(LatLng._from_native(item) for item in value),
1223        )

Reads the corners of an image source's image, clockwise from the top left.

See mln_map_get_image_source_coordinates in the C API reference.

Errors:

def get_loaded_style_json(self) -> concurrent.futures._base.Future[typing.Any]:
1225    def get_loaded_style_json(self) -> Future[Any]:
1226        """Reads the JSON of the style that the map loaded.
1227
1228        The JSON doesn't include the changes made to the style since it
1229        loaded.
1230
1231        See `mln_map_get_loaded_style_json` in the
1232        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1233        """
1234        return self._native.get_loaded_style_json()

Reads the JSON of the style that the map loaded.

The JSON doesn't include the changes made to the style since it loaded.

See mln_map_get_loaded_style_json in the C API reference.

def get_snapshot(self) -> MapSnapshot:
1236    def get_snapshot(self) -> MapSnapshot:
1237        """Copies the map's state.
1238
1239        The copy doesn't wait for pending commands. To read the camera after
1240        they apply, use `MapHandle.get_camera()`.
1241
1242        See `mln_map_get_snapshot` in the
1243        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1244
1245        Errors:
1246
1247        - `Status.INVALID_STATE` until `RuntimeHandle.create_map()` completes
1248          with `Status.OK`.
1249        """
1250        return MapSnapshot._from_native(self._native.get_snapshot())

Copies the map's state.

The copy doesn't wait for pending commands. To read the camera after they apply, use MapHandle.get_camera().

See mln_map_get_snapshot in the C API reference.

Errors:

def get_style_image( self, image_id: str) -> concurrent.futures._base.Future[StyleImageInfo | None]:
1252    def get_style_image(self, image_id: str) -> Future[StyleImageInfo | None]:
1253        """Reads an image of the map's style.
1254
1255        Completes with no value when the style has no image named `image_id`.
1256
1257        See `mln_map_get_style_image` in the
1258        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1259        """
1260        return map_future(
1261            self._native.get_style_image(image_id),
1262            lambda value: _maybe(StyleImageInfo._from_native, value),
1263        )

Reads an image of the map's style.

Completes with no value when the style has no image named image_id.

See mln_map_get_style_image in the C API reference.

def get_style_layer( self, layer_id: str) -> concurrent.futures._base.Future[StyleLayerInfo | None]:
1265    def get_style_layer(self, layer_id: str) -> Future[StyleLayerInfo | None]:
1266        """Reads a layer of the map's style.
1267
1268        Completes with no value when the style has no layer named `layer_id`.
1269
1270        See `mln_map_get_style_layer` in the
1271        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1272        """
1273        return map_future(
1274            self._native.get_style_layer(layer_id),
1275            lambda value: _maybe(StyleLayerInfo._from_native, value),
1276        )

Reads a layer of the map's style.

Completes with no value when the style has no layer named layer_id.

See mln_map_get_style_layer in the C API reference.

def get_style_layer_json(self, layer_id: str) -> concurrent.futures._base.Future[typing.Any]:
1278    def get_style_layer_json(self, layer_id: str) -> Future[Any]:
1279        """Reads a layer of the map's style as a
1280        \\[layer\\](https://maplibre.org/maplibre-style-spec/layers/) object.
1281
1282        Completes with no value when the style has no layer named `layer_id`.
1283
1284        See `mln_map_get_style_layer_json` in the
1285        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1286        """
1287        return self._native.get_style_layer_json(layer_id)

Reads a layer of the map's style as a [layer](https://maplibre.org/maplibre-style-spec/layers/) object.

Completes with no value when the style has no layer named layer_id.

See mln_map_get_style_layer_json in the C API reference.

def get_style_layer_property( self, layer_id: str, property_name: str) -> concurrent.futures._base.Future[typing.Any]:
1289    def get_style_layer_property(
1290        self, layer_id: str, property_name: str
1291    ) -> Future[Any]:
1292        """Reads a property of a layer in the map's style.
1293
1294        The value can differ in form from the value that was set: a color set
1295        as `"#ff0000"` reads back as `["rgba", 255, 0, 0, 1]`.
1296
1297        Completes with no value when the layer doesn't set the property.
1298
1299        See `mln_map_get_style_layer_property` in the
1300        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1301
1302        Errors:
1303
1304        - `Status.NOT_FOUND` when the style has no layer named `layer_id`.
1305        """
1306        return self._native.get_style_layer_property(layer_id, property_name)

Reads a property of a layer in the map's style.

The value can differ in form from the value that was set: a color set as "#ff0000" reads back as ["rgba", 255, 0, 0, 1].

Completes with no value when the layer doesn't set the property.

See mln_map_get_style_layer_property in the C API reference.

Errors:

def get_style_light_property(self, property_name: str) -> concurrent.futures._base.Future[typing.Any]:
1308    def get_style_light_property(self, property_name: str) -> Future[Any]:
1309        """Reads a property of the light of the map's style.
1310
1311        The value can differ in form from the value that was set: a color set
1312        as `"#ff0000"` reads back as `["rgba", 255, 0, 0, 1]`.
1313
1314        Completes with no value when the light doesn't set the property.
1315
1316        See `mln_map_get_style_light_property` in the
1317        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1318        """
1319        return self._native.get_style_light_property(property_name)

Reads a property of the light of the map's style.

The value can differ in form from the value that was set: a color set as "#ff0000" reads back as ["rgba", 255, 0, 0, 1].

Completes with no value when the light doesn't set the property.

See mln_map_get_style_light_property in the C API reference.

def get_style_source( self, source_id: str) -> concurrent.futures._base.Future[StyleSourceInfo | None]:
1321    def get_style_source(self, source_id: str) -> Future[StyleSourceInfo | None]:
1322        """Reads a source of the map's style.
1323
1324        A tile source with a `url` has an empty attribution until its
1325        TileJSON loads, which raises `RuntimeEventType.MAP_SOURCE_CHANGED`.
1326
1327        Completes with no value when the style has no source named
1328        `source_id`.
1329
1330        See `mln_map_get_style_source` in the
1331        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1332        """
1333        return map_future(
1334            self._native.get_style_source(source_id),
1335            lambda value: _maybe(StyleSourceInfo._from_native, value),
1336        )

Reads a source of the map's style.

A tile source with a url has an empty attribution until its TileJSON loads, which raises RuntimeEventType.MAP_SOURCE_CHANGED.

Completes with no value when the style has no source named source_id.

See mln_map_get_style_source in the C API reference.

def get_style_transition_options( self) -> concurrent.futures._base.Future[StyleTransitionOptions]:
1338    def get_style_transition_options(self) -> Future[StyleTransitionOptions]:
1339        """Reads the default transition of the map's style.
1340
1341        See `mln_map_get_style_transition_options` in the
1342        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1343        """
1344        return map_future(
1345            self._native.get_style_transition_options(),
1346            lambda value: StyleTransitionOptions._from_native(value),
1347        )

Reads the default transition of the map's style.

See mln_map_get_style_transition_options in the C API reference.

def get_style_url(self) -> concurrent.futures._base.Future[str]:
1349    def get_style_url(self) -> Future[str]:
1350        """Reads the URL of the map's style.
1351
1352        The URL is empty when the style came from
1353        `MapHandle.set_style_json()`.
1354
1355        See `mln_map_get_style_url` in the
1356        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1357        """
1358        return self._native.get_style_url()

Reads the URL of the map's style.

The URL is empty when the style came from MapHandle.set_style_json().

See mln_map_get_style_url in the C API reference.

def invalidate_custom_geometry_source_region( self, source_id: str, bounds: LatLngBounds) -> concurrent.futures._base.Future[CommandCompletion]:
1360    def invalidate_custom_geometry_source_region(
1361        self, source_id: str, bounds: LatLngBounds
1362    ) -> Future[CommandCompletion]:
1363        """Makes a custom geometry source ask again for the tiles in `bounds`
1364        that the map still needs.
1365
1366        See `mln_map_invalidate_custom_geometry_source_region` in the
1367        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1368
1369        Errors:
1370
1371        - `Status.NOT_FOUND` when the style has no source named `source_id`.
1372        - `Status.INVALID_ARGUMENT` when the source named `source_id` isn't a
1373          custom geometry source.
1374        """
1375        return self._native.invalidate_custom_geometry_source_region(source_id, bounds)

Makes a custom geometry source ask again for the tiles in bounds that the map still needs.

See mln_map_invalidate_custom_geometry_source_region in the C API reference.

Errors:

def invalidate_custom_geometry_source_tile( self, source_id: str, tile_id: CanonicalTileId) -> concurrent.futures._base.Future[CommandCompletion]:
1377    def invalidate_custom_geometry_source_tile(
1378        self, source_id: str, tile_id: CanonicalTileId
1379    ) -> Future[CommandCompletion]:
1380        """Makes a custom geometry source ask for a tile again when the map
1381        needs it.
1382
1383        See `mln_map_invalidate_custom_geometry_source_tile` in the
1384        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1385
1386        Errors:
1387
1388        - `Status.NOT_FOUND` when the style has no source named `source_id`.
1389        - `Status.INVALID_ARGUMENT` when the source named `source_id` isn't a
1390          custom geometry source.
1391        """
1392        return self._native.invalidate_custom_geometry_source_tile(source_id, tile_id)

Makes a custom geometry source ask for a tile again when the map needs it.

See mln_map_invalidate_custom_geometry_source_tile in the C API reference.

Errors:

def invalidate_custom_vector_source_region( self, source_id: str, bounds: LatLngBounds) -> concurrent.futures._base.Future[CommandCompletion]:
1394    def invalidate_custom_vector_source_region(
1395        self, source_id: str, bounds: LatLngBounds
1396    ) -> Future[CommandCompletion]:
1397        """Makes a custom vector source ask again for the tiles in `bounds` that
1398        the map still needs.
1399
1400        See `mln_map_invalidate_custom_vector_source_region` in the
1401        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1402
1403        Errors:
1404
1405        - `Status.NOT_FOUND` when the style has no source named `source_id`.
1406        - `Status.INVALID_ARGUMENT` when the source named `source_id` isn't a
1407          custom vector source.
1408        """
1409        return self._native.invalidate_custom_vector_source_region(source_id, bounds)

Makes a custom vector source ask again for the tiles in bounds that the map still needs.

See mln_map_invalidate_custom_vector_source_region in the C API reference.

Errors:

def invalidate_custom_vector_source_tile( self, source_id: str, tile_id: CanonicalTileId) -> concurrent.futures._base.Future[CommandCompletion]:
1411    def invalidate_custom_vector_source_tile(
1412        self, source_id: str, tile_id: CanonicalTileId
1413    ) -> Future[CommandCompletion]:
1414        """Makes a custom vector source ask for a tile again when the map needs
1415        it.
1416
1417        See `mln_map_invalidate_custom_vector_source_tile` in the
1418        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1419
1420        Errors:
1421
1422        - `Status.NOT_FOUND` when the style has no source named `source_id`.
1423        - `Status.INVALID_ARGUMENT` when the source named `source_id` isn't a
1424          custom vector source.
1425        """
1426        return self._native.invalidate_custom_vector_source_tile(source_id, tile_id)

Makes a custom vector source ask for a tile again when the map needs it.

See mln_map_invalidate_custom_vector_source_tile in the C API reference.

Errors:

def lat_lng_bounds_for_camera( self, camera: CameraOptions) -> concurrent.futures._base.Future[LatLngBounds]:
1428    def lat_lng_bounds_for_camera(self, camera: CameraOptions) -> Future[LatLngBounds]:
1429        """Computes the area that the map would show with `camera`.
1430
1431        Camera fields that `camera` doesn't set come from the map's camera.
1432        The longitudes can fall outside -180 to 180, so a view across the
1433        antimeridian gives one continuous range.
1434
1435        See `mln_map_lat_lng_bounds_for_camera` in the
1436        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
1437        """
1438        return map_future(
1439            self._native.lat_lng_bounds_for_camera(camera),
1440            lambda value: LatLngBounds._from_native(value),
1441        )

Computes the area that the map would show with camera.

Camera fields that camera doesn't set come from the map's camera. The longitudes can fall outside -180 to 180, so a view across the antimeridian gives one continuous range.

See mln_map_lat_lng_bounds_for_camera in the C API reference.

def list_style_layers( self) -> concurrent.futures._base.Future[tuple[StyleLayerInfo, ...]]:
1443    def list_style_layers(self) -> Future[tuple[StyleLayerInfo, ...]]:
1444        """Lists the layers of the map's style, from bottom to top.
1445
1446        See `mln_map_list_style_layers` in the
1447        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1448        """
1449        return map_future(
1450            self._native.list_style_layers(),
1451            lambda value: tuple(StyleLayerInfo._from_native(item) for item in value),
1452        )

Lists the layers of the map's style, from bottom to top.

See mln_map_list_style_layers in the C API reference.

def list_style_sources( self) -> concurrent.futures._base.Future[tuple[StyleSourceInfo, ...]]:
1454    def list_style_sources(self) -> Future[tuple[StyleSourceInfo, ...]]:
1455        """Lists the sources of the map's style.
1456
1457        See `mln_map_list_style_sources` in the
1458        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1459        """
1460        return map_future(
1461            self._native.list_style_sources(),
1462            lambda value: tuple(StyleSourceInfo._from_native(item) for item in value),
1463        )

Lists the sources of the map's style.

See mln_map_list_style_sources in the C API reference.

def move_style_layer( self, layer_id: str, before_layer_id: str | None = None) -> concurrent.futures._base.Future[CommandCompletion]:
1465    def move_style_layer(
1466        self, layer_id: str, before_layer_id: str | None = None
1467    ) -> Future[CommandCompletion]:
1468        """Moves a layer of the map's style below the layer named
1469        `before_layer_id`, or above every layer when `before_layer_id` is
1470        empty.
1471
1472        See `mln_map_move_style_layer` in the
1473        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1474
1475        Errors:
1476
1477        - `Status.NOT_FOUND` when the style has no layer named `layer_id` or
1478          `before_layer_id`.
1479        - `Status.INVALID_STATE` while the style isn't loaded, as
1480          `MapHandle.set_style_url()` describes.
1481        """
1482        return self._native.move_style_layer(layer_id, before_layer_id)

Moves a layer of the map's style below the layer named before_layer_id, or above every layer when before_layer_id is empty.

See mln_map_move_style_layer in the C API reference.

Errors:

def release(self) -> concurrent.futures._base.Future[None]:
1484    def release(self) -> Future[None]:
1485        """Releases the map.
1486
1487        Detach the map's render session first.
1488
1489        See `mln_map_release` in the
1490        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1491        """
1492        return self._native.release()

Releases the map.

Detach the map's render session first.

See mln_map_release in the C API reference.

def remove_feature_state( self, selector: FeatureStateSelector) -> concurrent.futures._base.Future[CommandCompletion]:
1494    def remove_feature_state(
1495        self, selector: FeatureStateSelector
1496    ) -> Future[CommandCompletion]:
1497        """Removes the feature state that `selector` selects.
1498
1499        See `mln_map_remove_feature_state` in the
1500        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1501        """
1502        return self._native.remove_feature_state(selector)

Removes the feature state that selector selects.

See mln_map_remove_feature_state in the C API reference.

def remove_style_image( self, image_id: str) -> concurrent.futures._base.Future[CommandCompletion]:
1504    def remove_style_image(self, image_id: str) -> Future[CommandCompletion]:
1505        """Removes an image from the map's style.
1506
1507        See `mln_map_remove_style_image` in the
1508        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1509
1510        Errors:
1511
1512        - `Status.NOT_FOUND` when the style has no image named `image_id`.
1513        - `Status.INVALID_STATE` while the style isn't loaded, as
1514          `MapHandle.set_style_url()` describes.
1515        """
1516        return self._native.remove_style_image(image_id)

Removes an image from the map's style.

See mln_map_remove_style_image in the C API reference.

Errors:

def remove_style_layer( self, layer_id: str) -> concurrent.futures._base.Future[CommandCompletion]:
1518    def remove_style_layer(self, layer_id: str) -> Future[CommandCompletion]:
1519        """Removes a layer from the map's style.
1520
1521        See `mln_map_remove_style_layer` in the
1522        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1523
1524        Errors:
1525
1526        - `Status.NOT_FOUND` when the style has no layer named `layer_id`.
1527        - `Status.INVALID_STATE` while the style isn't loaded, as
1528          `MapHandle.set_style_url()` describes.
1529        """
1530        return self._native.remove_style_layer(layer_id)

Removes a layer from the map's style.

See mln_map_remove_style_layer in the C API reference.

Errors:

def remove_style_source( self, source_id: str) -> concurrent.futures._base.Future[CommandCompletion]:
1532    def remove_style_source(self, source_id: str) -> Future[CommandCompletion]:
1533        """Removes a source from the map's style.
1534
1535        See `mln_map_remove_style_source` in the
1536        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1537
1538        Errors:
1539
1540        - `Status.NOT_FOUND` when the style has no source named `source_id`.
1541        - `Status.INVALID_STATE` when a layer still uses the source, or while
1542          the style isn't loaded, as `MapHandle.set_style_url()` describes.
1543        """
1544        return self._native.remove_style_source(source_id)

Removes a source from the map's style.

See mln_map_remove_style_source in the C API reference.

Errors:

def request_repaint( self) -> concurrent.futures._base.Future[CommandCompletion]:
1546    def request_repaint(self) -> Future[CommandCompletion]:
1547        """Renders a new frame of a continuous map, even when nothing changed.
1548
1549        See `mln_map_request_repaint` in the
1550        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1551        """
1552        return self._native.request_repaint()

Renders a new frame of a continuous map, even when nothing changed.

See mln_map_request_repaint in the C API reference.

def request_still_image(self) -> concurrent.futures._base.Future[None]:
1554    def request_still_image(self) -> Future[None]:
1555        """Renders a still image of a static or tile map.
1556
1557        The map's render session draws the image once every resource that the
1558        image needs has loaded.
1559
1560        See `mln_map_request_still_image` in the
1561        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1562
1563        Errors:
1564
1565        - `Status.CANCELLED` when the map is released before the image is
1566          done.
1567        - `Status.NATIVE_ERROR` when the style or a resource that the image
1568          needs fails to load.
1569        """
1570        return self._native.request_still_image()

Renders a still image of a static or tile map.

The map's render session draws the image once every resource that the image needs has loaded.

See mln_map_request_still_image in the C API reference.

Errors:

def resize( self, logical_size: LogicalSize) -> concurrent.futures._base.Future[CommandCompletion]:
1572    def resize(self, logical_size: LogicalSize) -> Future[CommandCompletion]:
1573        """Sets the map's size.
1574
1575        A map with a render session takes its size from the session, so
1576        resize the session with `RenderSessionHandle.resize()` instead.
1577
1578        See `mln_map_resize` in the
1579        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1580
1581        Errors:
1582
1583        - `Status.INVALID_STATE` when the map has a render session.
1584        - `Status.INVALID_STATE` when a render session attached to the map
1585          before the resize applied.
1586        """
1587        return self._native.resize(logical_size)

Sets the map's size.

A map with a render session takes its size from the session, so resize the session with RenderSessionHandle.resize() instead.

See mln_map_resize in the C API reference.

Errors:

def set_bounds( self, options: BoundOptions) -> concurrent.futures._base.Future[CommandCompletion]:
1589    def set_bounds(self, options: BoundOptions) -> Future[CommandCompletion]:
1590        """Limits the camera's center to an area, and its zoom and pitch to
1591        ranges.
1592
1593        Limits that `options` doesn't set keep their current values. When the
1594        camera is outside the new limits, it moves inside them.
1595
1596        See `mln_map_set_bounds` in the
1597        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
1598        """
1599        return self._native.set_bounds(options)

Limits the camera's center to an area, and its zoom and pitch to ranges.

Limits that options doesn't set keep their current values. When the camera is outside the new limits, it moves inside them.

See mln_map_set_bounds in the C API reference.

def set_custom_geometry_source_tile_data( self, source_id: str, tile_id: CanonicalTileId, data: Any) -> concurrent.futures._base.Future[CommandCompletion]:
1601    def set_custom_geometry_source_tile_data(
1602        self, source_id: str, tile_id: CanonicalTileId, data: Any
1603    ) -> Future[CommandCompletion]:
1604        """Sets the data of a tile in a custom geometry source.
1605
1606        `data` is a GeoJSON feature collection, feature, or geometry. The
1607        source ignores data for a tile that it hasn't asked for, or has since
1608        cancelled.
1609
1610        See `mln_map_set_custom_geometry_source_tile_data` in the
1611        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1612
1613        Errors:
1614
1615        - `Status.NOT_FOUND` when the style has no source named `source_id`.
1616        - `Status.INVALID_ARGUMENT` when the source named `source_id` isn't a
1617          custom geometry source.
1618        """
1619        return self._native.set_custom_geometry_source_tile_data(
1620            source_id, tile_id, data
1621        )

Sets the data of a tile in a custom geometry source.

data is a GeoJSON feature collection, feature, or geometry. The source ignores data for a tile that it hasn't asked for, or has since cancelled.

See mln_map_set_custom_geometry_source_tile_data in the C API reference.

Errors:

def set_custom_geometry_source_tile_error( self, source_id: str, tile_id: CanonicalTileId, message: str) -> concurrent.futures._base.Future[CommandCompletion]:
1623    def set_custom_geometry_source_tile_error(
1624        self, source_id: str, tile_id: CanonicalTileId, message: str
1625    ) -> Future[CommandCompletion]:
1626        """Reports that a tile of a custom geometry source failed to load.
1627
1628        See `mln_map_set_custom_geometry_source_tile_error` in the
1629        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1630
1631        Errors:
1632
1633        - `Status.NOT_FOUND` when the style has no source named `source_id`.
1634        - `Status.INVALID_ARGUMENT` when the source named `source_id` isn't a
1635          custom geometry source.
1636        """
1637        return self._native.set_custom_geometry_source_tile_error(
1638            source_id, tile_id, message
1639        )

Reports that a tile of a custom geometry source failed to load.

See mln_map_set_custom_geometry_source_tile_error in the C API reference.

Errors:

def set_custom_vector_source_tile_data( self, source_id: str, tile_id: CanonicalTileId, encoding: StyleVectorTileEncoding, data: Buffer) -> concurrent.futures._base.Future[CommandCompletion]:
1641    def set_custom_vector_source_tile_data(
1642        self,
1643        source_id: str,
1644        tile_id: CanonicalTileId,
1645        encoding: StyleVectorTileEncoding,
1646        data: Buffer,
1647    ) -> Future[CommandCompletion]:
1648        """Sets the data of a tile in a custom vector source.
1649
1650        `data` is the tile, encoded as `encoding`. The source ignores data
1651        for a tile that it hasn't asked for, or has since cancelled.
1652
1653        See `mln_map_set_custom_vector_source_tile_data` in the
1654        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1655
1656        Errors:
1657
1658        - `Status.NOT_FOUND` when the style has no source named `source_id`.
1659        - `Status.INVALID_ARGUMENT` when the source named `source_id` isn't a
1660          custom vector source.
1661        """
1662        return self._native.set_custom_vector_source_tile_data(
1663            source_id, tile_id, encoding, data
1664        )

Sets the data of a tile in a custom vector source.

data is the tile, encoded as encoding. The source ignores data for a tile that it hasn't asked for, or has since cancelled.

See mln_map_set_custom_vector_source_tile_data in the C API reference.

Errors:

def set_custom_vector_source_tile_error( self, source_id: str, tile_id: CanonicalTileId, message: str) -> concurrent.futures._base.Future[CommandCompletion]:
1666    def set_custom_vector_source_tile_error(
1667        self, source_id: str, tile_id: CanonicalTileId, message: str
1668    ) -> Future[CommandCompletion]:
1669        """Reports that a tile of a custom vector source failed to load.
1670
1671        See `mln_map_set_custom_vector_source_tile_error` in the
1672        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1673
1674        Errors:
1675
1676        - `Status.NOT_FOUND` when the style has no source named `source_id`.
1677        - `Status.INVALID_ARGUMENT` when the source named `source_id` isn't a
1678          custom vector source.
1679        """
1680        return self._native.set_custom_vector_source_tile_error(
1681            source_id, tile_id, message
1682        )

Reports that a tile of a custom vector source failed to load.

See mln_map_set_custom_vector_source_tile_error in the C API reference.

Errors:

def set_debug_flags( self, flags: MapDebugFlag) -> concurrent.futures._base.Future[CommandCompletion]:
1684    def set_debug_flags(self, flags: MapDebugFlag) -> Future[CommandCompletion]:
1685        """Draws debugging overlays, such as tile borders, on the map.
1686
1687        `flags` replaces the overlays set before.
1688
1689        See `mln_map_set_debug_flags` in the
1690        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
1691        """
1692        return self._native.set_debug_flags(flags)

Draws debugging overlays, such as tile borders, on the map.

flags replaces the overlays set before.

See mln_map_set_debug_flags in the C API reference.

def set_event_mask( self, mask: RuntimeEventFlag) -> concurrent.futures._base.Future[CommandCompletion]:
1694    def set_event_mask(self, mask: RuntimeEventFlag) -> Future[CommandCompletion]:
1695        """Selects the events that the map reports.
1696
1697        See `mln_map_set_event_mask` in the
1698        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1699        """
1700        return self._native.set_event_mask(mask)

Selects the events that the map reports.

See mln_map_set_event_mask in the C API reference.

def set_feature_state( self, selector: FeatureStateSelector, state: Any) -> concurrent.futures._base.Future[CommandCompletion]:
1702    def set_feature_state(
1703        self, selector: FeatureStateSelector, state: Any
1704    ) -> Future[CommandCompletion]:
1705        """Merges `state` into the state of a feature.
1706
1707        `state` is a JSON object. Its keys replace the same keys in the
1708        feature's state, and the other keys stay.
1709
1710        See `mln_map_set_feature_state` in the
1711        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1712        """
1713        return self._native.set_feature_state(selector, state)

Merges state into the state of a feature.

state is a JSON object. Its keys replace the same keys in the feature's state, and the other keys stay.

See mln_map_set_feature_state in the C API reference.

def set_free_camera_options( self, options: FreeCameraOptions) -> concurrent.futures._base.Future[CommandCompletion]:
1715    def set_free_camera_options(
1716        self, options: FreeCameraOptions
1717    ) -> Future[CommandCompletion]:
1718        """Places the camera at a position and orientation in space.
1719
1720        The map adjusts them to a camera that it can show. It stops running
1721        camera animations first, and their end handlers report
1722        `CameraTransitionOutcome.CANCELLED`.
1723
1724        See `mln_map_set_free_camera_options` in the
1725        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
1726        """
1727        return self._native.set_free_camera_options(options)

Places the camera at a position and orientation in space.

The map adjusts them to a camera that it can show. It stops running camera animations first, and their end handlers report CameraTransitionOutcome.CANCELLED.

See mln_map_set_free_camera_options in the C API reference.

def set_geo_json_source_data( self, source_id: str, data: Any) -> concurrent.futures._base.Future[CommandCompletion]:
1729    def set_geo_json_source_data(
1730        self, source_id: str, data: Any
1731    ) -> Future[CommandCompletion]:
1732        """Replaces the data of a GeoJSON source.
1733
1734        `data` is a GeoJSON feature collection, feature, or geometry. The
1735        library prepares it for the source with the source's options, off the
1736        threads that the caller and the runtime use, and the command
1737        completes once the source holds it. Later commands don't wait for it.
1738        While the source is still preparing earlier data, only the newest
1739        data waits to follow it.
1740
1741        With synchronous tiling on, as
1742        `MapHandle.set_geo_json_source_synchronous_tiling()` describes, the
1743        command prepares `data` before later commands run, so the data shows
1744        in the next frame.
1745
1746        See `mln_map_set_geo_json_source_data` in the
1747        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1748
1749        Errors:
1750
1751        - `Status.NOT_FOUND` when the style has no source named `source_id`.
1752        - `Status.INVALID_ARGUMENT` when the source named `source_id` isn't a
1753          GeoJSON source, when `data` isn't valid GeoJSON, or when the source
1754          clusters and `data` isn't a feature collection of points. The
1755          source keeps its data.
1756        - `Status.CANCELLED` when newer data for the source replaces `data`
1757          while it waits, or when the source's URL, its removal, a style
1758          load, or the map's release replaces the source's data before `data`
1759          is ready.
1760        - `Status.INVALID_STATE` while the style isn't loaded, as
1761          `MapHandle.set_style_url()` describes.
1762        """
1763        return self._native.set_geo_json_source_data(source_id, data)

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 MapHandle.set_geo_json_source_synchronous_tiling() 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.

Errors:

  • Status.NOT_FOUND when the style has no source named source_id.
  • Status.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.
  • Status.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.
  • Status.INVALID_STATE while the style isn't loaded, as MapHandle.set_style_url() describes.
def set_geo_json_source_synchronous_tiling( self, source_id: str, enabled: bool) -> concurrent.futures._base.Future[CommandCompletion]:
1765    def set_geo_json_source_synchronous_tiling(
1766        self, source_id: str, enabled: bool
1767    ) -> Future[CommandCompletion]:
1768        """Sets whether a GeoJSON source builds its tiles while the map renders.
1769
1770        Building tiles while the map renders, instead of in the background,
1771        makes new data show in the next frame. The setting replaces the
1772        `synchronousUpdate` member of the source's JSON, which defaults to
1773        false.
1774
1775        See `mln_map_set_geo_json_source_synchronous_tiling` in the
1776        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1777
1778        Errors:
1779
1780        - `Status.NOT_FOUND` when the style has no source named `source_id`.
1781        - `Status.INVALID_ARGUMENT` when the source named `source_id` isn't a
1782          GeoJSON source.
1783        - `Status.INVALID_STATE` while the style isn't loaded, as
1784          `MapHandle.set_style_url()` describes.
1785        """
1786        return self._native.set_geo_json_source_synchronous_tiling(source_id, enabled)

Sets whether a GeoJSON source builds its tiles while the map renders.

Building tiles while the map renders, instead of in the background, makes new data show in the next frame. The setting replaces the synchronousUpdate member of the source's JSON, which defaults to false.

See mln_map_set_geo_json_source_synchronous_tiling in the C API reference.

Errors:

def set_geo_json_source_url( self, source_id: str, url: str) -> concurrent.futures._base.Future[CommandCompletion]:
1788    def set_geo_json_source_url(
1789        self, source_id: str, url: str
1790    ) -> Future[CommandCompletion]:
1791        """Makes a GeoJSON source load its data from `url`.
1792
1793        See `mln_map_set_geo_json_source_url` in the
1794        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1795
1796        Errors:
1797
1798        - `Status.NOT_FOUND` when the style has no source named `source_id`.
1799        - `Status.INVALID_ARGUMENT` when the source named `source_id` isn't a
1800          GeoJSON source.
1801        - `Status.INVALID_STATE` while the style isn't loaded, as
1802          `MapHandle.set_style_url()` describes.
1803        """
1804        return self._native.set_geo_json_source_url(source_id, url)

Makes a GeoJSON source load its data from url.

See mln_map_set_geo_json_source_url in the C API reference.

Errors:

def set_global_state_property( self, property_name: str, value: Any) -> concurrent.futures._base.Future[CommandCompletion]:
1806    def set_global_state_property(
1807        self, property_name: str, value: Any
1808    ) -> Future[CommandCompletion]:
1809        """Sets a value that the style's `global-state`
1810        \\[expressions\\](https://maplibre.org/maplibre-style-spec/expressions/)
1811        read.
1812
1813        See `mln_map_set_global_state_property` in the
1814        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1815
1816        Errors:
1817
1818        - `Status.INVALID_STATE` while the style isn't loaded, as
1819          `MapHandle.set_style_url()` describes.
1820        """
1821        return self._native.set_global_state_property(property_name, value)

Sets a value that the style's global-state [expressions](https://maplibre.org/maplibre-style-spec/expressions/) read.

See mln_map_set_global_state_property in the C API reference.

Errors:

def set_image_source_coordinates( self, source_id: str, coordinates: Sequence[LatLng]) -> concurrent.futures._base.Future[CommandCompletion]:
1823    def set_image_source_coordinates(
1824        self, source_id: str, coordinates: Sequence[LatLng]
1825    ) -> Future[CommandCompletion]:
1826        """Moves the image of an image source.
1827
1828        `coordinates` are the image's four corners, clockwise from the top
1829        left.
1830
1831        See `mln_map_set_image_source_coordinates` in the
1832        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1833
1834        Errors:
1835
1836        - `Status.NOT_FOUND` when the style has no source named `source_id`.
1837        - `Status.INVALID_ARGUMENT` when the source named `source_id` isn't
1838          an image source.
1839        - `Status.INVALID_STATE` while the style isn't loaded, as
1840          `MapHandle.set_style_url()` describes.
1841        """
1842        return self._native.set_image_source_coordinates(source_id, coordinates)

Moves the image of an image source.

coordinates are the image's four corners, clockwise from the top left.

See mln_map_set_image_source_coordinates in the C API reference.

Errors:

def set_image_source_image( self, source_id: str, image: PremultipliedRgba8Image) -> concurrent.futures._base.Future[CommandCompletion]:
1844    def set_image_source_image(
1845        self, source_id: str, image: PremultipliedRgba8Image
1846    ) -> Future[CommandCompletion]:
1847        """Replaces the image of an image source.
1848
1849        See `mln_map_set_image_source_image` in the
1850        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1851
1852        Errors:
1853
1854        - `Status.NOT_FOUND` when the style has no source named `source_id`.
1855        - `Status.INVALID_ARGUMENT` when the source named `source_id` isn't
1856          an image source.
1857        - `Status.INVALID_STATE` while the style isn't loaded, as
1858          `MapHandle.set_style_url()` describes.
1859        """
1860        return self._native.set_image_source_image(source_id, image)

Replaces the image of an image source.

See mln_map_set_image_source_image in the C API reference.

Errors:

def set_image_source_url( self, source_id: str, url: str) -> concurrent.futures._base.Future[CommandCompletion]:
1862    def set_image_source_url(
1863        self, source_id: str, url: str
1864    ) -> Future[CommandCompletion]:
1865        """Makes an image source load its image from `url`.
1866
1867        See `mln_map_set_image_source_url` in the
1868        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1869
1870        Errors:
1871
1872        - `Status.NOT_FOUND` when the style has no source named `source_id`.
1873        - `Status.INVALID_ARGUMENT` when the source named `source_id` isn't
1874          an image source.
1875        - `Status.INVALID_STATE` while the style isn't loaded, as
1876          `MapHandle.set_style_url()` describes.
1877        """
1878        return self._native.set_image_source_url(source_id, url)

Makes an image source load its image from url.

See mln_map_set_image_source_url in the C API reference.

Errors:

def set_projection_mode( self, options: ProjectionModeOptions) -> concurrent.futures._base.Future[CommandCompletion]:
1880    def set_projection_mode(
1881        self, options: ProjectionModeOptions
1882    ) -> Future[CommandCompletion]:
1883        """Sets whether the map draws in perspective or axonometric projection,
1884        and how much it skews the view.
1885
1886        Settings that `options` doesn't set keep their current values.
1887
1888        See `mln_map_set_projection_mode` in the
1889        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
1890        """
1891        return self._native.set_projection_mode(options)

Sets whether the map draws in perspective or axonometric projection, and how much it skews the view.

Settings that options doesn't set keep their current values.

See mln_map_set_projection_mode in the C API reference.

def set_rendering_stats_view_enabled( self, enabled: bool) -> concurrent.futures._base.Future[CommandCompletion]:
1893    def set_rendering_stats_view_enabled(
1894        self, enabled: bool
1895    ) -> Future[CommandCompletion]:
1896        """Shows or hides an overlay of rendering statistics on the map.
1897
1898        See `mln_map_set_rendering_stats_view_enabled` in the
1899        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
1900        """
1901        return self._native.set_rendering_stats_view_enabled(enabled)

Shows or hides an overlay of rendering statistics on the map.

See mln_map_set_rendering_stats_view_enabled in the C API reference.

def set_style_image( self, image_id: str, image: PremultipliedRgba8Image, options: StyleImageOptions | None = None) -> concurrent.futures._base.Future[CommandCompletion]:
1903    def set_style_image(
1904        self,
1905        image_id: str,
1906        image: PremultipliedRgba8Image,
1907        options: StyleImageOptions | None = None,
1908    ) -> Future[CommandCompletion]:
1909        """Adds an image to the map's style, or replaces the image named
1910        `image_id`.
1911
1912        See `mln_map_set_style_image` in the
1913        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1914
1915        Errors:
1916
1917        - `Status.INVALID_STATE` while the style isn't loaded, as
1918          `MapHandle.set_style_url()` describes.
1919        """
1920        return self._native.set_style_image(image_id, image, options)

Adds an image to the map's style, or replaces the image named image_id.

See mln_map_set_style_image in the C API reference.

Errors:

def set_style_json( self, json: Any) -> concurrent.futures._base.Future[CommandCompletion]:
1922    def set_style_json(self, json: Any) -> Future[CommandCompletion]:
1923        """Loads the map's style from `json`.
1924
1925        The command completes once the style has parsed, and the map's style
1926        is then loaded, as `MapHandle.set_style_url()` describes. The style's
1927        sources, sprites, and glyphs load in the background.
1928
1929        See `mln_map_set_style_json` in the
1930        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1931
1932        Errors:
1933
1934        - `Status.NATIVE_ERROR` when `json` isn't a valid style. The map
1935          keeps its current style.
1936        """
1937        return self._native.set_style_json(json)

Loads the map's style from json.

The command completes once the style has parsed, and the map's style is then loaded, as MapHandle.set_style_url() describes. The style's sources, sprites, and glyphs load in the background.

See mln_map_set_style_json in the C API reference.

Errors:

def set_style_layer_property( self, layer_id: str, property_name: str, value: Any) -> concurrent.futures._base.Future[CommandCompletion]:
1939    def set_style_layer_property(
1940        self, layer_id: str, property_name: str, value: Any
1941    ) -> Future[CommandCompletion]:
1942        """Sets a property of a layer in the map's style.
1943
1944        `property_name` is one of the layer's layout or paint
1945        \\[properties\\](https://maplibre.org/maplibre-style-spec/layers/), or
1946        `filter`, `minzoom`, `maxzoom`, `source`, or `source-layer`. A null
1947        `value` resets any of these but `source` and `source-layer` to its
1948        default.
1949
1950        See `mln_map_set_style_layer_property` in the
1951        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1952
1953        Errors:
1954
1955        - `Status.NOT_FOUND` when the style has no layer named `layer_id`.
1956        - `Status.INVALID_STATE` while the style isn't loaded, as
1957          `MapHandle.set_style_url()` describes.
1958        """
1959        return self._native.set_style_layer_property(layer_id, property_name, value)

Sets a property of a layer in the map's style.

property_name is one of the layer's layout or paint [properties](https://maplibre.org/maplibre-style-spec/layers/), or filter, minzoom, maxzoom, source, or source-layer. A null value resets any of these but source and source-layer to its default.

See mln_map_set_style_layer_property in the C API reference.

Errors:

def set_style_light_json( self, light_json: Any) -> concurrent.futures._base.Future[CommandCompletion]:
1961    def set_style_light_json(self, light_json: Any) -> Future[CommandCompletion]:
1962        """Replaces the
1963        \\[light\\](https://maplibre.org/maplibre-style-spec/light/) of the
1964        map's style.
1965
1966        See `mln_map_set_style_light_json` in the
1967        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1968
1969        Errors:
1970
1971        - `Status.INVALID_STATE` while the style isn't loaded, as
1972          `MapHandle.set_style_url()` describes.
1973        """
1974        return self._native.set_style_light_json(light_json)

Replaces the [light](https://maplibre.org/maplibre-style-spec/light/) of the map's style.

See mln_map_set_style_light_json in the C API reference.

Errors:

def set_style_light_property( self, property_name: str, value: Any) -> concurrent.futures._base.Future[CommandCompletion]:
1976    def set_style_light_property(
1977        self, property_name: str, value: Any
1978    ) -> Future[CommandCompletion]:
1979        """Sets a property of the light of the map's style.
1980
1981        See `mln_map_set_style_light_property` in the
1982        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1983
1984        Errors:
1985
1986        - `Status.INVALID_STATE` while the style isn't loaded, as
1987          `MapHandle.set_style_url()` describes.
1988        """
1989        return self._native.set_style_light_property(property_name, value)

Sets a property of the light of the map's style.

See mln_map_set_style_light_property in the C API reference.

Errors:

def set_style_source_volatile( self, source_id: str, is_volatile: bool) -> concurrent.futures._base.Future[CommandCompletion]:
1991    def set_style_source_volatile(
1992        self, source_id: str, is_volatile: bool
1993    ) -> Future[CommandCompletion]:
1994        """Sets whether a source is volatile.
1995
1996        The map doesn't store the tiles of a volatile source in the
1997        persistent cache.
1998
1999        See `mln_map_set_style_source_volatile` in the
2000        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
2001
2002        Errors:
2003
2004        - `Status.NOT_FOUND` when the style has no source named `source_id`.
2005        - `Status.INVALID_STATE` while the style isn't loaded, as
2006          `MapHandle.set_style_url()` describes.
2007        """
2008        return self._native.set_style_source_volatile(source_id, is_volatile)

Sets whether a source is volatile.

The map doesn't store the tiles of a volatile source in the persistent cache.

See mln_map_set_style_source_volatile in the C API reference.

Errors:

def set_style_transition_options( self, options: StyleTransitionOptions) -> concurrent.futures._base.Future[CommandCompletion]:
2010    def set_style_transition_options(
2011        self, options: StyleTransitionOptions
2012    ) -> Future[CommandCompletion]:
2013        """Sets the default transition of the map's style.
2014
2015        See `mln_map_set_style_transition_options` in the
2016        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
2017
2018        Errors:
2019
2020        - `Status.INVALID_STATE` while the style isn't loaded, as
2021          `MapHandle.set_style_url()` describes.
2022        """
2023        return self._native.set_style_transition_options(options)

Sets the default transition of the map's style.

See mln_map_set_style_transition_options in the C API reference.

Errors:

def set_style_url( self, url: str) -> concurrent.futures._base.Future[CommandCompletion]:
2025    def set_style_url(self, url: str) -> Future[CommandCompletion]:
2026        """Loads the map's style from `url`.
2027
2028        The command completes once the style document has loaded and parsed.
2029        The style's sources, sprites, and glyphs then load in the background.
2030
2031        The map's style is loaded from the time a style document parses until
2032        the next call to this function. While the style isn't loaded, the
2033        commands that change it complete with `Status.INVALID_STATE`. To
2034        change a new map's style without a style document, first load an
2035        empty style, such as `{"version":8,"sources":{},"layers":[]}`.
2036
2037        See `mln_map_set_style_url` in the
2038        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
2039
2040        Errors:
2041
2042        - `Status.NATIVE_ERROR` when the style document fails to load or
2043          isn't a valid style.
2044        - `Status.CANCELLED` when the map is released, or this function or
2045          `MapHandle.set_style_json()` loads another style, before the style
2046          document parses.
2047        """
2048        return self._native.set_style_url(url)

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 Status.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.

Errors:

def set_tile_options( self, options: MapTileOptions) -> concurrent.futures._base.Future[CommandCompletion]:
2050    def set_tile_options(self, options: MapTileOptions) -> Future[CommandCompletion]:
2051        """Sets how the map chooses which tiles to load, and at what detail.
2052
2053        Settings that `options` doesn't set keep their current values.
2054
2055        See `mln_map_set_tile_options` in the
2056        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
2057        """
2058        return self._native.set_tile_options(options)

Sets how the map chooses which tiles to load, and at what detail.

Settings that options doesn't set keep their current values.

See mln_map_set_tile_options in the C API reference.

def set_viewport_options( self, options: MapViewportOptions) -> concurrent.futures._base.Future[CommandCompletion]:
2060    def set_viewport_options(
2061        self, options: MapViewportOptions
2062    ) -> Future[CommandCompletion]:
2063        """Sets how the map orients and constrains its view.
2064
2065        Settings that `options` doesn't set keep their current values.
2066
2067        See `mln_map_set_viewport_options` in the
2068        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
2069        """
2070        return self._native.set_viewport_options(options)

Sets how the map orients and constrains its view.

Settings that options doesn't set keep their current values.

See mln_map_set_viewport_options in the C API reference.

def update_camera( self, update: CameraUpdate) -> concurrent.futures._base.Future[CommandCompletion]:
2072    def update_camera(self, update: CameraUpdate) -> Future[CommandCompletion]:
2073        """Moves the camera, at once or with an animation.
2074
2075        Camera fields that `update` doesn't set keep their values, and the
2076        update stops any running animation of the fields it sets. The
2077        function finishes when the map applies the update, before an
2078        animation ends. To learn when an animation ends, set an
2079        `CameraTransitionHandler` in its animation options.
2080
2081        See `mln_map_update_camera` in the
2082        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
2083        """
2084        return self._native.update_camera(update)

Moves the camera, at once or with an animation.

Camera fields that update doesn't set keep their values, and the update stops any running animation of the fields it sets. The function finishes when the map applies the update, before an animation ends. To learn when an animation ends, set an CameraTransitionHandler in its animation options.

See mln_map_update_camera in the C API reference.

ready: concurrent.futures._base.Future[None]
 97    @property
 98    def ready(self) -> Future[None]:
 99        """Completes once the map is ready, and fails with `MaplibreError` when it
100        fails to become ready. Asynchronous calls on the map before then wait
101        for it."""
102        return self._ready

Completes once the map is ready, and fails with MaplibreError when it fails to become ready. Asynchronous calls on the map before then wait for it.

id: int
104    @property
105    def id(self) -> int:
106        """The native handle value, which runtime events report as their source.
107
108        It stays readable after release, so events drained later still match
109        the handle that produced them.
110        """
111        return int(self._native.id)

The native handle value, which runtime events report as their source.

It stays readable after release, so events drained later still match the handle that produced them.

def dispose(self) -> None:
113    def dispose(self) -> None:
114        """Releases the map in any state, and finishes in the background.
115
116        Use it from destructors and finalizers. Otherwise, use
117        `MapHandle.release()`.
118
119        See `mln_map_dispose` in the
120        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
121        """
122        self._native._dispose()

Releases the map in any state, and finishes in the background.

Use it from destructors and finalizers. Otherwise, use MapHandle.release().

See mln_map_dispose in the C API reference.

class MapHandleDiscarding:
3660class MapHandleDiscarding:
3661    __slots__ = ("_native",)
3662    _native: _native._MapHandle
3663
3664    def __init__(self, owner: _MapHandleOperations):
3665        self._native = owner._native
3666
3667    def add_custom_geometry_source(
3668        self, source_id: str, options: CustomGeometrySourceOptions
3669    ) -> None:
3670        """Adds a source whose GeoJSON tiles come from callbacks.
3671
3672        See `mln_map_add_custom_geometry_source` in the
3673        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3674        """
3675        return self._native._discard_add_custom_geometry_source(source_id, options)
3676
3677    def add_custom_vector_source(
3678        self, source_id: str, options: CustomVectorSourceOptions
3679    ) -> None:
3680        """Adds a source whose vector tiles come from callbacks.
3681
3682        See `mln_map_add_custom_vector_source` in the
3683        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3684        """
3685        return self._native._discard_add_custom_vector_source(source_id, options)
3686
3687    def add_geo_json_source(
3688        self,
3689        source_id: str,
3690        options: GeoJsonSourceOptions | None = None,
3691        attribution: str | None = None,
3692    ) -> None:
3693        """Adds a GeoJSON source with no data.
3694
3695        Give it data with `MapHandle.set_geo_json_source_data()` or
3696        `MapHandle.set_geo_json_source_url()`. Its options stay fixed for as
3697        long as the style holds it.
3698
3699        `attribution` is the source's
3700        \\[attribution\\](https://maplibre.org/maplibre-style-spec/sources/#attribution),
3701        or empty for none.
3702
3703        See `mln_map_add_geo_json_source` in the
3704        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3705
3706        Errors:
3707
3708        - `Status.INVALID_ARGUMENT` when an option in `options` is out of
3709          range.
3710        """
3711        return self._native._discard_add_geo_json_source(
3712            source_id, options, attribution
3713        )
3714
3715    def add_image_source_image(
3716        self,
3717        source_id: str,
3718        coordinates: Sequence[LatLng],
3719        image: PremultipliedRgba8Image,
3720    ) -> None:
3721        """Adds an image source that shows `image`.
3722
3723        `coordinates` are the image's four corners, clockwise from the top
3724        left.
3725
3726        See `mln_map_add_image_source_image` in the
3727        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3728        """
3729        return self._native._discard_add_image_source_image(
3730            source_id, coordinates, image
3731        )
3732
3733    def add_style_layer_json(
3734        self, layer_json: Any, before_layer_id: str | None = None
3735    ) -> None:
3736        """Adds a layer to the map's style.
3737
3738        `layer_json` is a
3739        \\[layer\\](https://maplibre.org/maplibre-style-spec/layers/) object.
3740        The layer goes below the layer named `before_layer_id`, or above
3741        every layer when `before_layer_id` is empty.
3742
3743        See `mln_map_add_style_layer_json` in the
3744        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3745        """
3746        return self._native._discard_add_style_layer_json(layer_json, before_layer_id)
3747
3748    def add_style_source_json(self, source_id: str, source_json: Any) -> None:
3749        """Adds a source to the map's style.
3750
3751        `source_json` is a
3752        \\[source\\](https://maplibre.org/maplibre-style-spec/sources/) object.
3753
3754        See `mln_map_add_style_source_json` in the
3755        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3756        """
3757        return self._native._discard_add_style_source_json(source_id, source_json)
3758
3759    def apply_camera_delta(self, delta: CameraDelta) -> None:
3760        """Moves the camera relative to where it is, as a gesture does.
3761
3762        `delta` can pan the map's content by an offset on the screen, scale
3763        the zoom, and add to the bearing and pitch. An anchor keeps one
3764        screen point in place while the scale, bearing, or pitch changes. An
3765        anchor needs one of those changes, and combines with an offset only
3766        when the delta has no animation. The function finishes when the map
3767        applies the delta, before an animation ends.
3768
3769        A delta that replaces an animated one starts from where that
3770        animation left the camera, so the rest of the replaced change never
3771        happens. To reach an exact camera, use `MapHandle.update_camera()`.
3772
3773        A delta in the end phase can carry momentum, which keeps the camera
3774        moving from the gesture's release velocities and slows it on each
3775        rendered frame. The gesture lasts until the momentum ends: the
3776        snapshot keeps `gesture_in_progress` set, and camera events report
3777        `CameraChangeSource.MOMENTUM`. With momentum, `animation` sets only
3778        `transition_id` and the end handler, which runs when the gesture
3779        ends.
3780
3781        A delta in the begin phase, `MapHandle.cancel_camera_transitions()`,
3782        or a cancellation by that ID stops the momentum. A later command that
3783        sets a field stops only the parts of the momentum that move that
3784        field. On a tilted map, the pan moves the map's content the same
3785        distance on the screen in every direction.
3786
3787        See `mln_map_apply_camera_delta` in the
3788        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
3789        """
3790        return self._native._discard_apply_camera_delta(delta)
3791
3792    def begin_command_group(self) -> None:
3793        """Holds back the map's changes from rendering until
3794        `MapHandle.end_command_group()`, so they show in the same frame.
3795
3796        Groups nest, and the changes render when the outermost group ends.
3797
3798        See `mln_map_begin_command_group` in the
3799        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3800        """
3801        return self._native._discard_begin_command_group()
3802
3803    def cancel_camera_transitions(self) -> None:
3804        """Stops every running camera animation where it is.
3805
3806        The end handler of each stopped animation reports
3807        `CameraTransitionOutcome.CANCELLED`.
3808
3809        See `mln_map_cancel_camera_transitions` in the
3810        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
3811        """
3812        return self._native._discard_cancel_camera_transitions()
3813
3814    def cancel_camera_transitions_with_id(self, transition_id: int) -> None:
3815        """Stops the running camera animations whose animation options set
3816        `transition_id`.
3817
3818        Other animations keep running. The end handler of each stopped
3819        animation reports `CameraTransitionOutcome.CANCELLED`.
3820
3821        See `mln_map_cancel_camera_transitions_with_id` in the
3822        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
3823        """
3824        return self._native._discard_cancel_camera_transitions_with_id(transition_id)
3825
3826    def dump_debug_logs(self) -> None:
3827        """Logs debugging information about the map's style and sources.
3828
3829        See `mln_map_dump_debug_logs` in the
3830        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
3831        """
3832        return self._native._discard_dump_debug_logs()
3833
3834    def end_command_group(self) -> None:
3835        """Ends the group that `MapHandle.begin_command_group()` began.
3836
3837        See `mln_map_end_command_group` in the
3838        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3839        """
3840        return self._native._discard_end_command_group()
3841
3842    def fit_camera_to_geometry(self, geometry: Any, update: CameraFitUpdate) -> None:
3843        """Moves the camera to fit a GeoJSON geometry in the map's view, at once
3844        or with an animation.
3845
3846        `geometry` is a GeoJSON geometry object with at least one coordinate,
3847        not a feature. The camera is the one that
3848        `MapHandle.camera_for_geometry()` computes after the commands sent
3849        before this one apply. The function finishes when the map applies the
3850        change, before an animation ends.
3851
3852        See `mln_map_fit_camera_to_geometry` in the
3853        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
3854        """
3855        return self._native._discard_fit_camera_to_geometry(geometry, update)
3856
3857    def fit_camera_to_lat_lng_bounds(
3858        self, bounds: LatLngBounds, update: CameraFitUpdate
3859    ) -> None:
3860        """Moves the camera to fit `bounds` in the map's view, at once or with
3861        an animation.
3862
3863        The camera is the one that `MapHandle.camera_for_lat_lng_bounds()`
3864        computes after the commands sent before this one apply. The function
3865        finishes when the map applies the change, before an animation ends.
3866
3867        See `mln_map_fit_camera_to_lat_lng_bounds` in the
3868        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
3869        """
3870        return self._native._discard_fit_camera_to_lat_lng_bounds(bounds, update)
3871
3872    def fit_camera_to_lat_lngs(
3873        self, coordinates: Sequence[LatLng], update: CameraFitUpdate
3874    ) -> None:
3875        """Moves the camera to fit `coordinates` in the map's view, at once or
3876        with an animation.
3877
3878        `coordinates` must not be empty. The camera is the one that
3879        `MapHandle.camera_for_lat_lngs()` computes after the commands sent
3880        before this one apply. The function finishes when the map applies the
3881        change, before an animation ends.
3882
3883        See `mln_map_fit_camera_to_lat_lngs` in the
3884        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
3885        """
3886        return self._native._discard_fit_camera_to_lat_lngs(coordinates, update)
3887
3888    def invalidate_custom_geometry_source_region(
3889        self, source_id: str, bounds: LatLngBounds
3890    ) -> None:
3891        """Makes a custom geometry source ask again for the tiles in `bounds`
3892        that the map still needs.
3893
3894        See `mln_map_invalidate_custom_geometry_source_region` in the
3895        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3896        """
3897        return self._native._discard_invalidate_custom_geometry_source_region(
3898            source_id, bounds
3899        )
3900
3901    def invalidate_custom_geometry_source_tile(
3902        self, source_id: str, tile_id: CanonicalTileId
3903    ) -> None:
3904        """Makes a custom geometry source ask for a tile again when the map
3905        needs it.
3906
3907        See `mln_map_invalidate_custom_geometry_source_tile` in the
3908        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3909        """
3910        return self._native._discard_invalidate_custom_geometry_source_tile(
3911            source_id, tile_id
3912        )
3913
3914    def invalidate_custom_vector_source_region(
3915        self, source_id: str, bounds: LatLngBounds
3916    ) -> None:
3917        """Makes a custom vector source ask again for the tiles in `bounds` that
3918        the map still needs.
3919
3920        See `mln_map_invalidate_custom_vector_source_region` in the
3921        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3922        """
3923        return self._native._discard_invalidate_custom_vector_source_region(
3924            source_id, bounds
3925        )
3926
3927    def invalidate_custom_vector_source_tile(
3928        self, source_id: str, tile_id: CanonicalTileId
3929    ) -> None:
3930        """Makes a custom vector source ask for a tile again when the map needs
3931        it.
3932
3933        See `mln_map_invalidate_custom_vector_source_tile` in the
3934        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3935        """
3936        return self._native._discard_invalidate_custom_vector_source_tile(
3937            source_id, tile_id
3938        )
3939
3940    def move_style_layer(
3941        self, layer_id: str, before_layer_id: str | None = None
3942    ) -> None:
3943        """Moves a layer of the map's style below the layer named
3944        `before_layer_id`, or above every layer when `before_layer_id` is
3945        empty.
3946
3947        See `mln_map_move_style_layer` in the
3948        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3949        """
3950        return self._native._discard_move_style_layer(layer_id, before_layer_id)
3951
3952    def remove_feature_state(self, selector: FeatureStateSelector) -> None:
3953        """Removes the feature state that `selector` selects.
3954
3955        See `mln_map_remove_feature_state` in the
3956        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3957        """
3958        return self._native._discard_remove_feature_state(selector)
3959
3960    def remove_style_image(self, image_id: str) -> None:
3961        """Removes an image from the map's style.
3962
3963        See `mln_map_remove_style_image` in the
3964        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3965        """
3966        return self._native._discard_remove_style_image(image_id)
3967
3968    def remove_style_layer(self, layer_id: str) -> None:
3969        """Removes a layer from the map's style.
3970
3971        See `mln_map_remove_style_layer` in the
3972        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3973        """
3974        return self._native._discard_remove_style_layer(layer_id)
3975
3976    def remove_style_source(self, source_id: str) -> None:
3977        """Removes a source from the map's style.
3978
3979        See `mln_map_remove_style_source` in the
3980        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3981        """
3982        return self._native._discard_remove_style_source(source_id)
3983
3984    def request_repaint(self) -> None:
3985        """Renders a new frame of a continuous map, even when nothing changed.
3986
3987        See `mln_map_request_repaint` in the
3988        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3989        """
3990        return self._native._discard_request_repaint()
3991
3992    def resize(self, logical_size: LogicalSize) -> None:
3993        """Sets the map's size.
3994
3995        A map with a render session takes its size from the session, so
3996        resize the session with `RenderSessionHandle.resize()` instead.
3997
3998        See `mln_map_resize` in the
3999        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
4000
4001        Errors:
4002
4003        - `Status.INVALID_STATE` when the map has a render session.
4004        """
4005        return self._native._discard_resize(logical_size)
4006
4007    def set_bounds(self, options: BoundOptions) -> None:
4008        """Limits the camera's center to an area, and its zoom and pitch to
4009        ranges.
4010
4011        Limits that `options` doesn't set keep their current values. When the
4012        camera is outside the new limits, it moves inside them.
4013
4014        See `mln_map_set_bounds` in the
4015        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
4016        """
4017        return self._native._discard_set_bounds(options)
4018
4019    def set_custom_geometry_source_tile_data(
4020        self, source_id: str, tile_id: CanonicalTileId, data: Any
4021    ) -> None:
4022        """Sets the data of a tile in a custom geometry source.
4023
4024        `data` is a GeoJSON feature collection, feature, or geometry. The
4025        source ignores data for a tile that it hasn't asked for, or has since
4026        cancelled.
4027
4028        See `mln_map_set_custom_geometry_source_tile_data` in the
4029        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4030        """
4031        return self._native._discard_set_custom_geometry_source_tile_data(
4032            source_id, tile_id, data
4033        )
4034
4035    def set_custom_geometry_source_tile_error(
4036        self, source_id: str, tile_id: CanonicalTileId, message: str
4037    ) -> None:
4038        """Reports that a tile of a custom geometry source failed to load.
4039
4040        See `mln_map_set_custom_geometry_source_tile_error` in the
4041        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4042        """
4043        return self._native._discard_set_custom_geometry_source_tile_error(
4044            source_id, tile_id, message
4045        )
4046
4047    def set_custom_vector_source_tile_data(
4048        self,
4049        source_id: str,
4050        tile_id: CanonicalTileId,
4051        encoding: StyleVectorTileEncoding,
4052        data: Buffer,
4053    ) -> None:
4054        """Sets the data of a tile in a custom vector source.
4055
4056        `data` is the tile, encoded as `encoding`. The source ignores data
4057        for a tile that it hasn't asked for, or has since cancelled.
4058
4059        See `mln_map_set_custom_vector_source_tile_data` in the
4060        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4061        """
4062        return self._native._discard_set_custom_vector_source_tile_data(
4063            source_id, tile_id, encoding, data
4064        )
4065
4066    def set_custom_vector_source_tile_error(
4067        self, source_id: str, tile_id: CanonicalTileId, message: str
4068    ) -> None:
4069        """Reports that a tile of a custom vector source failed to load.
4070
4071        See `mln_map_set_custom_vector_source_tile_error` in the
4072        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4073        """
4074        return self._native._discard_set_custom_vector_source_tile_error(
4075            source_id, tile_id, message
4076        )
4077
4078    def set_debug_flags(self, flags: MapDebugFlag) -> None:
4079        """Draws debugging overlays, such as tile borders, on the map.
4080
4081        `flags` replaces the overlays set before.
4082
4083        See `mln_map_set_debug_flags` in the
4084        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
4085        """
4086        return self._native._discard_set_debug_flags(flags)
4087
4088    def set_event_mask(self, mask: RuntimeEventFlag) -> None:
4089        """Selects the events that the map reports.
4090
4091        See `mln_map_set_event_mask` in the
4092        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
4093        """
4094        return self._native._discard_set_event_mask(mask)
4095
4096    def set_feature_state(self, selector: FeatureStateSelector, state: Any) -> None:
4097        """Merges `state` into the state of a feature.
4098
4099        `state` is a JSON object. Its keys replace the same keys in the
4100        feature's state, and the other keys stay.
4101
4102        See `mln_map_set_feature_state` in the
4103        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
4104        """
4105        return self._native._discard_set_feature_state(selector, state)
4106
4107    def set_free_camera_options(self, options: FreeCameraOptions) -> None:
4108        """Places the camera at a position and orientation in space.
4109
4110        The map adjusts them to a camera that it can show. It stops running
4111        camera animations first, and their end handlers report
4112        `CameraTransitionOutcome.CANCELLED`.
4113
4114        See `mln_map_set_free_camera_options` in the
4115        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
4116        """
4117        return self._native._discard_set_free_camera_options(options)
4118
4119    def set_geo_json_source_data(self, source_id: str, data: Any) -> None:
4120        """Replaces the data of a GeoJSON source.
4121
4122        `data` is a GeoJSON feature collection, feature, or geometry. The
4123        library prepares it for the source with the source's options, off the
4124        threads that the caller and the runtime use, and the command
4125        completes once the source holds it. Later commands don't wait for it.
4126        While the source is still preparing earlier data, only the newest
4127        data waits to follow it.
4128
4129        With synchronous tiling on, as
4130        `MapHandle.set_geo_json_source_synchronous_tiling()` describes, the
4131        command prepares `data` before later commands run, so the data shows
4132        in the next frame.
4133
4134        See `mln_map_set_geo_json_source_data` in the
4135        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4136        """
4137        return self._native._discard_set_geo_json_source_data(source_id, data)
4138
4139    def set_geo_json_source_synchronous_tiling(
4140        self, source_id: str, enabled: bool
4141    ) -> None:
4142        """Sets whether a GeoJSON source builds its tiles while the map renders.
4143
4144        Building tiles while the map renders, instead of in the background,
4145        makes new data show in the next frame. The setting replaces the
4146        `synchronousUpdate` member of the source's JSON, which defaults to
4147        false.
4148
4149        See `mln_map_set_geo_json_source_synchronous_tiling` in the
4150        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4151        """
4152        return self._native._discard_set_geo_json_source_synchronous_tiling(
4153            source_id, enabled
4154        )
4155
4156    def set_geo_json_source_url(self, source_id: str, url: str) -> None:
4157        """Makes a GeoJSON source load its data from `url`.
4158
4159        See `mln_map_set_geo_json_source_url` in the
4160        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4161        """
4162        return self._native._discard_set_geo_json_source_url(source_id, url)
4163
4164    def set_global_state_property(self, property_name: str, value: Any) -> None:
4165        """Sets a value that the style's `global-state`
4166        \\[expressions\\](https://maplibre.org/maplibre-style-spec/expressions/)
4167        read.
4168
4169        See `mln_map_set_global_state_property` in the
4170        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4171        """
4172        return self._native._discard_set_global_state_property(property_name, value)
4173
4174    def set_image_source_coordinates(
4175        self, source_id: str, coordinates: Sequence[LatLng]
4176    ) -> None:
4177        """Moves the image of an image source.
4178
4179        `coordinates` are the image's four corners, clockwise from the top
4180        left.
4181
4182        See `mln_map_set_image_source_coordinates` in the
4183        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4184        """
4185        return self._native._discard_set_image_source_coordinates(
4186            source_id, coordinates
4187        )
4188
4189    def set_image_source_image(
4190        self, source_id: str, image: PremultipliedRgba8Image
4191    ) -> None:
4192        """Replaces the image of an image source.
4193
4194        See `mln_map_set_image_source_image` in the
4195        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4196        """
4197        return self._native._discard_set_image_source_image(source_id, image)
4198
4199    def set_image_source_url(self, source_id: str, url: str) -> None:
4200        """Makes an image source load its image from `url`.
4201
4202        See `mln_map_set_image_source_url` in the
4203        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4204        """
4205        return self._native._discard_set_image_source_url(source_id, url)
4206
4207    def set_projection_mode(self, options: ProjectionModeOptions) -> None:
4208        """Sets whether the map draws in perspective or axonometric projection,
4209        and how much it skews the view.
4210
4211        Settings that `options` doesn't set keep their current values.
4212
4213        See `mln_map_set_projection_mode` in the
4214        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
4215        """
4216        return self._native._discard_set_projection_mode(options)
4217
4218    def set_rendering_stats_view_enabled(self, enabled: bool) -> None:
4219        """Shows or hides an overlay of rendering statistics on the map.
4220
4221        See `mln_map_set_rendering_stats_view_enabled` in the
4222        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
4223        """
4224        return self._native._discard_set_rendering_stats_view_enabled(enabled)
4225
4226    def set_style_image(
4227        self,
4228        image_id: str,
4229        image: PremultipliedRgba8Image,
4230        options: StyleImageOptions | None = None,
4231    ) -> None:
4232        """Adds an image to the map's style, or replaces the image named
4233        `image_id`.
4234
4235        See `mln_map_set_style_image` in the
4236        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4237        """
4238        return self._native._discard_set_style_image(image_id, image, options)
4239
4240    def set_style_json(self, json: Any) -> None:
4241        """Loads the map's style from `json`.
4242
4243        The command completes once the style has parsed, and the map's style
4244        is then loaded, as `MapHandle.set_style_url()` describes. The style's
4245        sources, sprites, and glyphs load in the background.
4246
4247        See `mln_map_set_style_json` in the
4248        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
4249        """
4250        return self._native._discard_set_style_json(json)
4251
4252    def set_style_layer_property(
4253        self, layer_id: str, property_name: str, value: Any
4254    ) -> None:
4255        """Sets a property of a layer in the map's style.
4256
4257        `property_name` is one of the layer's layout or paint
4258        \\[properties\\](https://maplibre.org/maplibre-style-spec/layers/), or
4259        `filter`, `minzoom`, `maxzoom`, `source`, or `source-layer`. A null
4260        `value` resets any of these but `source` and `source-layer` to its
4261        default.
4262
4263        See `mln_map_set_style_layer_property` in the
4264        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4265        """
4266        return self._native._discard_set_style_layer_property(
4267            layer_id, property_name, value
4268        )
4269
4270    def set_style_light_json(self, light_json: Any) -> None:
4271        """Replaces the
4272        \\[light\\](https://maplibre.org/maplibre-style-spec/light/) of the
4273        map's style.
4274
4275        See `mln_map_set_style_light_json` in the
4276        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4277        """
4278        return self._native._discard_set_style_light_json(light_json)
4279
4280    def set_style_light_property(self, property_name: str, value: Any) -> None:
4281        """Sets a property of the light of the map's style.
4282
4283        See `mln_map_set_style_light_property` in the
4284        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4285        """
4286        return self._native._discard_set_style_light_property(property_name, value)
4287
4288    def set_style_source_volatile(self, source_id: str, is_volatile: bool) -> None:
4289        """Sets whether a source is volatile.
4290
4291        The map doesn't store the tiles of a volatile source in the
4292        persistent cache.
4293
4294        See `mln_map_set_style_source_volatile` in the
4295        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4296        """
4297        return self._native._discard_set_style_source_volatile(source_id, is_volatile)
4298
4299    def set_style_transition_options(self, options: StyleTransitionOptions) -> None:
4300        """Sets the default transition of the map's style.
4301
4302        See `mln_map_set_style_transition_options` in the
4303        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4304        """
4305        return self._native._discard_set_style_transition_options(options)
4306
4307    def set_style_url(self, url: str) -> None:
4308        """Loads the map's style from `url`.
4309
4310        The command completes once the style document has loaded and parsed.
4311        The style's sources, sprites, and glyphs then load in the background.
4312
4313        The map's style is loaded from the time a style document parses until
4314        the next call to this function. While the style isn't loaded, the
4315        commands that change it complete with `Status.INVALID_STATE`. To
4316        change a new map's style without a style document, first load an
4317        empty style, such as `{"version":8,"sources":{},"layers":[]}`.
4318
4319        See `mln_map_set_style_url` in the
4320        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
4321        """
4322        return self._native._discard_set_style_url(url)
4323
4324    def set_tile_options(self, options: MapTileOptions) -> None:
4325        """Sets how the map chooses which tiles to load, and at what detail.
4326
4327        Settings that `options` doesn't set keep their current values.
4328
4329        See `mln_map_set_tile_options` in the
4330        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
4331        """
4332        return self._native._discard_set_tile_options(options)
4333
4334    def set_viewport_options(self, options: MapViewportOptions) -> None:
4335        """Sets how the map orients and constrains its view.
4336
4337        Settings that `options` doesn't set keep their current values.
4338
4339        See `mln_map_set_viewport_options` in the
4340        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
4341        """
4342        return self._native._discard_set_viewport_options(options)
4343
4344    def update_camera(self, update: CameraUpdate) -> None:
4345        """Moves the camera, at once or with an animation.
4346
4347        Camera fields that `update` doesn't set keep their values, and the
4348        update stops any running animation of the fields it sets. The
4349        function finishes when the map applies the update, before an
4350        animation ends. To learn when an animation ends, set an
4351        `CameraTransitionHandler` in its animation options.
4352
4353        See `mln_map_update_camera` in the
4354        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
4355        """
4356        return self._native._discard_update_camera(update)
MapHandleDiscarding( owner: maplibre_native_ffi._generated_operations._MapHandleOperations)
3664    def __init__(self, owner: _MapHandleOperations):
3665        self._native = owner._native
def add_custom_geometry_source( self, source_id: str, options: CustomGeometrySourceOptions) -> None:
3667    def add_custom_geometry_source(
3668        self, source_id: str, options: CustomGeometrySourceOptions
3669    ) -> None:
3670        """Adds a source whose GeoJSON tiles come from callbacks.
3671
3672        See `mln_map_add_custom_geometry_source` in the
3673        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3674        """
3675        return self._native._discard_add_custom_geometry_source(source_id, options)

Adds a source whose GeoJSON tiles come from callbacks.

See mln_map_add_custom_geometry_source in the C API reference.

def add_custom_vector_source( self, source_id: str, options: CustomVectorSourceOptions) -> None:
3677    def add_custom_vector_source(
3678        self, source_id: str, options: CustomVectorSourceOptions
3679    ) -> None:
3680        """Adds a source whose vector tiles come from callbacks.
3681
3682        See `mln_map_add_custom_vector_source` in the
3683        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3684        """
3685        return self._native._discard_add_custom_vector_source(source_id, options)

Adds a source whose vector tiles come from callbacks.

See mln_map_add_custom_vector_source in the C API reference.

def add_geo_json_source( self, source_id: str, options: GeoJsonSourceOptions | None = None, attribution: str | None = None) -> None:
3687    def add_geo_json_source(
3688        self,
3689        source_id: str,
3690        options: GeoJsonSourceOptions | None = None,
3691        attribution: str | None = None,
3692    ) -> None:
3693        """Adds a GeoJSON source with no data.
3694
3695        Give it data with `MapHandle.set_geo_json_source_data()` or
3696        `MapHandle.set_geo_json_source_url()`. Its options stay fixed for as
3697        long as the style holds it.
3698
3699        `attribution` is the source's
3700        \\[attribution\\](https://maplibre.org/maplibre-style-spec/sources/#attribution),
3701        or empty for none.
3702
3703        See `mln_map_add_geo_json_source` in the
3704        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3705
3706        Errors:
3707
3708        - `Status.INVALID_ARGUMENT` when an option in `options` is out of
3709          range.
3710        """
3711        return self._native._discard_add_geo_json_source(
3712            source_id, options, attribution
3713        )

Adds a GeoJSON source with no data.

Give it data with MapHandle.set_geo_json_source_data() or MapHandle.set_geo_json_source_url(). Its options stay fixed for as long as the style holds it.

attribution is the source's [attribution](https://maplibre.org/maplibre-style-spec/sources/#attribution), or empty for none.

See mln_map_add_geo_json_source in the C API reference.

Errors:

def add_image_source_image( self, source_id: str, coordinates: Sequence[LatLng], image: PremultipliedRgba8Image) -> None:
3715    def add_image_source_image(
3716        self,
3717        source_id: str,
3718        coordinates: Sequence[LatLng],
3719        image: PremultipliedRgba8Image,
3720    ) -> None:
3721        """Adds an image source that shows `image`.
3722
3723        `coordinates` are the image's four corners, clockwise from the top
3724        left.
3725
3726        See `mln_map_add_image_source_image` in the
3727        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3728        """
3729        return self._native._discard_add_image_source_image(
3730            source_id, coordinates, image
3731        )

Adds an image source that shows image.

coordinates are the image's four corners, clockwise from the top left.

See mln_map_add_image_source_image in the C API reference.

def add_style_layer_json(self, layer_json: Any, before_layer_id: str | None = None) -> None:
3733    def add_style_layer_json(
3734        self, layer_json: Any, before_layer_id: str | None = None
3735    ) -> None:
3736        """Adds a layer to the map's style.
3737
3738        `layer_json` is a
3739        \\[layer\\](https://maplibre.org/maplibre-style-spec/layers/) object.
3740        The layer goes below the layer named `before_layer_id`, or above
3741        every layer when `before_layer_id` is empty.
3742
3743        See `mln_map_add_style_layer_json` in the
3744        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3745        """
3746        return self._native._discard_add_style_layer_json(layer_json, before_layer_id)

Adds a layer to the map's style.

layer_json is a [layer](https://maplibre.org/maplibre-style-spec/layers/) object. The layer goes below the layer named before_layer_id, or above every layer when before_layer_id is empty.

See mln_map_add_style_layer_json in the C API reference.

def add_style_source_json(self, source_id: str, source_json: Any) -> None:
3748    def add_style_source_json(self, source_id: str, source_json: Any) -> None:
3749        """Adds a source to the map's style.
3750
3751        `source_json` is a
3752        \\[source\\](https://maplibre.org/maplibre-style-spec/sources/) object.
3753
3754        See `mln_map_add_style_source_json` in the
3755        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3756        """
3757        return self._native._discard_add_style_source_json(source_id, source_json)

Adds a source to the map's style.

source_json is a [source](https://maplibre.org/maplibre-style-spec/sources/) object.

See mln_map_add_style_source_json in the C API reference.

def apply_camera_delta(self, delta: CameraDelta) -> None:
3759    def apply_camera_delta(self, delta: CameraDelta) -> None:
3760        """Moves the camera relative to where it is, as a gesture does.
3761
3762        `delta` can pan the map's content by an offset on the screen, scale
3763        the zoom, and add to the bearing and pitch. An anchor keeps one
3764        screen point in place while the scale, bearing, or pitch changes. An
3765        anchor needs one of those changes, and combines with an offset only
3766        when the delta has no animation. The function finishes when the map
3767        applies the delta, before an animation ends.
3768
3769        A delta that replaces an animated one starts from where that
3770        animation left the camera, so the rest of the replaced change never
3771        happens. To reach an exact camera, use `MapHandle.update_camera()`.
3772
3773        A delta in the end phase can carry momentum, which keeps the camera
3774        moving from the gesture's release velocities and slows it on each
3775        rendered frame. The gesture lasts until the momentum ends: the
3776        snapshot keeps `gesture_in_progress` set, and camera events report
3777        `CameraChangeSource.MOMENTUM`. With momentum, `animation` sets only
3778        `transition_id` and the end handler, which runs when the gesture
3779        ends.
3780
3781        A delta in the begin phase, `MapHandle.cancel_camera_transitions()`,
3782        or a cancellation by that ID stops the momentum. A later command that
3783        sets a field stops only the parts of the momentum that move that
3784        field. On a tilted map, the pan moves the map's content the same
3785        distance on the screen in every direction.
3786
3787        See `mln_map_apply_camera_delta` in the
3788        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
3789        """
3790        return self._native._discard_apply_camera_delta(delta)

Moves the camera relative to where it is, as a gesture does.

delta can pan the map's content by an offset on the screen, scale the zoom, and add to the bearing and pitch. An anchor keeps one screen point in place while the scale, bearing, or pitch changes. An anchor needs one of those changes, and combines with an offset only when the delta has no animation. The function finishes when the map applies the delta, before an animation ends.

A delta that replaces an animated one starts from where that animation left the camera, so the rest of the replaced change never happens. To reach an exact camera, use MapHandle.update_camera().

A delta in the end phase can carry momentum, which keeps the camera moving from the gesture's release velocities and slows it on each rendered frame. The gesture lasts until the momentum ends: the snapshot keeps gesture_in_progress set, and camera events report CameraChangeSource.MOMENTUM. With momentum, animation sets only transition_id and the end handler, which runs when the gesture ends.

A delta in the begin phase, MapHandle.cancel_camera_transitions(), or a cancellation by that ID stops the momentum. A later command that sets a field stops only the parts of the momentum that move that field. On a tilted map, the pan moves the map's content the same distance on the screen in every direction.

See mln_map_apply_camera_delta in the C API reference.

def begin_command_group(self) -> None:
3792    def begin_command_group(self) -> None:
3793        """Holds back the map's changes from rendering until
3794        `MapHandle.end_command_group()`, so they show in the same frame.
3795
3796        Groups nest, and the changes render when the outermost group ends.
3797
3798        See `mln_map_begin_command_group` in the
3799        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3800        """
3801        return self._native._discard_begin_command_group()

Holds back the map's changes from rendering until MapHandle.end_command_group(), so they show in the same frame.

Groups nest, and the changes render when the outermost group ends.

See mln_map_begin_command_group in the C API reference.

def cancel_camera_transitions(self) -> None:
3803    def cancel_camera_transitions(self) -> None:
3804        """Stops every running camera animation where it is.
3805
3806        The end handler of each stopped animation reports
3807        `CameraTransitionOutcome.CANCELLED`.
3808
3809        See `mln_map_cancel_camera_transitions` in the
3810        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
3811        """
3812        return self._native._discard_cancel_camera_transitions()

Stops every running camera animation where it is.

The end handler of each stopped animation reports CameraTransitionOutcome.CANCELLED.

See mln_map_cancel_camera_transitions in the C API reference.

def cancel_camera_transitions_with_id(self, transition_id: int) -> None:
3814    def cancel_camera_transitions_with_id(self, transition_id: int) -> None:
3815        """Stops the running camera animations whose animation options set
3816        `transition_id`.
3817
3818        Other animations keep running. The end handler of each stopped
3819        animation reports `CameraTransitionOutcome.CANCELLED`.
3820
3821        See `mln_map_cancel_camera_transitions_with_id` in the
3822        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
3823        """
3824        return self._native._discard_cancel_camera_transitions_with_id(transition_id)

Stops the running camera animations whose animation options set transition_id.

Other animations keep running. The end handler of each stopped animation reports CameraTransitionOutcome.CANCELLED.

See mln_map_cancel_camera_transitions_with_id in the C API reference.

def dump_debug_logs(self) -> None:
3826    def dump_debug_logs(self) -> None:
3827        """Logs debugging information about the map's style and sources.
3828
3829        See `mln_map_dump_debug_logs` in the
3830        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
3831        """
3832        return self._native._discard_dump_debug_logs()

Logs debugging information about the map's style and sources.

See mln_map_dump_debug_logs in the C API reference.

def end_command_group(self) -> None:
3834    def end_command_group(self) -> None:
3835        """Ends the group that `MapHandle.begin_command_group()` began.
3836
3837        See `mln_map_end_command_group` in the
3838        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3839        """
3840        return self._native._discard_end_command_group()

Ends the group that MapHandle.begin_command_group() began.

See mln_map_end_command_group in the C API reference.

def fit_camera_to_geometry( self, geometry: Any, update: CameraFitUpdate) -> None:
3842    def fit_camera_to_geometry(self, geometry: Any, update: CameraFitUpdate) -> None:
3843        """Moves the camera to fit a GeoJSON geometry in the map's view, at once
3844        or with an animation.
3845
3846        `geometry` is a GeoJSON geometry object with at least one coordinate,
3847        not a feature. The camera is the one that
3848        `MapHandle.camera_for_geometry()` computes after the commands sent
3849        before this one apply. The function finishes when the map applies the
3850        change, before an animation ends.
3851
3852        See `mln_map_fit_camera_to_geometry` in the
3853        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
3854        """
3855        return self._native._discard_fit_camera_to_geometry(geometry, update)

Moves the camera to fit a GeoJSON geometry in the map's view, at once or with an animation.

geometry is a GeoJSON geometry object with at least one coordinate, not a feature. The camera is the one that MapHandle.camera_for_geometry() computes after the commands sent before this one apply. The function finishes when the map applies the change, before an animation ends.

See mln_map_fit_camera_to_geometry in the C API reference.

def fit_camera_to_lat_lng_bounds( self, bounds: LatLngBounds, update: CameraFitUpdate) -> None:
3857    def fit_camera_to_lat_lng_bounds(
3858        self, bounds: LatLngBounds, update: CameraFitUpdate
3859    ) -> None:
3860        """Moves the camera to fit `bounds` in the map's view, at once or with
3861        an animation.
3862
3863        The camera is the one that `MapHandle.camera_for_lat_lng_bounds()`
3864        computes after the commands sent before this one apply. The function
3865        finishes when the map applies the change, before an animation ends.
3866
3867        See `mln_map_fit_camera_to_lat_lng_bounds` in the
3868        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
3869        """
3870        return self._native._discard_fit_camera_to_lat_lng_bounds(bounds, update)

Moves the camera to fit bounds in the map's view, at once or with an animation.

The camera is the one that MapHandle.camera_for_lat_lng_bounds() computes after the commands sent before this one apply. The function finishes when the map applies the change, before an animation ends.

See mln_map_fit_camera_to_lat_lng_bounds in the C API reference.

def fit_camera_to_lat_lngs( self, coordinates: Sequence[LatLng], update: CameraFitUpdate) -> None:
3872    def fit_camera_to_lat_lngs(
3873        self, coordinates: Sequence[LatLng], update: CameraFitUpdate
3874    ) -> None:
3875        """Moves the camera to fit `coordinates` in the map's view, at once or
3876        with an animation.
3877
3878        `coordinates` must not be empty. The camera is the one that
3879        `MapHandle.camera_for_lat_lngs()` computes after the commands sent
3880        before this one apply. The function finishes when the map applies the
3881        change, before an animation ends.
3882
3883        See `mln_map_fit_camera_to_lat_lngs` in the
3884        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
3885        """
3886        return self._native._discard_fit_camera_to_lat_lngs(coordinates, update)

Moves the camera to fit coordinates in the map's view, at once or with an animation.

coordinates must not be empty. The camera is the one that MapHandle.camera_for_lat_lngs() computes after the commands sent before this one apply. The function finishes when the map applies the change, before an animation ends.

See mln_map_fit_camera_to_lat_lngs in the C API reference.

def invalidate_custom_geometry_source_region( self, source_id: str, bounds: LatLngBounds) -> None:
3888    def invalidate_custom_geometry_source_region(
3889        self, source_id: str, bounds: LatLngBounds
3890    ) -> None:
3891        """Makes a custom geometry source ask again for the tiles in `bounds`
3892        that the map still needs.
3893
3894        See `mln_map_invalidate_custom_geometry_source_region` in the
3895        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3896        """
3897        return self._native._discard_invalidate_custom_geometry_source_region(
3898            source_id, bounds
3899        )

Makes a custom geometry source ask again for the tiles in bounds that the map still needs.

See mln_map_invalidate_custom_geometry_source_region in the C API reference.

def invalidate_custom_geometry_source_tile( self, source_id: str, tile_id: CanonicalTileId) -> None:
3901    def invalidate_custom_geometry_source_tile(
3902        self, source_id: str, tile_id: CanonicalTileId
3903    ) -> None:
3904        """Makes a custom geometry source ask for a tile again when the map
3905        needs it.
3906
3907        See `mln_map_invalidate_custom_geometry_source_tile` in the
3908        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3909        """
3910        return self._native._discard_invalidate_custom_geometry_source_tile(
3911            source_id, tile_id
3912        )

Makes a custom geometry source ask for a tile again when the map needs it.

See mln_map_invalidate_custom_geometry_source_tile in the C API reference.

def invalidate_custom_vector_source_region( self, source_id: str, bounds: LatLngBounds) -> None:
3914    def invalidate_custom_vector_source_region(
3915        self, source_id: str, bounds: LatLngBounds
3916    ) -> None:
3917        """Makes a custom vector source ask again for the tiles in `bounds` that
3918        the map still needs.
3919
3920        See `mln_map_invalidate_custom_vector_source_region` in the
3921        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3922        """
3923        return self._native._discard_invalidate_custom_vector_source_region(
3924            source_id, bounds
3925        )

Makes a custom vector source ask again for the tiles in bounds that the map still needs.

See mln_map_invalidate_custom_vector_source_region in the C API reference.

def invalidate_custom_vector_source_tile( self, source_id: str, tile_id: CanonicalTileId) -> None:
3927    def invalidate_custom_vector_source_tile(
3928        self, source_id: str, tile_id: CanonicalTileId
3929    ) -> None:
3930        """Makes a custom vector source ask for a tile again when the map needs
3931        it.
3932
3933        See `mln_map_invalidate_custom_vector_source_tile` in the
3934        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3935        """
3936        return self._native._discard_invalidate_custom_vector_source_tile(
3937            source_id, tile_id
3938        )

Makes a custom vector source ask for a tile again when the map needs it.

See mln_map_invalidate_custom_vector_source_tile in the C API reference.

def move_style_layer(self, layer_id: str, before_layer_id: str | None = None) -> None:
3940    def move_style_layer(
3941        self, layer_id: str, before_layer_id: str | None = None
3942    ) -> None:
3943        """Moves a layer of the map's style below the layer named
3944        `before_layer_id`, or above every layer when `before_layer_id` is
3945        empty.
3946
3947        See `mln_map_move_style_layer` in the
3948        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3949        """
3950        return self._native._discard_move_style_layer(layer_id, before_layer_id)

Moves a layer of the map's style below the layer named before_layer_id, or above every layer when before_layer_id is empty.

See mln_map_move_style_layer in the C API reference.

def remove_feature_state( self, selector: FeatureStateSelector) -> None:
3952    def remove_feature_state(self, selector: FeatureStateSelector) -> None:
3953        """Removes the feature state that `selector` selects.
3954
3955        See `mln_map_remove_feature_state` in the
3956        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3957        """
3958        return self._native._discard_remove_feature_state(selector)

Removes the feature state that selector selects.

See mln_map_remove_feature_state in the C API reference.

def remove_style_image(self, image_id: str) -> None:
3960    def remove_style_image(self, image_id: str) -> None:
3961        """Removes an image from the map's style.
3962
3963        See `mln_map_remove_style_image` in the
3964        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3965        """
3966        return self._native._discard_remove_style_image(image_id)

Removes an image from the map's style.

See mln_map_remove_style_image in the C API reference.

def remove_style_layer(self, layer_id: str) -> None:
3968    def remove_style_layer(self, layer_id: str) -> None:
3969        """Removes a layer from the map's style.
3970
3971        See `mln_map_remove_style_layer` in the
3972        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3973        """
3974        return self._native._discard_remove_style_layer(layer_id)

Removes a layer from the map's style.

See mln_map_remove_style_layer in the C API reference.

def remove_style_source(self, source_id: str) -> None:
3976    def remove_style_source(self, source_id: str) -> None:
3977        """Removes a source from the map's style.
3978
3979        See `mln_map_remove_style_source` in the
3980        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3981        """
3982        return self._native._discard_remove_style_source(source_id)

Removes a source from the map's style.

See mln_map_remove_style_source in the C API reference.

def request_repaint(self) -> None:
3984    def request_repaint(self) -> None:
3985        """Renders a new frame of a continuous map, even when nothing changed.
3986
3987        See `mln_map_request_repaint` in the
3988        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3989        """
3990        return self._native._discard_request_repaint()

Renders a new frame of a continuous map, even when nothing changed.

See mln_map_request_repaint in the C API reference.

def resize( self, logical_size: LogicalSize) -> None:
3992    def resize(self, logical_size: LogicalSize) -> None:
3993        """Sets the map's size.
3994
3995        A map with a render session takes its size from the session, so
3996        resize the session with `RenderSessionHandle.resize()` instead.
3997
3998        See `mln_map_resize` in the
3999        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
4000
4001        Errors:
4002
4003        - `Status.INVALID_STATE` when the map has a render session.
4004        """
4005        return self._native._discard_resize(logical_size)

Sets the map's size.

A map with a render session takes its size from the session, so resize the session with RenderSessionHandle.resize() instead.

See mln_map_resize in the C API reference.

Errors:

def set_bounds( self, options: BoundOptions) -> None:
4007    def set_bounds(self, options: BoundOptions) -> None:
4008        """Limits the camera's center to an area, and its zoom and pitch to
4009        ranges.
4010
4011        Limits that `options` doesn't set keep their current values. When the
4012        camera is outside the new limits, it moves inside them.
4013
4014        See `mln_map_set_bounds` in the
4015        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
4016        """
4017        return self._native._discard_set_bounds(options)

Limits the camera's center to an area, and its zoom and pitch to ranges.

Limits that options doesn't set keep their current values. When the camera is outside the new limits, it moves inside them.

See mln_map_set_bounds in the C API reference.

def set_custom_geometry_source_tile_data( self, source_id: str, tile_id: CanonicalTileId, data: Any) -> None:
4019    def set_custom_geometry_source_tile_data(
4020        self, source_id: str, tile_id: CanonicalTileId, data: Any
4021    ) -> None:
4022        """Sets the data of a tile in a custom geometry source.
4023
4024        `data` is a GeoJSON feature collection, feature, or geometry. The
4025        source ignores data for a tile that it hasn't asked for, or has since
4026        cancelled.
4027
4028        See `mln_map_set_custom_geometry_source_tile_data` in the
4029        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4030        """
4031        return self._native._discard_set_custom_geometry_source_tile_data(
4032            source_id, tile_id, data
4033        )

Sets the data of a tile in a custom geometry source.

data is a GeoJSON feature collection, feature, or geometry. The source ignores data for a tile that it hasn't asked for, or has since cancelled.

See mln_map_set_custom_geometry_source_tile_data in the C API reference.

def set_custom_geometry_source_tile_error( self, source_id: str, tile_id: CanonicalTileId, message: str) -> None:
4035    def set_custom_geometry_source_tile_error(
4036        self, source_id: str, tile_id: CanonicalTileId, message: str
4037    ) -> None:
4038        """Reports that a tile of a custom geometry source failed to load.
4039
4040        See `mln_map_set_custom_geometry_source_tile_error` in the
4041        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4042        """
4043        return self._native._discard_set_custom_geometry_source_tile_error(
4044            source_id, tile_id, message
4045        )

Reports that a tile of a custom geometry source failed to load.

See mln_map_set_custom_geometry_source_tile_error in the C API reference.

def set_custom_vector_source_tile_data( self, source_id: str, tile_id: CanonicalTileId, encoding: StyleVectorTileEncoding, data: Buffer) -> None:
4047    def set_custom_vector_source_tile_data(
4048        self,
4049        source_id: str,
4050        tile_id: CanonicalTileId,
4051        encoding: StyleVectorTileEncoding,
4052        data: Buffer,
4053    ) -> None:
4054        """Sets the data of a tile in a custom vector source.
4055
4056        `data` is the tile, encoded as `encoding`. The source ignores data
4057        for a tile that it hasn't asked for, or has since cancelled.
4058
4059        See `mln_map_set_custom_vector_source_tile_data` in the
4060        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4061        """
4062        return self._native._discard_set_custom_vector_source_tile_data(
4063            source_id, tile_id, encoding, data
4064        )

Sets the data of a tile in a custom vector source.

data is the tile, encoded as encoding. The source ignores data for a tile that it hasn't asked for, or has since cancelled.

See mln_map_set_custom_vector_source_tile_data in the C API reference.

def set_custom_vector_source_tile_error( self, source_id: str, tile_id: CanonicalTileId, message: str) -> None:
4066    def set_custom_vector_source_tile_error(
4067        self, source_id: str, tile_id: CanonicalTileId, message: str
4068    ) -> None:
4069        """Reports that a tile of a custom vector source failed to load.
4070
4071        See `mln_map_set_custom_vector_source_tile_error` in the
4072        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4073        """
4074        return self._native._discard_set_custom_vector_source_tile_error(
4075            source_id, tile_id, message
4076        )

Reports that a tile of a custom vector source failed to load.

See mln_map_set_custom_vector_source_tile_error in the C API reference.

def set_debug_flags(self, flags: MapDebugFlag) -> None:
4078    def set_debug_flags(self, flags: MapDebugFlag) -> None:
4079        """Draws debugging overlays, such as tile borders, on the map.
4080
4081        `flags` replaces the overlays set before.
4082
4083        See `mln_map_set_debug_flags` in the
4084        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
4085        """
4086        return self._native._discard_set_debug_flags(flags)

Draws debugging overlays, such as tile borders, on the map.

flags replaces the overlays set before.

See mln_map_set_debug_flags in the C API reference.

def set_event_mask( self, mask: RuntimeEventFlag) -> None:
4088    def set_event_mask(self, mask: RuntimeEventFlag) -> None:
4089        """Selects the events that the map reports.
4090
4091        See `mln_map_set_event_mask` in the
4092        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
4093        """
4094        return self._native._discard_set_event_mask(mask)

Selects the events that the map reports.

See mln_map_set_event_mask in the C API reference.

def set_feature_state( self, selector: FeatureStateSelector, state: Any) -> None:
4096    def set_feature_state(self, selector: FeatureStateSelector, state: Any) -> None:
4097        """Merges `state` into the state of a feature.
4098
4099        `state` is a JSON object. Its keys replace the same keys in the
4100        feature's state, and the other keys stay.
4101
4102        See `mln_map_set_feature_state` in the
4103        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
4104        """
4105        return self._native._discard_set_feature_state(selector, state)

Merges state into the state of a feature.

state is a JSON object. Its keys replace the same keys in the feature's state, and the other keys stay.

See mln_map_set_feature_state in the C API reference.

def set_free_camera_options( self, options: FreeCameraOptions) -> None:
4107    def set_free_camera_options(self, options: FreeCameraOptions) -> None:
4108        """Places the camera at a position and orientation in space.
4109
4110        The map adjusts them to a camera that it can show. It stops running
4111        camera animations first, and their end handlers report
4112        `CameraTransitionOutcome.CANCELLED`.
4113
4114        See `mln_map_set_free_camera_options` in the
4115        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
4116        """
4117        return self._native._discard_set_free_camera_options(options)

Places the camera at a position and orientation in space.

The map adjusts them to a camera that it can show. It stops running camera animations first, and their end handlers report CameraTransitionOutcome.CANCELLED.

See mln_map_set_free_camera_options in the C API reference.

def set_geo_json_source_data(self, source_id: str, data: Any) -> None:
4119    def set_geo_json_source_data(self, source_id: str, data: Any) -> None:
4120        """Replaces the data of a GeoJSON source.
4121
4122        `data` is a GeoJSON feature collection, feature, or geometry. The
4123        library prepares it for the source with the source's options, off the
4124        threads that the caller and the runtime use, and the command
4125        completes once the source holds it. Later commands don't wait for it.
4126        While the source is still preparing earlier data, only the newest
4127        data waits to follow it.
4128
4129        With synchronous tiling on, as
4130        `MapHandle.set_geo_json_source_synchronous_tiling()` describes, the
4131        command prepares `data` before later commands run, so the data shows
4132        in the next frame.
4133
4134        See `mln_map_set_geo_json_source_data` in the
4135        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4136        """
4137        return self._native._discard_set_geo_json_source_data(source_id, data)

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 MapHandle.set_geo_json_source_synchronous_tiling() 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.

def set_geo_json_source_synchronous_tiling(self, source_id: str, enabled: bool) -> None:
4139    def set_geo_json_source_synchronous_tiling(
4140        self, source_id: str, enabled: bool
4141    ) -> None:
4142        """Sets whether a GeoJSON source builds its tiles while the map renders.
4143
4144        Building tiles while the map renders, instead of in the background,
4145        makes new data show in the next frame. The setting replaces the
4146        `synchronousUpdate` member of the source's JSON, which defaults to
4147        false.
4148
4149        See `mln_map_set_geo_json_source_synchronous_tiling` in the
4150        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4151        """
4152        return self._native._discard_set_geo_json_source_synchronous_tiling(
4153            source_id, enabled
4154        )

Sets whether a GeoJSON source builds its tiles while the map renders.

Building tiles while the map renders, instead of in the background, makes new data show in the next frame. The setting replaces the synchronousUpdate member of the source's JSON, which defaults to false.

See mln_map_set_geo_json_source_synchronous_tiling in the C API reference.

def set_geo_json_source_url(self, source_id: str, url: str) -> None:
4156    def set_geo_json_source_url(self, source_id: str, url: str) -> None:
4157        """Makes a GeoJSON source load its data from `url`.
4158
4159        See `mln_map_set_geo_json_source_url` in the
4160        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4161        """
4162        return self._native._discard_set_geo_json_source_url(source_id, url)

Makes a GeoJSON source load its data from url.

See mln_map_set_geo_json_source_url in the C API reference.

def set_global_state_property(self, property_name: str, value: Any) -> None:
4164    def set_global_state_property(self, property_name: str, value: Any) -> None:
4165        """Sets a value that the style's `global-state`
4166        \\[expressions\\](https://maplibre.org/maplibre-style-spec/expressions/)
4167        read.
4168
4169        See `mln_map_set_global_state_property` in the
4170        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4171        """
4172        return self._native._discard_set_global_state_property(property_name, value)

Sets a value that the style's global-state [expressions](https://maplibre.org/maplibre-style-spec/expressions/) read.

See mln_map_set_global_state_property in the C API reference.

def set_image_source_coordinates( self, source_id: str, coordinates: Sequence[LatLng]) -> None:
4174    def set_image_source_coordinates(
4175        self, source_id: str, coordinates: Sequence[LatLng]
4176    ) -> None:
4177        """Moves the image of an image source.
4178
4179        `coordinates` are the image's four corners, clockwise from the top
4180        left.
4181
4182        See `mln_map_set_image_source_coordinates` in the
4183        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4184        """
4185        return self._native._discard_set_image_source_coordinates(
4186            source_id, coordinates
4187        )

Moves the image of an image source.

coordinates are the image's four corners, clockwise from the top left.

See mln_map_set_image_source_coordinates in the C API reference.

def set_image_source_image( self, source_id: str, image: PremultipliedRgba8Image) -> None:
4189    def set_image_source_image(
4190        self, source_id: str, image: PremultipliedRgba8Image
4191    ) -> None:
4192        """Replaces the image of an image source.
4193
4194        See `mln_map_set_image_source_image` in the
4195        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4196        """
4197        return self._native._discard_set_image_source_image(source_id, image)

Replaces the image of an image source.

See mln_map_set_image_source_image in the C API reference.

def set_image_source_url(self, source_id: str, url: str) -> None:
4199    def set_image_source_url(self, source_id: str, url: str) -> None:
4200        """Makes an image source load its image from `url`.
4201
4202        See `mln_map_set_image_source_url` in the
4203        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4204        """
4205        return self._native._discard_set_image_source_url(source_id, url)

Makes an image source load its image from url.

See mln_map_set_image_source_url in the C API reference.

def set_projection_mode( self, options: ProjectionModeOptions) -> None:
4207    def set_projection_mode(self, options: ProjectionModeOptions) -> None:
4208        """Sets whether the map draws in perspective or axonometric projection,
4209        and how much it skews the view.
4210
4211        Settings that `options` doesn't set keep their current values.
4212
4213        See `mln_map_set_projection_mode` in the
4214        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
4215        """
4216        return self._native._discard_set_projection_mode(options)

Sets whether the map draws in perspective or axonometric projection, and how much it skews the view.

Settings that options doesn't set keep their current values.

See mln_map_set_projection_mode in the C API reference.

def set_rendering_stats_view_enabled(self, enabled: bool) -> None:
4218    def set_rendering_stats_view_enabled(self, enabled: bool) -> None:
4219        """Shows or hides an overlay of rendering statistics on the map.
4220
4221        See `mln_map_set_rendering_stats_view_enabled` in the
4222        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
4223        """
4224        return self._native._discard_set_rendering_stats_view_enabled(enabled)

Shows or hides an overlay of rendering statistics on the map.

See mln_map_set_rendering_stats_view_enabled in the C API reference.

def set_style_image( self, image_id: str, image: PremultipliedRgba8Image, options: StyleImageOptions | None = None) -> None:
4226    def set_style_image(
4227        self,
4228        image_id: str,
4229        image: PremultipliedRgba8Image,
4230        options: StyleImageOptions | None = None,
4231    ) -> None:
4232        """Adds an image to the map's style, or replaces the image named
4233        `image_id`.
4234
4235        See `mln_map_set_style_image` in the
4236        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4237        """
4238        return self._native._discard_set_style_image(image_id, image, options)

Adds an image to the map's style, or replaces the image named image_id.

See mln_map_set_style_image in the C API reference.

def set_style_json(self, json: Any) -> None:
4240    def set_style_json(self, json: Any) -> None:
4241        """Loads the map's style from `json`.
4242
4243        The command completes once the style has parsed, and the map's style
4244        is then loaded, as `MapHandle.set_style_url()` describes. The style's
4245        sources, sprites, and glyphs load in the background.
4246
4247        See `mln_map_set_style_json` in the
4248        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
4249        """
4250        return self._native._discard_set_style_json(json)

Loads the map's style from json.

The command completes once the style has parsed, and the map's style is then loaded, as MapHandle.set_style_url() describes. The style's sources, sprites, and glyphs load in the background.

See mln_map_set_style_json in the C API reference.

def set_style_layer_property(self, layer_id: str, property_name: str, value: Any) -> None:
4252    def set_style_layer_property(
4253        self, layer_id: str, property_name: str, value: Any
4254    ) -> None:
4255        """Sets a property of a layer in the map's style.
4256
4257        `property_name` is one of the layer's layout or paint
4258        \\[properties\\](https://maplibre.org/maplibre-style-spec/layers/), or
4259        `filter`, `minzoom`, `maxzoom`, `source`, or `source-layer`. A null
4260        `value` resets any of these but `source` and `source-layer` to its
4261        default.
4262
4263        See `mln_map_set_style_layer_property` in the
4264        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4265        """
4266        return self._native._discard_set_style_layer_property(
4267            layer_id, property_name, value
4268        )

Sets a property of a layer in the map's style.

property_name is one of the layer's layout or paint [properties](https://maplibre.org/maplibre-style-spec/layers/), or filter, minzoom, maxzoom, source, or source-layer. A null value resets any of these but source and source-layer to its default.

See mln_map_set_style_layer_property in the C API reference.

def set_style_light_json(self, light_json: Any) -> None:
4270    def set_style_light_json(self, light_json: Any) -> None:
4271        """Replaces the
4272        \\[light\\](https://maplibre.org/maplibre-style-spec/light/) of the
4273        map's style.
4274
4275        See `mln_map_set_style_light_json` in the
4276        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4277        """
4278        return self._native._discard_set_style_light_json(light_json)

Replaces the [light](https://maplibre.org/maplibre-style-spec/light/) of the map's style.

See mln_map_set_style_light_json in the C API reference.

def set_style_light_property(self, property_name: str, value: Any) -> None:
4280    def set_style_light_property(self, property_name: str, value: Any) -> None:
4281        """Sets a property of the light of the map's style.
4282
4283        See `mln_map_set_style_light_property` in the
4284        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4285        """
4286        return self._native._discard_set_style_light_property(property_name, value)

Sets a property of the light of the map's style.

See mln_map_set_style_light_property in the C API reference.

def set_style_source_volatile(self, source_id: str, is_volatile: bool) -> None:
4288    def set_style_source_volatile(self, source_id: str, is_volatile: bool) -> None:
4289        """Sets whether a source is volatile.
4290
4291        The map doesn't store the tiles of a volatile source in the
4292        persistent cache.
4293
4294        See `mln_map_set_style_source_volatile` in the
4295        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4296        """
4297        return self._native._discard_set_style_source_volatile(source_id, is_volatile)

Sets whether a source is volatile.

The map doesn't store the tiles of a volatile source in the persistent cache.

See mln_map_set_style_source_volatile in the C API reference.

def set_style_transition_options( self, options: StyleTransitionOptions) -> None:
4299    def set_style_transition_options(self, options: StyleTransitionOptions) -> None:
4300        """Sets the default transition of the map's style.
4301
4302        See `mln_map_set_style_transition_options` in the
4303        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4304        """
4305        return self._native._discard_set_style_transition_options(options)

Sets the default transition of the map's style.

See mln_map_set_style_transition_options in the C API reference.

def set_style_url(self, url: str) -> None:
4307    def set_style_url(self, url: str) -> None:
4308        """Loads the map's style from `url`.
4309
4310        The command completes once the style document has loaded and parsed.
4311        The style's sources, sprites, and glyphs then load in the background.
4312
4313        The map's style is loaded from the time a style document parses until
4314        the next call to this function. While the style isn't loaded, the
4315        commands that change it complete with `Status.INVALID_STATE`. To
4316        change a new map's style without a style document, first load an
4317        empty style, such as `{"version":8,"sources":{},"layers":[]}`.
4318
4319        See `mln_map_set_style_url` in the
4320        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
4321        """
4322        return self._native._discard_set_style_url(url)

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 Status.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.

def set_tile_options( self, options: MapTileOptions) -> None:
4324    def set_tile_options(self, options: MapTileOptions) -> None:
4325        """Sets how the map chooses which tiles to load, and at what detail.
4326
4327        Settings that `options` doesn't set keep their current values.
4328
4329        See `mln_map_set_tile_options` in the
4330        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
4331        """
4332        return self._native._discard_set_tile_options(options)

Sets how the map chooses which tiles to load, and at what detail.

Settings that options doesn't set keep their current values.

See mln_map_set_tile_options in the C API reference.

def set_viewport_options( self, options: MapViewportOptions) -> None:
4334    def set_viewport_options(self, options: MapViewportOptions) -> None:
4335        """Sets how the map orients and constrains its view.
4336
4337        Settings that `options` doesn't set keep their current values.
4338
4339        See `mln_map_set_viewport_options` in the
4340        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
4341        """
4342        return self._native._discard_set_viewport_options(options)

Sets how the map orients and constrains its view.

Settings that options doesn't set keep their current values.

See mln_map_set_viewport_options in the C API reference.

def update_camera(self, update: CameraUpdate) -> None:
4344    def update_camera(self, update: CameraUpdate) -> None:
4345        """Moves the camera, at once or with an animation.
4346
4347        Camera fields that `update` doesn't set keep their values, and the
4348        update stops any running animation of the fields it sets. The
4349        function finishes when the map applies the update, before an
4350        animation ends. To learn when an animation ends, set an
4351        `CameraTransitionHandler` in its animation options.
4352
4353        See `mln_map_update_camera` in the
4354        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
4355        """
4356        return self._native._discard_update_camera(update)

Moves the camera, at once or with an animation.

Camera fields that update doesn't set keep their values, and the update stops any running animation of the fields it sets. The function finishes when the map applies the update, before an animation ends. To learn when an animation ends, set an CameraTransitionHandler in its animation options.

See mln_map_update_camera in the C API reference.

class MapLoadError(maplibre_native_ffi._enum.UnknownIntEnum):
507class MapLoadError(UnknownIntEnum):
508    """Why a map failed to load a style.
509
510    See `mln_map_load_error` in the
511    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
512    """
513
514    UNKNOWN = 0
515    STYLE_PARSE = 1
516    STYLE_LOAD = 2

Why a map failed to load a style.

See mln_map_load_error in the C API reference.

UNKNOWN = <MapLoadError.UNKNOWN: 0>
STYLE_PARSE = <MapLoadError.STYLE_PARSE: 1>
STYLE_LOAD = <MapLoadError.STYLE_LOAD: 2>
class MapMode(maplibre_native_ffi._enum.UnknownIntEnum):
519class MapMode(UnknownIntEnum):
520    """When a map renders.
521
522    See `mln_map_mode` in the
523    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
524    """
525
526    CONTINUOUS = 0
527    STATIC = 1
528    TILE = 2

When a map renders.

See mln_map_mode in the C API reference.

CONTINUOUS = <MapMode.CONTINUOUS: 0>
STATIC = <MapMode.STATIC: 1>
TILE = <MapMode.TILE: 2>
@dataclass(frozen=True, slots=True)
class MapOptions:
2578@dataclass(frozen=True, slots=True)
2579class MapOptions:
2580    """Options for `RuntimeHandle.create_map()`.
2581
2582    See `mln_map_options` in the
2583    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
2584    """
2585
2586    initial_extent: LogicalExtent
2587    """The map's first size, and its scale factor. The scale factor stays fixed
2588    for the map's life, and every render session of the map renders at it.
2589    """
2590
2591    map_mode: MapMode = MapMode.CONTINUOUS
2592
2593    fast_pfor_enabled: bool = False
2594    """Whether the map decodes MapLibre Tiles (MLT) that use FastPFOR integer
2595    encoding. Without it, such tiles fail to load.
2596    """
2597
2598    event_mask: RuntimeEventFlag | None = None
2599    """The events that the map reports. Without it, the map reports them all."""
2600
2601    tile_cache_enabled: bool | None = None
2602    """Whether the map keeps tiles in memory after they leave the view, so they
2603    show again without loading. Without it, the map keeps them.
2604    """
2605
2606    @classmethod
2607    def _from_native(cls, raw):
2608        return cls(
2609            initial_extent=LogicalExtent._from_native(raw["initial_extent"]),
2610            map_mode=MapMode(raw["map_mode"]),
2611            fast_pfor_enabled=raw["fast_pfor_enabled"],
2612            event_mask=_maybe(RuntimeEventFlag, raw["event_mask"]),
2613            tile_cache_enabled=raw["tile_cache_enabled"],
2614        )

Options for RuntimeHandle.create_map().

See mln_map_options in the C API reference.

MapOptions( initial_extent: LogicalExtent, map_mode: MapMode = <MapMode.CONTINUOUS: 0>, fast_pfor_enabled: bool = False, event_mask: RuntimeEventFlag | None = None, tile_cache_enabled: bool | None = None)
initial_extent: LogicalExtent

The map's first size, and its scale factor. The scale factor stays fixed for the map's life, and every render session of the map renders at it.

map_mode: MapMode
fast_pfor_enabled: bool

Whether the map decodes MapLibre Tiles (MLT) that use FastPFOR integer encoding. Without it, such tiles fail to load.

event_mask: RuntimeEventFlag | None

The events that the map reports. Without it, the map reports them all.

tile_cache_enabled: bool | None

Whether the map keeps tiles in memory after they leave the view, so they show again without loading. Without it, the map keeps them.

@dataclass(frozen=True, slots=True)
class MapProjectionCameraResult:
2617@dataclass(frozen=True, slots=True)
2618class MapProjectionCameraResult:
2619    """A projection's camera, as `MapProjectionHandle.get_camera()` reports it.
2620
2621    See `mln_map_projection_camera_result` in the
2622    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html).
2623    """
2624
2625    camera: Camera
2626
2627    @classmethod
2628    def _from_native(cls, raw):
2629        return cls(camera=Camera._from_native(raw["camera"]))

A projection's camera, as MapProjectionHandle.get_camera() reports it.

See mln_map_projection_camera_result in the C API reference.

MapProjectionCameraResult(camera: Camera)
camera: Camera
class MapProjectionHandle(maplibre_native_ffi._generated_operations._MapProjectionHandleOperations, maplibre_native_ffi._lifecycle.ScopedHandleMixin):

A camera view for converting between screen points and coordinates.

See mln_map_projection in the C API reference.

@classmethod
def create( cls, view: MapView) -> MapProjectionHandle:
2094    @classmethod
2095    def create(cls, view: MapView) -> MapProjectionHandle:
2096        """Creates a projection that converts coordinates for one view of a map.
2097
2098        Create it from the `view` of an `MapSnapshot` or an
2099        `RenderFrameResult`. The projection doesn't follow the map, so create
2100        a new one after the map's camera or size changes.
2101
2102        See `mln_map_projection_create` in the
2103        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html).
2104        """
2105        return _adopt_value(
2106            _native._MapProjectionHandle.create(view), "MapProjectionHandle", None
2107        )

Creates a projection that converts coordinates for one view of a map.

Create it from the view of an MapSnapshot or an RenderFrameResult. The projection doesn't follow the map, so create a new one after the map's camera or size changes.

See mln_map_projection_create in the C API reference.

def get_camera(self) -> MapProjectionCameraResult:
2109    def get_camera(self) -> MapProjectionCameraResult:
2110        """Reads the projection's camera.
2111
2112        See `mln_map_projection_get_camera` in the
2113        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html).
2114        """
2115        return MapProjectionCameraResult._from_native(self._native.get_camera())

Reads the projection's camera.

See mln_map_projection_get_camera in the C API reference.

def lat_lng_for_pixel( self, point: ScreenPoint) -> LatLng:
2117    def lat_lng_for_pixel(self, point: ScreenPoint) -> LatLng:
2118        """Finds the coordinate at a screen point.
2119
2120        The longitude stays between -180 and 180.
2121
2122        See `mln_map_projection_lat_lng_for_pixel` in the
2123        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html).
2124        """
2125        return LatLng._from_native(self._native.lat_lng_for_pixel(point))

Finds the coordinate at a screen point.

The longitude stays between -180 and 180.

See mln_map_projection_lat_lng_for_pixel in the C API reference.

def lat_lng_for_pixel_unwrapped( self, point: ScreenPoint) -> LatLng:
2127    def lat_lng_for_pixel_unwrapped(self, point: ScreenPoint) -> LatLng:
2128        """Finds the coordinate at a screen point, without wrapping its
2129        longitude.
2130
2131        The longitude can fall outside -180 to 180, to show which copy of the
2132        world the point is in.
2133
2134        See `mln_map_projection_lat_lng_for_pixel_unwrapped` in the
2135        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html).
2136        """
2137        return LatLng._from_native(self._native.lat_lng_for_pixel_unwrapped(point))

Finds the coordinate at a screen point, without wrapping its longitude.

The longitude can fall outside -180 to 180, to show which copy of the world the point is in.

See mln_map_projection_lat_lng_for_pixel_unwrapped in the C API reference.

def lat_lngs_for_pixels( self, points: Sequence[ScreenPoint]) -> tuple[LatLng, ...]:
2139    def lat_lngs_for_pixels(self, points: Sequence[ScreenPoint]) -> tuple[LatLng, ...]:
2140        """Finds the coordinates at several screen points, as
2141        `MapProjectionHandle.lat_lng_for_pixel()` does.
2142
2143        See `mln_map_projection_lat_lngs_for_pixels` in the
2144        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html).
2145        """
2146        return tuple(
2147            LatLng._from_native(item)
2148            for item in self._native.lat_lngs_for_pixels(points)
2149        )

Finds the coordinates at several screen points, as MapProjectionHandle.lat_lng_for_pixel() does.

See mln_map_projection_lat_lngs_for_pixels in the C API reference.

def lat_lngs_for_pixels_unwrapped( self, points: Sequence[ScreenPoint]) -> tuple[LatLng, ...]:
2151    def lat_lngs_for_pixels_unwrapped(
2152        self, points: Sequence[ScreenPoint]
2153    ) -> tuple[LatLng, ...]:
2154        """Finds the coordinates at several screen points, as
2155        `MapProjectionHandle.lat_lng_for_pixel_unwrapped()` does.
2156
2157        See `mln_map_projection_lat_lngs_for_pixels_unwrapped` in the
2158        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html).
2159        """
2160        return tuple(
2161            LatLng._from_native(item)
2162            for item in self._native.lat_lngs_for_pixels_unwrapped(points)
2163        )

Finds the coordinates at several screen points, as MapProjectionHandle.lat_lng_for_pixel_unwrapped() does.

See mln_map_projection_lat_lngs_for_pixels_unwrapped in the C API reference.

def meters_per_pixel_at_latitude(self, latitude: float) -> float:
2165    def meters_per_pixel_at_latitude(self, latitude: float) -> float:
2166        """Computes how many meters one screen pixel covers at `latitude`, at
2167        the projection's zoom.
2168
2169        The result ignores the camera's pitch.
2170
2171        See `mln_map_projection_meters_per_pixel_at_latitude` in the
2172        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html).
2173        """
2174        return self._native.meters_per_pixel_at_latitude(latitude)

Computes how many meters one screen pixel covers at latitude, at the projection's zoom.

The result ignores the camera's pitch.

See mln_map_projection_meters_per_pixel_at_latitude in the C API reference.

def pixel_for_lat_lng( self, coordinate: LatLng) -> ScreenPoint:
2176    def pixel_for_lat_lng(self, coordinate: LatLng) -> ScreenPoint:
2177        """Finds the screen point of a coordinate.
2178
2179        The point is in the copy of the world nearest the camera's center.
2180
2181        See `mln_map_projection_pixel_for_lat_lng` in the
2182        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html).
2183        """
2184        return ScreenPoint._from_native(self._native.pixel_for_lat_lng(coordinate))

Finds the screen point of a coordinate.

The point is in the copy of the world nearest the camera's center.

See mln_map_projection_pixel_for_lat_lng in the C API reference.

def pixels_for_lat_lngs( self, coordinates: Sequence[LatLng]) -> tuple[ScreenPoint, ...]:
2186    def pixels_for_lat_lngs(
2187        self, coordinates: Sequence[LatLng]
2188    ) -> tuple[ScreenPoint, ...]:
2189        """Finds the screen points of several coordinates, as
2190        `MapProjectionHandle.pixel_for_lat_lng()` does.
2191
2192        See `mln_map_projection_pixels_for_lat_lngs` in the
2193        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html).
2194        """
2195        return tuple(
2196            ScreenPoint._from_native(item)
2197            for item in self._native.pixels_for_lat_lngs(coordinates)
2198        )

Finds the screen points of several coordinates, as MapProjectionHandle.pixel_for_lat_lng() does.

See mln_map_projection_pixels_for_lat_lngs in the C API reference.

def release(self) -> None:
2200    def release(self) -> None:
2201        """Releases a projection.
2202
2203        See `mln_map_projection_release` in the
2204        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html).
2205        """
2206        return self._native.release()

Releases a projection.

See mln_map_projection_release in the C API reference.

def set_camera( self, camera: CameraOptions) -> None:
2208    def set_camera(self, camera: CameraOptions) -> None:
2209        """Moves the projection's camera, without changing the map.
2210
2211        Camera fields that `camera` doesn't set keep their values.
2212
2213        See `mln_map_projection_set_camera` in the
2214        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html).
2215        """
2216        return self._native.set_camera(camera)

Moves the projection's camera, without changing the map.

Camera fields that camera doesn't set keep their values.

See mln_map_projection_set_camera in the C API reference.

id: int
145    @property
146    def id(self) -> int:
147        """The native handle value. It stays readable after release."""
148        return int(self._native.id)

The native handle value. It stays readable after release.

@dataclass(frozen=True, slots=True)
class MapSnapshot:
2632@dataclass(frozen=True, slots=True)
2633class MapSnapshot:
2634    """A map's state, as `MapHandle.get_snapshot()` reads it.
2635
2636    See `mln_map_snapshot` in the
2637    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
2638    """
2639
2640    debug_flags: MapDebugFlag
2641
2642    generation: int
2643    """Grows with each change to the map's state."""
2644
2645    fully_loaded: bool
2646    """Whether the style and every resource that the view needs have loaded."""
2647
2648    rendering_stats_view_enabled: bool
2649
2650    gesture_in_progress: bool
2651
2652    transition_in_progress: bool
2653
2654    event_mask: RuntimeEventFlag
2655
2656    latest_render_update_generation: int
2657    """Counts the render updates that the map has made for its render session."""
2658
2659    tile: MapTileSettings
2660
2661    bounds: CameraBounds
2662
2663    free_camera: FreeCamera
2664
2665    view: MapView
2666
2667    @classmethod
2668    def _from_native(cls, raw):
2669        return cls(
2670            debug_flags=MapDebugFlag(raw["debug_flags"]),
2671            generation=raw["generation"],
2672            fully_loaded=raw["fully_loaded"],
2673            rendering_stats_view_enabled=raw["rendering_stats_view_enabled"],
2674            gesture_in_progress=raw["gesture_in_progress"],
2675            transition_in_progress=raw["transition_in_progress"],
2676            event_mask=RuntimeEventFlag(raw["event_mask"]),
2677            latest_render_update_generation=raw["latest_render_update_generation"],
2678            tile=MapTileSettings._from_native(raw["tile"]),
2679            bounds=CameraBounds._from_native(raw["bounds"]),
2680            free_camera=FreeCamera._from_native(raw["free_camera"]),
2681            view=MapView._from_native(raw["view"]),
2682        )

A map's state, as MapHandle.get_snapshot() reads it.

See mln_map_snapshot in the C API reference.

MapSnapshot( debug_flags: MapDebugFlag, generation: int, fully_loaded: bool, rendering_stats_view_enabled: bool, gesture_in_progress: bool, transition_in_progress: bool, event_mask: RuntimeEventFlag, latest_render_update_generation: int, tile: MapTileSettings, bounds: CameraBounds, free_camera: FreeCamera, view: MapView)
debug_flags: MapDebugFlag
generation: int

Grows with each change to the map's state.

fully_loaded: bool

Whether the style and every resource that the view needs have loaded.

rendering_stats_view_enabled: bool
gesture_in_progress: bool
transition_in_progress: bool
event_mask: RuntimeEventFlag
latest_render_update_generation: int

Counts the render updates that the map has made for its render session.

bounds: CameraBounds
free_camera: FreeCamera
view: MapView
@dataclass(frozen=True, slots=True)
class MapTileOptions:
2685@dataclass(frozen=True, slots=True)
2686class MapTileOptions:
2687    """How the map picks the tiles to load.
2688
2689    The `lod_` members lower the level of detail away from the camera, so the
2690    map loads fewer tiles when the pitch is high.
2691
2692    See `mln_map_tile_options` in the
2693    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
2694    """
2695
2696    prefetch_zoom_delta: int | None = None
2697    """How many zoom levels lower the map also loads tiles for, so it can show a
2698    coarse map while the current tiles load. 0 loads only the current tiles.
2699    """
2700
2701    lod_min_radius: float | None = None
2702    """The radius around the view point, in tiles, that keeps full detail."""
2703
2704    lod_scale: float | None = None
2705    """Scales the distance to the view point. Above 1 lowers the detail."""
2706
2707    lod_pitch_threshold: float | None = None
2708    """The pitch, in degrees, above which the map lowers the detail."""
2709
2710    lod_zoom_shift: float | None = None
2711    """Zoom levels to add for picking the detail. Below 0 loads fewer tiles."""
2712
2713    lod_mode: TileLodMode | None = None
2714    """`TileLodMode.DISTANCE` ignores `lod_min_radius`."""
2715
2716    @classmethod
2717    def _from_native(cls, raw):
2718        return cls(
2719            prefetch_zoom_delta=raw["prefetch_zoom_delta"],
2720            lod_min_radius=raw["lod_min_radius"],
2721            lod_scale=raw["lod_scale"],
2722            lod_pitch_threshold=raw["lod_pitch_threshold"],
2723            lod_zoom_shift=raw["lod_zoom_shift"],
2724            lod_mode=_maybe(TileLodMode, raw["lod_mode"]),
2725        )

How the map picks the tiles to load.

The lod_ members lower the level of detail away from the camera, so the map loads fewer tiles when the pitch is high.

See mln_map_tile_options in the C API reference.

MapTileOptions( prefetch_zoom_delta: int | None = None, lod_min_radius: float | None = None, lod_scale: float | None = None, lod_pitch_threshold: float | None = None, lod_zoom_shift: float | None = None, lod_mode: TileLodMode | None = None)
prefetch_zoom_delta: int | None

How many zoom levels lower the map also loads tiles for, so it can show a coarse map while the current tiles load. 0 loads only the current tiles.

lod_min_radius: float | None

The radius around the view point, in tiles, that keeps full detail.

lod_scale: float | None

Scales the distance to the view point. Above 1 lowers the detail.

lod_pitch_threshold: float | None

The pitch, in degrees, above which the map lowers the detail.

lod_zoom_shift: float | None

Zoom levels to add for picking the detail. Below 0 loads fewer tiles.

lod_mode: TileLodMode | None
@dataclass(frozen=True, slots=True)
class MapTileSettings:
2728@dataclass(frozen=True, slots=True)
2729class MapTileSettings:
2730    """All the settings for how a map picks the tiles to load.
2731
2732    Its members mean the same as those of `MapTileOptions`.
2733
2734    See `mln_map_tile_settings` in the
2735    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
2736    """
2737
2738    prefetch_zoom_delta: int
2739
2740    lod_min_radius: float
2741
2742    lod_scale: float
2743
2744    lod_pitch_threshold: float
2745    """The pitch, in degrees, above which the map lowers the detail."""
2746
2747    lod_zoom_shift: float
2748
2749    lod_mode: TileLodMode
2750
2751    @classmethod
2752    def _from_native(cls, raw):
2753        return cls(
2754            prefetch_zoom_delta=raw["prefetch_zoom_delta"],
2755            lod_min_radius=raw["lod_min_radius"],
2756            lod_scale=raw["lod_scale"],
2757            lod_pitch_threshold=raw["lod_pitch_threshold"],
2758            lod_zoom_shift=raw["lod_zoom_shift"],
2759            lod_mode=TileLodMode(raw["lod_mode"]),
2760        )

All the settings for how a map picks the tiles to load.

Its members mean the same as those of MapTileOptions.

See mln_map_tile_settings in the C API reference.

MapTileSettings( prefetch_zoom_delta: int, lod_min_radius: float, lod_scale: float, lod_pitch_threshold: float, lod_zoom_shift: float, lod_mode: TileLodMode)
prefetch_zoom_delta: int
lod_min_radius: float
lod_scale: float
lod_pitch_threshold: float

The pitch, in degrees, above which the map lowers the detail.

lod_zoom_shift: float
lod_mode: TileLodMode
@dataclass(frozen=True, slots=True)
class MapView:
2763@dataclass(frozen=True, slots=True)
2764class MapView:
2765    """One view of a map: its camera, size, and projection.
2766
2767    See `mln_map_view` in the
2768    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
2769    """
2770
2771    camera: Camera = field(default_factory=lambda: Camera())
2772
2773    extent: LogicalExtent = field(default_factory=lambda: LogicalExtent())
2774
2775    projection_mode: ProjectionMode = field(default_factory=lambda: ProjectionMode())
2776
2777    viewport: MapViewport = field(default_factory=lambda: MapViewport())
2778
2779    @classmethod
2780    def _from_native(cls, raw):
2781        return cls(
2782            camera=Camera._from_native(raw["camera"]),
2783            extent=LogicalExtent._from_native(raw["extent"]),
2784            projection_mode=ProjectionMode._from_native(raw["projection_mode"]),
2785            viewport=MapViewport._from_native(raw["viewport"]),
2786        )

One view of a map: its camera, size, and projection.

See mln_map_view in the C API reference.

MapView( camera: Camera = <factory>, extent: LogicalExtent = <factory>, projection_mode: ProjectionMode = <factory>, viewport: MapViewport = <factory>)
camera: Camera
extent: LogicalExtent
projection_mode: ProjectionMode
viewport: MapViewport
@dataclass(frozen=True, slots=True)
class MapViewport:
2789@dataclass(frozen=True, slots=True)
2790class MapViewport:
2791    """A map's whole viewport.
2792
2793    Its members mean the same as those of `MapViewportOptions`.
2794
2795    See `mln_map_viewport` in the
2796    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
2797    """
2798
2799    north_orientation: NorthOrientation = NorthOrientation.UP
2800
2801    constrain_mode: ConstrainMode = ConstrainMode.NONE
2802
2803    viewport_mode: ViewportMode = ViewportMode.DEFAULT
2804
2805    frustum_offset: EdgeInsets = field(default_factory=lambda: EdgeInsets())
2806
2807    @classmethod
2808    def _from_native(cls, raw):
2809        return cls(
2810            north_orientation=NorthOrientation(raw["north_orientation"]),
2811            constrain_mode=ConstrainMode(raw["constrain_mode"]),
2812            viewport_mode=ViewportMode(raw["viewport_mode"]),
2813            frustum_offset=EdgeInsets._from_native(raw["frustum_offset"]),
2814        )

A map's whole viewport.

Its members mean the same as those of MapViewportOptions.

See mln_map_viewport in the C API reference.

MapViewport( north_orientation: NorthOrientation = <NorthOrientation.UP: 0>, constrain_mode: ConstrainMode = <ConstrainMode.NONE: 0>, viewport_mode: ViewportMode = <ViewportMode.DEFAULT: 0>, frustum_offset: EdgeInsets = <factory>)
north_orientation: NorthOrientation
constrain_mode: ConstrainMode
viewport_mode: ViewportMode
frustum_offset: EdgeInsets
@dataclass(frozen=True, slots=True)
class MapViewportOptions:
2817@dataclass(frozen=True, slots=True)
2818class MapViewportOptions:
2819    """How the map orients and constrains its view.
2820
2821    See `mln_map_viewport_options` in the
2822    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
2823    """
2824
2825    north_orientation: NorthOrientation | None = None
2826
2827    constrain_mode: ConstrainMode | None = None
2828
2829    viewport_mode: ViewportMode | None = None
2830
2831    frustum_offset: EdgeInsets | None = None
2832
2833    @classmethod
2834    def _from_native(cls, raw):
2835        return cls(
2836            north_orientation=_maybe(NorthOrientation, raw["north_orientation"]),
2837            constrain_mode=_maybe(ConstrainMode, raw["constrain_mode"]),
2838            viewport_mode=_maybe(ViewportMode, raw["viewport_mode"]),
2839            frustum_offset=_maybe(EdgeInsets._from_native, raw["frustum_offset"]),
2840        )

How the map orients and constrains its view.

See mln_map_viewport_options in the C API reference.

MapViewportOptions( north_orientation: NorthOrientation | None = None, constrain_mode: ConstrainMode | None = None, viewport_mode: ViewportMode | None = None, frustum_offset: EdgeInsets | None = None)
north_orientation: NorthOrientation | None
constrain_mode: ConstrainMode | None
viewport_mode: ViewportMode | None
frustum_offset: EdgeInsets | None
@dataclass(frozen=True, slots=True)
class MetalBorrowedTexture:
2843@dataclass(frozen=True, slots=True)
2844class MetalBorrowedTexture:
2845    """A Metal texture of a borrowed ring.
2846
2847    See `mln_metal_borrowed_texture` in the
2848    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
2849    """
2850
2851    texture: int
2852    """Your MTLTexture."""
2853
2854    @classmethod
2855    def _from_native(cls, raw):
2856        return cls(texture=raw["texture"])

A Metal texture of a borrowed ring.

See mln_metal_borrowed_texture in the C API reference.

MetalBorrowedTexture(texture: int)
texture: int

Your MTLTexture.

@dataclass(frozen=True, slots=True)
class MetalBorrowedTextureDescriptor:
2859@dataclass(frozen=True, slots=True)
2860class MetalBorrowedTextureDescriptor:
2861    """A ring of your Metal textures, for
2862    `MapHandle.attach_metal_borrowed_texture()`.
2863
2864    `logical_size` sets the map's size. `physical_width` and
2865    `physical_height` give the textures' size in pixels, which is usually
2866    `logical_size` times the map's scale factor. The textures must all have
2867    that size, one device, one pixel format, one sample, and
2868    MTLTextureUsageRenderTarget. The ring holds up to
2869    `TEXTURE_RING_MAX_DEPTH` distinct textures.
2870
2871    The session uses the textures until a replacement or release of the
2872    target completes, a detach or release of the session completes, or an
2873    abandon of it returns.
2874
2875    See `mln_metal_borrowed_texture_descriptor` in the
2876    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
2877    """
2878
2879    logical_size: LogicalSize
2880
2881    physical_width: int
2882
2883    physical_height: int
2884
2885    textures: Sequence[MetalBorrowedTexture]
2886
2887    command_queue: int = 0
2888    """Your MTLCommandQueue on the textures' device, or null for a queue of the
2889    session's own. With your queue, frames can use `GpuSyncKind.QUEUE_ORDER`.
2890    """
2891
2892    def __post_init__(self):
2893        object.__setattr__(self, "textures", _sequence(self.textures))
2894
2895    @classmethod
2896    def _from_native(cls, raw):
2897        return cls(
2898            logical_size=LogicalSize._from_native(raw["logical_size"]),
2899            physical_width=raw["physical_width"],
2900            physical_height=raw["physical_height"],
2901            textures=tuple(
2902                MetalBorrowedTexture._from_native(item) for item in raw["textures"]
2903            ),
2904            command_queue=raw["command_queue"],
2905        )

A ring of your Metal textures, for MapHandle.attach_metal_borrowed_texture().

logical_size sets the map's size. physical_width and physical_height give the textures' size in pixels, which is usually logical_size times the map's scale factor. The textures must all have that size, one device, one pixel format, one sample, and MTLTextureUsageRenderTarget. The ring holds up to TEXTURE_RING_MAX_DEPTH distinct textures.

The session uses the textures until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.

See mln_metal_borrowed_texture_descriptor in the C API reference.

MetalBorrowedTextureDescriptor( logical_size: LogicalSize, physical_width: int, physical_height: int, textures: Sequence[MetalBorrowedTexture], command_queue: int = 0)
logical_size: LogicalSize
physical_width: int
physical_height: int
textures: Sequence[MetalBorrowedTexture]
command_queue: int

Your MTLCommandQueue on the textures' device, or null for a queue of the session's own. With your queue, frames can use GpuSyncKind.QUEUE_ORDER.

@dataclass(frozen=True, slots=True)
class MetalBorrowedTextureReplacement:
2908@dataclass(frozen=True, slots=True)
2909class MetalBorrowedTextureReplacement:
2910    """New Metal textures for a borrowed ring, for
2911    `RenderSessionHandle.set_metal_borrowed_texture_target()`.
2912
2913    The members and the textures follow the rules of
2914    `MetalBorrowedTextureDescriptor`. The ring keeps its depth, device, and
2915    command queue, so give it as many textures as it attached with, on the
2916    same device.
2917
2918    See `mln_metal_borrowed_texture_replacement` in the
2919    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
2920    """
2921
2922    logical_size: LogicalSize
2923
2924    physical_width: int
2925
2926    physical_height: int
2927
2928    textures: Sequence[MetalBorrowedTexture]
2929
2930    def __post_init__(self):
2931        object.__setattr__(self, "textures", _sequence(self.textures))
2932
2933    @classmethod
2934    def _from_native(cls, raw):
2935        return cls(
2936            logical_size=LogicalSize._from_native(raw["logical_size"]),
2937            physical_width=raw["physical_width"],
2938            physical_height=raw["physical_height"],
2939            textures=tuple(
2940                MetalBorrowedTexture._from_native(item) for item in raw["textures"]
2941            ),
2942        )

New Metal textures for a borrowed ring, for RenderSessionHandle.set_metal_borrowed_texture_target().

The members and the textures follow the rules of MetalBorrowedTextureDescriptor. The ring keeps its depth, device, and command queue, so give it as many textures as it attached with, on the same device.

See mln_metal_borrowed_texture_replacement in the C API reference.

MetalBorrowedTextureReplacement( logical_size: LogicalSize, physical_width: int, physical_height: int, textures: Sequence[MetalBorrowedTexture])
logical_size: LogicalSize
physical_width: int
physical_height: int
textures: Sequence[MetalBorrowedTexture]
@dataclass(frozen=True, slots=True)
class MetalContextDescriptor:
2945@dataclass(frozen=True, slots=True)
2946class MetalContextDescriptor:
2947    """The Metal device that a render session uses.
2948
2949    See `mln_metal_context_descriptor` in the
2950    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html).
2951    """
2952
2953    device: int = 0
2954    """An `MTLDevice`."""
2955
2956    @classmethod
2957    def _from_native(cls, raw):
2958        return cls(device=raw["device"])

The Metal device that a render session uses.

See mln_metal_context_descriptor in the C API reference.

MetalContextDescriptor(device: int = 0)
device: int

An MTLDevice.

@dataclass(frozen=True, slots=True)
class MetalSurfaceDescriptor:
2961@dataclass(frozen=True, slots=True)
2962class MetalSurfaceDescriptor:
2963    """A Metal layer to render to, for `MapHandle.attach_metal_surface()`.
2964
2965    The session sets the layer's device, pixel format, and drawable size. It
2966    uses the layer until a replacement or release of the target completes, a
2967    detach or release of the session completes, or an abandon of it returns.
2968
2969    See `mln_metal_surface_descriptor` in the
2970    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html).
2971    """
2972
2973    logical_size: LogicalSize
2974
2975    layer: int
2976    """Your CAMetalLayer."""
2977
2978    context: MetalContextDescriptor = field(
2979        default_factory=lambda: MetalContextDescriptor()
2980    )
2981    """The MTLDevice to render with. A null device picks the system's default."""
2982
2983    @classmethod
2984    def _from_native(cls, raw):
2985        return cls(
2986            logical_size=LogicalSize._from_native(raw["logical_size"]),
2987            context=MetalContextDescriptor._from_native(raw["context"]),
2988            layer=raw["layer"],
2989        )

A Metal layer to render to, for MapHandle.attach_metal_surface().

The session sets the layer's device, pixel format, and drawable size. It uses the layer until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.

See mln_metal_surface_descriptor in the C API reference.

MetalSurfaceDescriptor( logical_size: LogicalSize, layer: int, context: MetalContextDescriptor = <factory>)
logical_size: LogicalSize
layer: int

Your CAMetalLayer.

The MTLDevice to render with. A null device picks the system's default.

@dataclass(frozen=True, slots=True)
class MetalSurfaceReplacement:
2992@dataclass(frozen=True, slots=True)
2993class MetalSurfaceReplacement:
2994    """A new Metal layer for `RenderSessionHandle.set_metal_surface_target()`.
2995
2996    The session renders to it with the device that it attached with. It uses
2997    the layer until a replacement or release of the target completes, a
2998    detach or release of the session completes, or an abandon of it returns.
2999
3000    See `mln_metal_surface_replacement` in the
3001    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html).
3002    """
3003
3004    logical_size: LogicalSize
3005
3006    layer: int
3007    """Your CAMetalLayer."""
3008
3009    @classmethod
3010    def _from_native(cls, raw):
3011        return cls(
3012            logical_size=LogicalSize._from_native(raw["logical_size"]),
3013            layer=raw["layer"],
3014        )

A new Metal layer for RenderSessionHandle.set_metal_surface_target().

The session renders to it with the device that it attached with. It uses the layer until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.

See mln_metal_surface_replacement in the C API reference.

MetalSurfaceReplacement( logical_size: LogicalSize, layer: int)
logical_size: LogicalSize
layer: int

Your CAMetalLayer.

@dataclass(frozen=True, slots=True)
class MetalTextureFrame:
3017@dataclass(frozen=True, slots=True)
3018class MetalTextureFrame:
3019    """The Metal texture of an acquired frame.
3020
3021    See `mln_metal_texture_frame` in the
3022    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
3023    """
3024
3025    width: int
3026
3027    height: int
3028
3029    scale_factor: float
3030
3031    slot: int
3032    """The texture's index in the descriptor's `textures`."""
3033
3034    texture: int
3035    """The MTLTexture."""
3036
3037    device: int
3038    """The texture's MTLDevice."""
3039
3040    pixel_format: int
3041    """The texture's MTLPixelFormat."""
3042
3043    @classmethod
3044    def _from_native(cls, raw):
3045        return cls(
3046            width=raw["width"],
3047            height=raw["height"],
3048            scale_factor=raw["scale_factor"],
3049            slot=raw["slot"],
3050            texture=raw["texture"],
3051            device=raw["device"],
3052            pixel_format=raw["pixel_format"],
3053        )

The Metal texture of an acquired frame.

See mln_metal_texture_frame in the C API reference.

MetalTextureFrame( width: int, height: int, scale_factor: float, slot: int, texture: int, device: int, pixel_format: int)
width: int
height: int
scale_factor: float
slot: int

The texture's index in the descriptor's textures.

texture: int

The MTLTexture.

device: int

The texture's MTLDevice.

pixel_format: int

The texture's MTLPixelFormat.

@dataclass(frozen=True, slots=True)
class MomentumDecay:
3056@dataclass(frozen=True, slots=True)
3057class MomentumDecay:
3058    """How one part of a gesture's momentum slows from its release speed.
3059
3060    Speeds and distances are in the part's unit: logical pixels for pan, zoom
3061    levels for zoom, and degrees for bearing and pitch. A setting whose bit
3062    isn't set takes the part's default, which `GestureMomentum` lists.
3063    `min_speed` is finite and not negative, and every other number is finite
3064    and positive. A friction decay can serve every release, as a preset that
3065    matches a platform's scrolling. An eased glide takes its direction from
3066    the part's velocity, and its distance and duration from the caller's
3067    plan.
3068
3069    See `mln_momentum_decay` in the
3070    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3071    """
3072
3073    model: MomentumDecayModel | None = None
3074
3075    half_life_ms: float | None = None
3076    """For `MomentumDecayModel.FRICTION`, how long the speed takes to halve."""
3077
3078    stop_speed: float | None = None
3079    """For `MomentumDecayModel.FRICTION`, the speed at which it ends."""
3080
3081    distance: float | None = None
3082    """Required for `MomentumDecayModel.EASE`."""
3083
3084    duration_ms: float | None = None
3085    """Required for `MomentumDecayModel.EASE`."""
3086
3087    easing: UnitBezier | None = None
3088    """For `MomentumDecayModel.EASE`, the share of `distance` covered over the
3089    share of `duration_ms`. Its control points are between 0 and 1, so the
3090    glide never passes its distance. Defaults to (0, 0, 0.25, 1), the curve
3091    that camera animations ease along by default. Android's scroll fling
3092    follows (0.175, 0.5, 0.35, 1).
3093    """
3094
3095    min_speed: float | None = None
3096    """A slower release starts no momentum."""
3097
3098    max_speed: float | None = None
3099    """For `MomentumDecayModel.FRICTION`, a faster release counts as this."""
3100
3101    max_distance: float | None = None
3102    """The farthest the part moves. A friction release that would move farther
3103    starts slower, so it ends sooner, and a planned glide moves at most this
3104    far over its duration.
3105    """
3106
3107    @classmethod
3108    def _from_native(cls, raw):
3109        return cls(
3110            model=_maybe(MomentumDecayModel, raw["model"]),
3111            half_life_ms=raw["half_life_ms"],
3112            stop_speed=raw["stop_speed"],
3113            distance=raw["distance"],
3114            duration_ms=raw["duration_ms"],
3115            easing=_maybe(UnitBezier._from_native, raw["easing"]),
3116            min_speed=raw["min_speed"],
3117            max_speed=raw["max_speed"],
3118            max_distance=raw["max_distance"],
3119        )

How one part of a gesture's momentum slows from its release speed.

Speeds and distances are in the part's unit: logical pixels for pan, zoom levels for zoom, and degrees for bearing and pitch. A setting whose bit isn't set takes the part's default, which GestureMomentum lists. min_speed is finite and not negative, and every other number is finite and positive. A friction decay can serve every release, as a preset that matches a platform's scrolling. An eased glide takes its direction from the part's velocity, and its distance and duration from the caller's plan.

See mln_momentum_decay in the C API reference.

MomentumDecay( model: MomentumDecayModel | None = None, half_life_ms: float | None = None, stop_speed: float | None = None, distance: float | None = None, duration_ms: float | None = None, easing: UnitBezier | None = None, min_speed: float | None = None, max_speed: float | None = None, max_distance: float | None = None)
model: MomentumDecayModel | None
half_life_ms: float | None

For MomentumDecayModel.FRICTION, how long the speed takes to halve.

stop_speed: float | None

For MomentumDecayModel.FRICTION, the speed at which it ends.

distance: float | None
duration_ms: float | None
easing: UnitBezier | None

For MomentumDecayModel.EASE, the share of distance covered over the share of duration_ms. Its control points are between 0 and 1, so the glide never passes its distance. Defaults to (0, 0, 0.25, 1), the curve that camera animations ease along by default. Android's scroll fling follows (0.175, 0.5, 0.35, 1).

min_speed: float | None

A slower release starts no momentum.

max_speed: float | None

For MomentumDecayModel.FRICTION, a faster release counts as this.

max_distance: float | None

The farthest the part moves. A friction release that would move farther starts slower, so it ends sooner, and a planned glide moves at most this far over its duration.

class MomentumDecayModel(maplibre_native_ffi._enum.UnknownIntEnum):
531class MomentumDecayModel(UnknownIntEnum):
532    """How a part of a gesture's momentum slows from its release speed.
533
534    See `mln_momentum_decay_model` in the
535    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
536    """
537
538    FRICTION = 0
539    EASE = 1

How a part of a gesture's momentum slows from its release speed.

See mln_momentum_decay_model in the C API reference.

FRICTION = <MomentumDecayModel.FRICTION: 0>
@dataclass(frozen=True, slots=True)
class MomentumSnap:
3122@dataclass(frozen=True, slots=True)
3123class MomentumSnap:
3124    """Where a part settles after a gesture that changed it.
3125
3126    The targets are every `spacing` from `offset`, in the part's unit.
3127    Bearing targets wrap around the circle. Once the part's glide ends, or
3128    right away when it doesn't move, the part eases to the nearest target if
3129    it is within `tolerance` of it, and otherwise stays where it is. A
3130    setting whose bit isn't set takes the part's default, which
3131    `GestureMomentum` lists.
3132
3133    See `mln_momentum_snap` in the
3134    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3135    """
3136
3137    spacing: float | None = None
3138    """Positive."""
3139
3140    offset: float | None = None
3141    """Defaults to 0."""
3142
3143    tolerance: float | None = None
3144    """Not negative."""
3145
3146    duration_ms: float | None = None
3147    """Zero settles without easing. Defaults to 300."""
3148
3149    @classmethod
3150    def _from_native(cls, raw):
3151        return cls(
3152            spacing=raw["spacing"],
3153            offset=raw["offset"],
3154            tolerance=raw["tolerance"],
3155            duration_ms=raw["duration_ms"],
3156        )

Where a part settles after a gesture that changed it.

The targets are every spacing from offset, in the part's unit. Bearing targets wrap around the circle. Once the part's glide ends, or right away when it doesn't move, the part eases to the nearest target if it is within tolerance of it, and otherwise stays where it is. A setting whose bit isn't set takes the part's default, which GestureMomentum lists.

See mln_momentum_snap in the C API reference.

MomentumSnap( spacing: float | None = None, offset: float | None = None, tolerance: float | None = None, duration_ms: float | None = None)
spacing: float | None

Positive.

offset: float | None

Defaults to 0.

tolerance: float | None

Not negative.

duration_ms: float | None

Zero settles without easing. Defaults to 300.

class NativeQueueLock:
3773class NativeQueueLock:
3774    """A native `QueueLock` from `QueueLock.native`, accepted wherever a
3775    `QueueLock` is.
3776
3777    The first call that carries it consumes it. Native code releases the
3778    context of a call that it accepts, and the binding releases the context
3779    of a call that native code does not accept. A second call raises an
3780    invalid-state error.
3781    """
3782
3783    __slots__ = ("_registration",)
3784
3785    def __init__(self):
3786        raise TypeError("native registrations come from QueueLock.native")
3787
3788    @classmethod
3789    def _from_registration(cls, registration):
3790        value = cls.__new__(cls)
3791        value._registration = registration
3792        return value

A native QueueLock from QueueLock.native, accepted wherever a QueueLock is.

The first call that carries it consumes it. Native code releases the context of a call that it accepts, and the binding releases the context of a call that native code does not accept. A second call raises an invalid-state error.

class NativeWake:
5701class NativeWake:
5702    """A native `Wake` from `Wake.native`, accepted wherever a `Wake` is.
5703
5704    The first call that carries it consumes it. Native code releases the
5705    context of a call that it accepts, and the binding releases the context
5706    of a call that native code does not accept. A second call raises an
5707    invalid-state error.
5708    """
5709
5710    __slots__ = ("_registration",)
5711
5712    def __init__(self):
5713        raise TypeError("native registrations come from Wake.native")
5714
5715    @classmethod
5716    def _from_registration(cls, registration):
5717        value = cls.__new__(cls)
5718        value._registration = registration
5719        return value

A native Wake from Wake.native, accepted wherever a Wake is.

The first call that carries it consumes it. Native code releases the context of a call that it accepts, and the binding releases the context of a call that native code does not accept. A second call raises an invalid-state error.

class NetworkStatus(maplibre_native_ffi._enum.UnknownIntEnum):
542class NetworkStatus(UnknownIntEnum):
543    """Whether the library may use the network.
544
545    See `mln_network_status` in the
546    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
547    """
548
549    ONLINE = 1
550    OFFLINE = 2

Whether the library may use the network.

See mln_network_status in the C API reference.

ONLINE = <NetworkStatus.ONLINE: 1>
OFFLINE = <NetworkStatus.OFFLINE: 2>
class NorthOrientation(maplibre_native_ffi._enum.UnknownIntEnum):
553class NorthOrientation(UnknownIntEnum):
554    """The screen direction that north points to when the bearing is 0.
555
556    See `mln_north_orientation` in the
557    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
558    """
559
560    UP = 0
561    RIGHT = 1
562    DOWN = 2
563    LEFT = 3

The screen direction that north points to when the bearing is 0.

See mln_north_orientation in the C API reference.

RIGHT = <NorthOrientation.RIGHT: 1>
DOWN = <NorthOrientation.DOWN: 2>
LEFT = <NorthOrientation.LEFT: 3>
@dataclass(frozen=True, slots=True)
class OfflineGeometryRegionDefinition:
3159@dataclass(frozen=True, slots=True)
3160class OfflineGeometryRegionDefinition:
3161    """An offline region that covers a GeoJSON geometry.
3162
3163    The members other than `geometry` mean the same as those of
3164    `OfflineTilePyramidRegionDefinition`.
3165
3166    See `mln_offline_geometry_region_definition` in the
3167    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3168    """
3169
3170    geometry: Any
3171
3172    style_url: str = ""
3173
3174    min_zoom: float = 0.0
3175
3176    max_zoom: float = 0.0
3177
3178    pixel_ratio: float = 0.0
3179
3180    include_ideographs: bool = False
3181
3182    @classmethod
3183    def _from_native(cls, raw):
3184        return cls(
3185            style_url=raw["style_url"],
3186            geometry=raw["geometry"],
3187            min_zoom=raw["min_zoom"],
3188            max_zoom=raw["max_zoom"],
3189            pixel_ratio=raw["pixel_ratio"],
3190            include_ideographs=raw["include_ideographs"],
3191        )

An offline region that covers a GeoJSON geometry.

The members other than geometry mean the same as those of OfflineTilePyramidRegionDefinition.

See mln_offline_geometry_region_definition in the C API reference.

OfflineGeometryRegionDefinition( geometry: Any, style_url: str = '', min_zoom: float = 0.0, max_zoom: float = 0.0, pixel_ratio: float = 0.0, include_ideographs: bool = False)
geometry: Any
style_url: str
min_zoom: float
max_zoom: float
pixel_ratio: float
include_ideographs: bool
@dataclass(frozen=True, slots=True)
class OfflineRegionDefinitionGeometryVariant:
167@dataclass(frozen=True, slots=True)
168class OfflineRegionDefinitionGeometryVariant:
169    value: OfflineGeometryRegionDefinition
170    _tag = 2
171
172    @classmethod
173    def _from_native(cls, raw):
174        return cls(OfflineGeometryRegionDefinition._from_native(raw))
OfflineRegionDefinitionGeometryVariant( value: OfflineGeometryRegionDefinition)
@dataclass(frozen=True, slots=True)
class OfflineRegionDefinitionTilePyramidVariant:
157@dataclass(frozen=True, slots=True)
158class OfflineRegionDefinitionTilePyramidVariant:
159    value: OfflineTilePyramidRegionDefinition
160    _tag = 1
161
162    @classmethod
163    def _from_native(cls, raw):
164        return cls(OfflineTilePyramidRegionDefinition._from_native(raw))
OfflineRegionDefinitionTilePyramidVariant( value: OfflineTilePyramidRegionDefinition)
class OfflineRegionDownloadState(maplibre_native_ffi._enum.UnknownIntEnum):
566class OfflineRegionDownloadState(UnknownIntEnum):
567    """Whether an offline region is downloading.
568
569    See `mln_offline_region_download_state` in the
570    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
571    """
572
573    INACTIVE = 0
574    ACTIVE = 1

Whether an offline region is downloading.

See mln_offline_region_download_state in the C API reference.

@dataclass(frozen=True, slots=True)
class OfflineRegionInfo:
3206@dataclass(frozen=True, slots=True)
3207class OfflineRegionInfo:
3208    """An offline region in the runtime's cache file.
3209
3210    See `mln_offline_region_info` in the
3211    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3212    """
3213
3214    id: int
3215
3216    definition: OfflineRegionDefinition
3217
3218    metadata: bytes
3219
3220    @classmethod
3221    def _from_native(cls, raw):
3222        return cls(
3223            id=raw["id"],
3224            definition=_copy_variant(
3225                raw["definition"],
3226                {
3227                    "tile_pyramid": OfflineRegionDefinitionTilePyramidVariant,
3228                    "geometry": OfflineRegionDefinitionGeometryVariant,
3229                },
3230                None,
3231            ),
3232            metadata=raw["metadata"],
3233        )

An offline region in the runtime's cache file.

See mln_offline_region_info in the C API reference.

OfflineRegionInfo(id: int, definition: OfflineRegionDefinition, metadata: bytes)
id: int
metadata: bytes
@dataclass(frozen=True, slots=True)
class OfflineRegionStatus:
3236@dataclass(frozen=True, slots=True)
3237class OfflineRegionStatus:
3238    """The download progress of an offline region.
3239
3240    See `mln_offline_region_status` in the
3241    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
3242    """
3243
3244    download_state: OfflineRegionDownloadState
3245
3246    completed_resource_count: int
3247    """The resources downloaded so far, tiles included."""
3248
3249    completed_resource_size: int
3250    """The size of the downloaded resources in bytes, tiles included."""
3251
3252    completed_tile_count: int
3253
3254    required_tile_count: int
3255
3256    completed_tile_size: int
3257    """The size of the downloaded tiles in bytes."""
3258
3259    required_resource_count: int
3260    """The resources that the region needs, tiles included. Until
3261    `required_resource_count_is_precise` is true, this is only a lower bound.
3262    """
3263
3264    required_resource_count_is_precise: bool
3265
3266    complete: bool
3267    """Whether the region has downloaded every resource it needs."""
3268
3269    @classmethod
3270    def _from_native(cls, raw):
3271        return cls(
3272            download_state=OfflineRegionDownloadState(raw["download_state"]),
3273            completed_resource_count=raw["completed_resource_count"],
3274            completed_resource_size=raw["completed_resource_size"],
3275            completed_tile_count=raw["completed_tile_count"],
3276            required_tile_count=raw["required_tile_count"],
3277            completed_tile_size=raw["completed_tile_size"],
3278            required_resource_count=raw["required_resource_count"],
3279            required_resource_count_is_precise=raw[
3280                "required_resource_count_is_precise"
3281            ],
3282            complete=raw["complete"],
3283        )

The download progress of an offline region.

See mln_offline_region_status in the C API reference.

OfflineRegionStatus( download_state: OfflineRegionDownloadState, completed_resource_count: int, completed_resource_size: int, completed_tile_count: int, required_tile_count: int, completed_tile_size: int, required_resource_count: int, required_resource_count_is_precise: bool, complete: bool)
download_state: OfflineRegionDownloadState
completed_resource_count: int

The resources downloaded so far, tiles included.

completed_resource_size: int

The size of the downloaded resources in bytes, tiles included.

completed_tile_count: int
required_tile_count: int
completed_tile_size: int

The size of the downloaded tiles in bytes.

required_resource_count: int

The resources that the region needs, tiles included. Until required_resource_count_is_precise is true, this is only a lower bound.

required_resource_count_is_precise: bool
complete: bool

Whether the region has downloaded every resource it needs.

@dataclass(frozen=True, slots=True)
class OfflineTilePyramidRegionDefinition:
3286@dataclass(frozen=True, slots=True)
3287class OfflineTilePyramidRegionDefinition:
3288    """An offline region that covers a rectangle of the map.
3289
3290    See `mln_offline_tile_pyramid_region_definition` in the
3291    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3292    """
3293
3294    style_url: str = ""
3295    """The style whose resources the region holds. Maps use the region when they
3296    load the same style URL.
3297    """
3298
3299    bounds: LatLngBounds = field(default_factory=lambda: LatLngBounds())
3300
3301    min_zoom: float = 0.0
3302
3303    max_zoom: float = 0.0
3304    """INFINITY covers every zoom level that the style's sources have."""
3305
3306    pixel_ratio: float = 0.0
3307    """The pixel ratio of the images to download, such as 2 for dense screens."""
3308
3309    include_ideographs: bool = False
3310    """Whether the region holds the glyphs of CJK ideographs."""
3311
3312    @classmethod
3313    def _from_native(cls, raw):
3314        return cls(
3315            style_url=raw["style_url"],
3316            bounds=LatLngBounds._from_native(raw["bounds"]),
3317            min_zoom=raw["min_zoom"],
3318            max_zoom=raw["max_zoom"],
3319            pixel_ratio=raw["pixel_ratio"],
3320            include_ideographs=raw["include_ideographs"],
3321        )

An offline region that covers a rectangle of the map.

See mln_offline_tile_pyramid_region_definition in the C API reference.

OfflineTilePyramidRegionDefinition( style_url: str = '', bounds: LatLngBounds = <factory>, min_zoom: float = 0.0, max_zoom: float = 0.0, pixel_ratio: float = 0.0, include_ideographs: bool = False)
style_url: str

The style whose resources the region holds. Maps use the region when they load the same style URL.

bounds: LatLngBounds
min_zoom: float
max_zoom: float

INFINITY covers every zoom level that the style's sources have.

pixel_ratio: float

The pixel ratio of the images to download, such as 2 for dense screens.

include_ideographs: bool

Whether the region holds the glyphs of CJK ideographs.

@dataclass(frozen=True, slots=True)
class OffscreenDescriptor:
3324@dataclass(frozen=True, slots=True)
3325class OffscreenDescriptor:
3326    """The image that `MapHandle.attach_offscreen()` renders. The session
3327    renders it at the map's scale factor.
3328
3329    See `mln_offscreen_descriptor` in the
3330    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/offscreen_8h.html).
3331    """
3332
3333    logical_size: LogicalSize
3334
3335    @classmethod
3336    def _from_native(cls, raw):
3337        return cls(logical_size=LogicalSize._from_native(raw["logical_size"]))

The image that MapHandle.attach_offscreen() renders. The session renders it at the map's scale factor.

See mln_offscreen_descriptor in the C API reference.

OffscreenDescriptor(logical_size: LogicalSize)
logical_size: LogicalSize
class OffscreenDeviceHandle(maplibre_native_ffi._generated_operations._OffscreenDeviceHandleOperations, maplibre_native_ffi._lifecycle.ScopedHandleMixin):

A GPU device that the library creates to render maps offscreen.

See mln_offscreen_device in the C API reference.

@classmethod
def create( cls, options: OffscreenDeviceOptions | None = None) -> OffscreenDeviceHandle:
2222    @classmethod
2223    def create(
2224        cls, options: OffscreenDeviceOptions | None = None
2225    ) -> OffscreenDeviceHandle:
2226        """Creates a GPU device for rendering maps offscreen.
2227
2228        `MapHandle.attach_offscreen()` creates a device of its own when it
2229        gets none. Create one to share it among the sessions on many maps, or
2230        to pick a GPU.
2231
2232        In a browser WebGPU build, attach without a device instead.
2233
2234        See `mln_offscreen_device_create` in the
2235        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/offscreen_8h.html).
2236
2237        Errors:
2238
2239        - `Status.UNSUPPORTED` in a browser WebGPU build, or when the device
2240          can't render with `client_api`.
2241        - `Status.NATIVE_ERROR` when `adapter_index` names no GPU, or the
2242          platform can't create the device.
2243        """
2244        return _adopt_value(
2245            _native._OffscreenDeviceHandle.create(options),
2246            "OffscreenDeviceHandle",
2247            None,
2248        )

Creates a GPU device for rendering maps offscreen.

MapHandle.attach_offscreen() creates a device of its own when it gets none. Create one to share it among the sessions on many maps, or to pick a GPU.

In a browser WebGPU build, attach without a device instead.

See mln_offscreen_device_create in the C API reference.

Errors:

  • Status.UNSUPPORTED in a browser WebGPU build, or when the device can't render with client_api.
  • Status.NATIVE_ERROR when adapter_index names no GPU, or the platform can't create the device.
def release(self) -> None:
2250    def release(self) -> None:
2251        """Releases an offscreen device.
2252
2253        Render sessions on the device keep working until they detach.
2254
2255        See `mln_offscreen_device_release` in the
2256        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/offscreen_8h.html).
2257        """
2258        return self._native.release()

Releases an offscreen device.

Render sessions on the device keep working until they detach.

See mln_offscreen_device_release in the C API reference.

id: int
171    @property
172    def id(self) -> int:
173        """The native handle value. It stays readable after release."""
174        return int(self._native.id)

The native handle value. It stays readable after release.

@dataclass(frozen=True, slots=True)
class OffscreenDeviceOptions:
3340@dataclass(frozen=True, slots=True)
3341class OffscreenDeviceOptions:
3342    """Options for `OffscreenDeviceHandle.create()`.
3343
3344    See `mln_offscreen_device_options` in the
3345    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/offscreen_8h.html).
3346    """
3347
3348    adapter_index: int | None = None
3349    """The GPU to use, as an index into the platform's list of GPUs."""
3350
3351    single_context: bool | None = None
3352    """Whether the device's sessions take turns in one OpenGL context instead of
3353    having one each. Only an EGL device reads it.
3354    """
3355
3356    client_api: OpenGlClientApi | None = None
3357    """The OpenGL API that the device's sessions render with. An EGL device
3358    defaults to `OpenGlClientApi.GLES`, and takes `OpenGlClientApi.GL` too on
3359    Linux and FreeBSD. A WGL device takes only `OpenGlClientApi.GL`, its
3360    default, and a WebGL device only `OpenGlClientApi.GLES`, its default.
3361    Other devices take neither.
3362    """
3363
3364    @classmethod
3365    def _from_native(cls, raw):
3366        return cls(
3367            adapter_index=raw["adapter_index"],
3368            single_context=raw["single_context"],
3369            client_api=_maybe(OpenGlClientApi, raw["client_api"]),
3370        )

Options for OffscreenDeviceHandle.create().

See mln_offscreen_device_options in the C API reference.

OffscreenDeviceOptions( adapter_index: int | None = None, single_context: bool | None = None, client_api: OpenGlClientApi | None = None)
adapter_index: int | None

The GPU to use, as an index into the platform's list of GPUs.

single_context: bool | None

Whether the device's sessions take turns in one OpenGL context instead of having one each. Only an EGL device reads it.

client_api: OpenGlClientApi | None

The OpenGL API that the device's sessions render with. An EGL device defaults to OpenGlClientApi.GLES, and takes OpenGlClientApi.GL too on Linux and FreeBSD. A WGL device takes only OpenGlClientApi.GL, its default, and a WebGL device only OpenGlClientApi.GLES, its default. Other devices take neither.

@dataclass(frozen=True, slots=True)
class OpenGlBorrowedTexture:
3373@dataclass(frozen=True, slots=True)
3374class OpenGlBorrowedTexture:
3375    """An OpenGL texture of a borrowed ring.
3376
3377    See `mln_open_gl_borrowed_texture` in the
3378    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
3379    """
3380
3381    texture: int
3382    """Your texture name."""
3383
3384    @classmethod
3385    def _from_native(cls, raw):
3386        return cls(texture=raw["texture"])

An OpenGL texture of a borrowed ring.

See mln_open_gl_borrowed_texture in the C API reference.

OpenGlBorrowedTexture(texture: int)
texture: int

Your texture name.

@dataclass(frozen=True, slots=True)
class OpenGlBorrowedTextureDescriptor:
3389@dataclass(frozen=True, slots=True)
3390class OpenGlBorrowedTextureDescriptor:
3391    """A ring of your OpenGL textures, for
3392    `MapHandle.attach_open_gl_borrowed_texture()`.
3393
3394    `logical_size` sets the map's size. `physical_width` and
3395    `physical_height` give the textures' size in pixels, which is usually
3396    `logical_size` times the map's scale factor. The context must use
3397    `OpenGlContextOwnership.SHARED`. Each texture must be in your context's
3398    share group, with storage of that size. The ring holds up to
3399    `TEXTURE_RING_MAX_DEPTH` distinct textures.
3400
3401    The session uses the textures until a replacement or release of the
3402    target completes, a detach or release of the session completes, or an
3403    abandon of it returns.
3404
3405    See `mln_open_gl_borrowed_texture_descriptor` in the
3406    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
3407    """
3408
3409    logical_size: LogicalSize
3410
3411    physical_width: int
3412
3413    physical_height: int
3414
3415    context: OpenGlContextDescriptor
3416
3417    textures: Sequence[OpenGlBorrowedTexture]
3418
3419    target: int
3420    """The textures' target. It must be GL_TEXTURE_2D."""
3421
3422    def __post_init__(self):
3423        object.__setattr__(self, "textures", _sequence(self.textures))
3424
3425    @classmethod
3426    def _from_native(cls, raw):
3427        return cls(
3428            logical_size=LogicalSize._from_native(raw["logical_size"]),
3429            physical_width=raw["physical_width"],
3430            physical_height=raw["physical_height"],
3431            context=OpenGlContextDescriptor._from_native(raw["context"]),
3432            textures=tuple(
3433                OpenGlBorrowedTexture._from_native(item) for item in raw["textures"]
3434            ),
3435            target=raw["target"],
3436        )

A ring of your OpenGL textures, for MapHandle.attach_open_gl_borrowed_texture().

logical_size sets the map's size. physical_width and physical_height give the textures' size in pixels, which is usually logical_size times the map's scale factor. The context must use OpenGlContextOwnership.SHARED. Each texture must be in your context's share group, with storage of that size. The ring holds up to TEXTURE_RING_MAX_DEPTH distinct textures.

The session uses the textures until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.

See mln_open_gl_borrowed_texture_descriptor in the C API reference.

OpenGlBorrowedTextureDescriptor( logical_size: LogicalSize, physical_width: int, physical_height: int, context: OpenGlContextDescriptor, textures: Sequence[OpenGlBorrowedTexture], target: int)
logical_size: LogicalSize
physical_width: int
physical_height: int
textures: Sequence[OpenGlBorrowedTexture]
target: int

The textures' target. It must be GL_TEXTURE_2D.

@dataclass(frozen=True, slots=True)
class OpenGlBorrowedTextureReplacement:
3439@dataclass(frozen=True, slots=True)
3440class OpenGlBorrowedTextureReplacement:
3441    """New OpenGL textures for a borrowed ring, for
3442    `RenderSessionHandle.set_open_gl_borrowed_texture_target()`.
3443
3444    The members and the textures follow the rules of
3445    `OpenGlBorrowedTextureDescriptor`. The ring keeps its depth, context, and
3446    texture target, so give it as many textures as it attached with, in the
3447    same share group.
3448
3449    See `mln_open_gl_borrowed_texture_replacement` in the
3450    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
3451    """
3452
3453    logical_size: LogicalSize
3454
3455    physical_width: int
3456
3457    physical_height: int
3458
3459    textures: Sequence[OpenGlBorrowedTexture]
3460
3461    def __post_init__(self):
3462        object.__setattr__(self, "textures", _sequence(self.textures))
3463
3464    @classmethod
3465    def _from_native(cls, raw):
3466        return cls(
3467            logical_size=LogicalSize._from_native(raw["logical_size"]),
3468            physical_width=raw["physical_width"],
3469            physical_height=raw["physical_height"],
3470            textures=tuple(
3471                OpenGlBorrowedTexture._from_native(item) for item in raw["textures"]
3472            ),
3473        )

New OpenGL textures for a borrowed ring, for RenderSessionHandle.set_open_gl_borrowed_texture_target().

The members and the textures follow the rules of OpenGlBorrowedTextureDescriptor. The ring keeps its depth, context, and texture target, so give it as many textures as it attached with, in the same share group.

See mln_open_gl_borrowed_texture_replacement in the C API reference.

OpenGlBorrowedTextureReplacement( logical_size: LogicalSize, physical_width: int, physical_height: int, textures: Sequence[OpenGlBorrowedTexture])
logical_size: LogicalSize
physical_width: int
physical_height: int
textures: Sequence[OpenGlBorrowedTexture]
class OpenGlClientApi(maplibre_native_ffi._enum.UnknownIntEnum):
577class OpenGlClientApi(UnknownIntEnum):
578    """The OpenGL API that a context renders with.
579
580    See `mln_open_gl_client_api` in the
581    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html).
582    """
583
584    UNSPECIFIED = 0
585    GL = 1
586    GLES = 2

The OpenGL API that a context renders with.

See mln_open_gl_client_api in the C API reference.

UNSPECIFIED = <OpenGlClientApi.UNSPECIFIED: 0>
GL = <OpenGlClientApi.GL: 1>
GLES = <OpenGlClientApi.GLES: 2>
@dataclass(frozen=True, slots=True)
class OpenGlContextDescriptor:
3476@dataclass(frozen=True, slots=True)
3477class OpenGlContextDescriptor:
3478    """How a render session gets the OpenGL context that it renders with.
3479
3480    Keep the objects that it names alive until a detach or release of the
3481    session completes, or an abandon of it returns.
3482
3483    See `mln_open_gl_context_descriptor` in the
3484    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html).
3485    """
3486
3487    data: (
3488        OpenGlContextDescriptorWglVariant
3489        | OpenGlContextDescriptorEglVariant
3490        | OpenGlContextDescriptorWebGlVariant
3491    )
3492
3493    ownership: OpenGlContextOwnership = OpenGlContextOwnership.SHARED
3494
3495    @classmethod
3496    def _from_native(cls, raw):
3497        return cls(
3498            ownership=OpenGlContextOwnership(raw["ownership"]),
3499            data=_copy_variant(
3500                raw["data"],
3501                {
3502                    "wgl": OpenGlContextDescriptorWglVariant,
3503                    "egl": OpenGlContextDescriptorEglVariant,
3504                    "web_gl": OpenGlContextDescriptorWebGlVariant,
3505                },
3506                None,
3507            ),
3508        )

How a render session gets the OpenGL context that it renders with.

Keep the objects that it names alive until a detach or release of the session completes, or an abandon of it returns.

See mln_open_gl_context_descriptor in the C API reference.

@dataclass(frozen=True, slots=True)
class OpenGlContextDescriptorEglVariant:
65@dataclass(frozen=True, slots=True)
66class OpenGlContextDescriptorEglVariant:
67    value: EglContextDescriptor
68    _tag = 2
69
70    @classmethod
71    def _from_native(cls, raw):
72        return cls(EglContextDescriptor._from_native(raw))
OpenGlContextDescriptorEglVariant(value: EglContextDescriptor)
@dataclass(frozen=True, slots=True)
class OpenGlContextDescriptorWebGlVariant:
75@dataclass(frozen=True, slots=True)
76class OpenGlContextDescriptorWebGlVariant:
77    value: WebGlContextDescriptor
78    _tag = 3
79
80    @classmethod
81    def _from_native(cls, raw):
82        return cls(WebGlContextDescriptor._from_native(raw))
OpenGlContextDescriptorWebGlVariant(value: WebGlContextDescriptor)
@dataclass(frozen=True, slots=True)
class OpenGlContextDescriptorWglVariant:
55@dataclass(frozen=True, slots=True)
56class OpenGlContextDescriptorWglVariant:
57    value: WglContextDescriptor
58    _tag = 1
59
60    @classmethod
61    def _from_native(cls, raw):
62        return cls(WglContextDescriptor._from_native(raw))
OpenGlContextDescriptorWglVariant(value: WglContextDescriptor)
class OpenGlContextOwnership(maplibre_native_ffi._enum.UnknownIntEnum):
589class OpenGlContextOwnership(UnknownIntEnum):
590    """Whether a render session's OpenGL context shares objects with yours.
591
592    See `mln_open_gl_context_ownership` in the
593    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html).
594    """
595
596    SHARED = 0
597    DEDICATED = 1

Whether a render session's OpenGL context shares objects with yours.

See mln_open_gl_context_ownership in the C API reference.

class OpenGlContextProviderFlag(enum.IntFlag):
600class OpenGlContextProviderFlag(IntFlag):
601    """An OpenGL context platform, as a bit in a set.
602
603    See `mln_open_gl_context_provider_flag` in the
604    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html).
605    """
606
607    WGL = 1
608    EGL = 2
609    WEB_GL = 4

An OpenGL context platform, as a bit in a set.

See mln_open_gl_context_provider_flag in the C API reference.

@dataclass(frozen=True, slots=True)
class OpenGlSurfaceDescriptor:
3511@dataclass(frozen=True, slots=True)
3512class OpenGlSurfaceDescriptor:
3513    """An OpenGL surface to present to, for
3514    `MapHandle.attach_open_gl_surface()`.
3515
3516    The session uses the surface until a replacement or release of the target
3517    completes, a detach or release of the session completes, or an abandon of
3518    it returns.
3519
3520    See `mln_open_gl_surface_descriptor` in the
3521    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html).
3522    """
3523
3524    logical_size: LogicalSize
3525
3526    context: OpenGlContextDescriptor
3527
3528    surface: int = 0
3529    """Your EGLSurface with EGL, or your HDC with WGL. WebGL doesn't use it."""
3530
3531    @classmethod
3532    def _from_native(cls, raw):
3533        return cls(
3534            logical_size=LogicalSize._from_native(raw["logical_size"]),
3535            context=OpenGlContextDescriptor._from_native(raw["context"]),
3536            surface=raw["surface"],
3537        )

An OpenGL surface to present to, for MapHandle.attach_open_gl_surface().

The session uses the surface until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.

See mln_open_gl_surface_descriptor in the C API reference.

OpenGlSurfaceDescriptor( logical_size: LogicalSize, context: OpenGlContextDescriptor, surface: int = 0)
logical_size: LogicalSize
surface: int

Your EGLSurface with EGL, or your HDC with WGL. WebGL doesn't use it.

@dataclass(frozen=True, slots=True)
class OpenGlSurfaceReplacement:
3540@dataclass(frozen=True, slots=True)
3541class OpenGlSurfaceReplacement:
3542    """A new OpenGL surface for
3543    `RenderSessionHandle.set_open_gl_surface_target()`.
3544
3545    The session presents to it with the context that it attached with. It
3546    uses the surface until a replacement or release of the target completes,
3547    a detach or release of the session completes, or an abandon of it
3548    returns.
3549
3550    See `mln_open_gl_surface_replacement` in the
3551    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html).
3552    """
3553
3554    logical_size: LogicalSize
3555
3556    surface: int = 0
3557    """Your EGLSurface with EGL, or your HDC with WGL. WebGL doesn't use it, so
3558    leave it null.
3559    """
3560
3561    @classmethod
3562    def _from_native(cls, raw):
3563        return cls(
3564            logical_size=LogicalSize._from_native(raw["logical_size"]),
3565            surface=raw["surface"],
3566        )

A new OpenGL surface for RenderSessionHandle.set_open_gl_surface_target().

The session presents to it with the context that it attached with. It uses the surface until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.

See mln_open_gl_surface_replacement in the C API reference.

OpenGlSurfaceReplacement( logical_size: LogicalSize, surface: int = 0)
logical_size: LogicalSize
surface: int

Your EGLSurface with EGL, or your HDC with WGL. WebGL doesn't use it, so leave it null.

@dataclass(frozen=True, slots=True)
class OpenGlTextureFrame:
3569@dataclass(frozen=True, slots=True)
3570class OpenGlTextureFrame:
3571    """The OpenGL texture of an acquired frame.
3572
3573    See `mln_open_gl_texture_frame` in the
3574    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
3575    """
3576
3577    width: int
3578
3579    height: int
3580
3581    scale_factor: float
3582
3583    slot: int
3584    """The texture's index in the descriptor's `textures`."""
3585
3586    texture: int
3587
3588    target: int
3589
3590    @classmethod
3591    def _from_native(cls, raw):
3592        return cls(
3593            width=raw["width"],
3594            height=raw["height"],
3595            scale_factor=raw["scale_factor"],
3596            slot=raw["slot"],
3597            texture=raw["texture"],
3598            target=raw["target"],
3599        )

The OpenGL texture of an acquired frame.

See mln_open_gl_texture_frame in the C API reference.

OpenGlTextureFrame( width: int, height: int, scale_factor: float, slot: int, texture: int, target: int)
width: int
height: int
scale_factor: float
slot: int

The texture's index in the descriptor's textures.

texture: int
target: int
@dataclass(frozen=True, slots=True)
class PanMomentum:
3602@dataclass(frozen=True, slots=True)
3603class PanMomentum:
3604    """How a gesture's pan keeps moving the map's content after release.
3605
3606    See `mln_pan_momentum` in the
3607    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3608    """
3609
3610    velocity: ScreenPoint | None = None
3611    """How fast the map's content moved on the screen at release, in logical
3612    pixels per second. The pan moves only when this is set.
3613    """
3614
3615    decay: MomentumDecay = field(default_factory=lambda: MomentumDecay())
3616
3617    @classmethod
3618    def _from_native(cls, raw):
3619        return cls(
3620            velocity=_maybe(ScreenPoint._from_native, raw["velocity"]),
3621            decay=MomentumDecay._from_native(raw["decay"]),
3622        )

How a gesture's pan keeps moving the map's content after release.

See mln_pan_momentum in the C API reference.

PanMomentum( velocity: ScreenPoint | None = None, decay: MomentumDecay = <factory>)
velocity: ScreenPoint | None

How fast the map's content moved on the screen at release, in logical pixels per second. The pan moves only when this is set.

decay: MomentumDecay
@dataclass(frozen=True, slots=True)
class PremultipliedRgba8Image:
3625@dataclass(frozen=True, slots=True)
3626class PremultipliedRgba8Image:
3627    """An image of 8-bit RGBA pixels whose colors are multiplied by their alpha.
3628
3629    See `mln_premultiplied_rgba8_image` in the
3630    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
3631    """
3632
3633    width: int
3634
3635    height: int
3636
3637    stride: int
3638    """The number of bytes from the start of one row to the start of the next,
3639    at least `width` \\* 4.
3640    """
3641
3642    pixels: Buffer
3643    """The rows of pixels, `stride` bytes apart, from the top row down."""
3644
3645    def __post_init__(self):
3646        object.__setattr__(self, "pixels", _bytes(self.pixels))
3647
3648    @classmethod
3649    def _from_native(cls, raw):
3650        return cls(
3651            width=raw["width"],
3652            height=raw["height"],
3653            stride=raw["stride"],
3654            pixels=raw["pixels"],
3655        )

An image of 8-bit RGBA pixels whose colors are multiplied by their alpha.

See mln_premultiplied_rgba8_image in the C API reference.

PremultipliedRgba8Image(width: int, height: int, stride: int, pixels: Buffer)
width: int
height: int
stride: int

The number of bytes from the start of one row to the start of the next, at least width * 4.

pixels: Buffer

The rows of pixels, stride bytes apart, from the top row down.

@dataclass(frozen=True, slots=True)
class ProjectedMeters:
3658@dataclass(frozen=True, slots=True)
3659class ProjectedMeters:
3660    """A point in the Web Mercator projection, in meters.
3661
3662    See `mln_projected_meters` in the
3663    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3664    """
3665
3666    northing: float = 0.0
3667
3668    easting: float = 0.0
3669
3670    @classmethod
3671    def _from_native(cls, raw):
3672        return cls(northing=raw["northing"], easting=raw["easting"])

A point in the Web Mercator projection, in meters.

See mln_projected_meters in the C API reference.

ProjectedMeters(northing: float = 0.0, easting: float = 0.0)
northing: float
easting: float
@dataclass(frozen=True, slots=True)
class ProjectionMode:
3675@dataclass(frozen=True, slots=True)
3676class ProjectionMode:
3677    """A map's whole projection mode.
3678
3679    Its members mean the same as those of `ProjectionModeOptions`.
3680
3681    See `mln_projection_mode` in the
3682    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3683    """
3684
3685    axonometric: bool = False
3686
3687    x_skew: float = 0.0
3688
3689    y_skew: float = 0.0
3690
3691    @classmethod
3692    def _from_native(cls, raw):
3693        return cls(
3694            axonometric=raw["axonometric"], x_skew=raw["x_skew"], y_skew=raw["y_skew"]
3695        )

A map's whole projection mode.

Its members mean the same as those of ProjectionModeOptions.

See mln_projection_mode in the C API reference.

ProjectionMode(axonometric: bool = False, x_skew: float = 0.0, y_skew: float = 0.0)
axonometric: bool
x_skew: float
y_skew: float
@dataclass(frozen=True, slots=True)
class ProjectionModeOptions:
3698@dataclass(frozen=True, slots=True)
3699class ProjectionModeOptions:
3700    """Settings that skew the map or draw it without perspective.
3701
3702    See `mln_projection_mode_options` in the
3703    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3704    """
3705
3706    axonometric: bool | None = None
3707    """Whether the map draws without perspective."""
3708
3709    x_skew: float | None = None
3710
3711    y_skew: float | None = None
3712
3713    @classmethod
3714    def _from_native(cls, raw):
3715        return cls(
3716            axonometric=raw["axonometric"], x_skew=raw["x_skew"], y_skew=raw["y_skew"]
3717        )

Settings that skew the map or draw it without perspective.

See mln_projection_mode_options in the C API reference.

ProjectionModeOptions( axonometric: bool | None = None, x_skew: float | None = None, y_skew: float | None = None)
axonometric: bool | None

Whether the map draws without perspective.

x_skew: float | None
y_skew: float | None
@dataclass(frozen=True, slots=True)
class Quaternion:
3720@dataclass(frozen=True, slots=True)
3721class Quaternion:
3722    """A rotation, as a quaternion.
3723
3724    See `mln_quaternion` in the
3725    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3726    """
3727
3728    x: float = 0.0
3729
3730    y: float = 0.0
3731
3732    z: float = 0.0
3733
3734    w: float = 0.0
3735
3736    @classmethod
3737    def _from_native(cls, raw):
3738        return cls(x=raw["x"], y=raw["y"], z=raw["z"], w=raw["w"])

A rotation, as a quaternion.

See mln_quaternion in the C API reference.

Quaternion(x: float = 0.0, y: float = 0.0, z: float = 0.0, w: float = 0.0)
x: float
y: float
z: float
w: float
@dataclass(frozen=True, slots=True)
class QueueLock:
3741@dataclass(frozen=True, slots=True)
3742class QueueLock:
3743    """Your lock on a Vulkan queue that you and a render session both submit to.
3744
3745    The session holds the lock only while it submits or presents to the
3746    queue. Set both `lock` and `unlock`, or neither when you don't submit to
3747    the queue yourself.
3748
3749    It can run on a library thread, and it can't call the library.
3750
3751    See `mln_queue_lock` in the
3752    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html).
3753    """
3754
3755    @classmethod
3756    def native(
3757        cls, lock: int, unlock: int, user_data: int = 0, release_user_data: int = 0
3758    ) -> NativeQueueLock:
3759        """A native registration, whose function pointers, context, and release
3760        the host's native code supplies as addresses. Zero is null. The
3761        binding copies each address unchanged, and native code validates
3762        them.
3763        """
3764        from . import _native
3765
3766        return NativeQueueLock._from_registration(
3767            _native._NativeRegistration(
3768                "mln_queue_lock", (lock, unlock), user_data, release_user_data
3769            )
3770        )

Your lock on a Vulkan queue that you and a render session both submit to.

The session holds the lock only while it submits or presents to the queue. Set both lock and unlock, or neither when you don't submit to the queue yourself.

It can run on a library thread, and it can't call the library.

See mln_queue_lock in the C API reference.

@classmethod
def native( cls, lock: int, unlock: int, user_data: int = 0, release_user_data: int = 0) -> NativeQueueLock:
3755    @classmethod
3756    def native(
3757        cls, lock: int, unlock: int, user_data: int = 0, release_user_data: int = 0
3758    ) -> NativeQueueLock:
3759        """A native registration, whose function pointers, context, and release
3760        the host's native code supplies as addresses. Zero is null. The
3761        binding copies each address unchanged, and native code validates
3762        them.
3763        """
3764        from . import _native
3765
3766        return NativeQueueLock._from_registration(
3767            _native._NativeRegistration(
3768                "mln_queue_lock", (lock, unlock), user_data, release_user_data
3769            )
3770        )

A native registration, whose function pointers, context, and release the host's native code supplies as addresses. Zero is null. The binding copies each address unchanged, and native code validates them.

class RenderAbandonDisposition(maplibre_native_ffi._enum.UnknownIntEnum):
612class RenderAbandonDisposition(UnknownIntEnum):
613    """What `RenderSessionHandle.abandon()` did with a session's graphics
614    objects.
615
616    See `mln_render_abandon_disposition` in the
617    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
618    """
619
620    CLEAN = 0
621    QUARANTINED = 1

What RenderSessionHandle.abandon() did with a session's graphics objects.

See mln_render_abandon_disposition in the C API reference.

@dataclass(frozen=True, slots=True)
class RenderAbandonResult:
3795@dataclass(frozen=True, slots=True)
3796class RenderAbandonResult:
3797    """The outcome of `RenderSessionHandle.abandon()`.
3798
3799    See `mln_render_abandon_result` in the
3800    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
3801    """
3802
3803    disposition: RenderAbandonDisposition
3804
3805    quarantined_resource_count: int
3806
3807    @classmethod
3808    def _from_native(cls, raw):
3809        return cls(
3810            disposition=RenderAbandonDisposition(raw["disposition"]),
3811            quarantined_resource_count=raw["quarantined_resource_count"],
3812        )

The outcome of RenderSessionHandle.abandon().

See mln_render_abandon_result in the C API reference.

RenderAbandonResult( disposition: RenderAbandonDisposition, quarantined_resource_count: int)
quarantined_resource_count: int
class RenderBackendFlag(enum.IntFlag):
624class RenderBackendFlag(IntFlag):
625    """A render backend, as a bit in a set.
626
627    See `mln_render_backend_flag` in the
628    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/base_8h.html).
629    """
630
631    METAL = 1
632    VULKAN = 2
633    OPEN_GL = 4
634    WEB_GPU = 8

A render backend, as a bit in a set.

See mln_render_backend_flag in the C API reference.

VULKAN = <RenderBackendFlag.VULKAN: 2>
OPEN_GL = <RenderBackendFlag.OPEN_GL: 4>
WEB_GPU = <RenderBackendFlag.WEB_GPU: 8>
class RenderDriverKind(maplibre_native_ffi._enum.UnknownIntEnum):
637class RenderDriverKind(UnknownIntEnum):
638    """The thread that runs a render session's graphics work.
639
640    See `mln_render_driver_kind` in the
641    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html).
642    """
643
644    CORE_WORKER = 1
645    CALLER_GRAPHICS_THREAD = 2

The thread that runs a render session's graphics work.

See mln_render_driver_kind in the C API reference.

CORE_WORKER = <RenderDriverKind.CORE_WORKER: 1>
CALLER_GRAPHICS_THREAD = <RenderDriverKind.CALLER_GRAPHICS_THREAD: 2>
@dataclass(frozen=True, slots=True)
class RenderFrameResult:
3815@dataclass(frozen=True, slots=True)
3816class RenderFrameResult:
3817    """How one frame demand finished.
3818
3819    See `mln_render_frame_result` in the
3820    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
3821    """
3822
3823    disposition: RenderResult
3824
3825    token: int
3826
3827    map_update_generation: int
3828    """The map update that a rendered frame shows. The frame includes a
3829    command's change when this is at least the command's
3830    `CommandCompletion.render_update_generation`.
3831    """
3832
3833    generation: int
3834
3835    frame_generation: int
3836
3837    needs_repaint: bool
3838
3839    view: MapView
3840    """The camera and extent that a rendered frame shows."""
3841
3842    mode: RenderMode
3843
3844    @classmethod
3845    def _from_native(cls, raw):
3846        return cls(
3847            disposition=RenderResult(raw["disposition"]),
3848            token=raw["token"],
3849            map_update_generation=raw["map_update_generation"],
3850            generation=raw["generation"],
3851            frame_generation=raw["frame_generation"],
3852            needs_repaint=raw["needs_repaint"],
3853            view=MapView._from_native(raw["view"]),
3854            mode=RenderMode(raw["mode"]),
3855        )

How one frame demand finished.

See mln_render_frame_result in the C API reference.

RenderFrameResult( disposition: RenderResult, token: int, map_update_generation: int, generation: int, frame_generation: int, needs_repaint: bool, view: MapView, mode: RenderMode)
disposition: RenderResult
token: int
map_update_generation: int

The map update that a rendered frame shows. The frame includes a command's change when this is at least the command's CommandCompletion.render_update_generation.

generation: int
frame_generation: int
needs_repaint: bool
view: MapView

The camera and extent that a rendered frame shows.

mode: RenderMode
class RenderMode(maplibre_native_ffi._enum.UnknownIntEnum):
648class RenderMode(UnknownIntEnum):
649    """Whether a frame drew the map complete, or lacked resources that are still
650    loading.
651
652    See `mln_render_mode` in the
653    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
654    """
655
656    PARTIAL = 0
657    FULL = 1

Whether a frame drew the map complete, or lacked resources that are still loading.

See mln_render_mode in the C API reference.

PARTIAL = <RenderMode.PARTIAL: 0>
FULL = <RenderMode.FULL: 1>
class RenderResult(maplibre_native_ffi._enum.UnknownIntEnum):
660class RenderResult(UnknownIntEnum):
661    """How a frame demand finished.
662
663    See `mln_render_result` in the
664    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
665    """
666
667    RENDERED = 0
668    NO_UPDATE = 1
669    TARGET_NOT_READY = 2
670    SUPERSEDED = 3
671    FAILED = 4

How a frame demand finished.

See mln_render_result in the C API reference.

RENDERED = <RenderResult.RENDERED: 0>
NO_UPDATE = <RenderResult.NO_UPDATE: 1>
TARGET_NOT_READY = <RenderResult.TARGET_NOT_READY: 2>
SUPERSEDED = <RenderResult.SUPERSEDED: 3>
FAILED = <RenderResult.FAILED: 4>
@dataclass(frozen=True, slots=True)
class RenderSessionAttachOptions:
3858@dataclass(frozen=True, slots=True)
3859class RenderSessionAttachOptions:
3860    """Options for attaching a render session to a map.
3861
3862    See `mln_render_session_attach_options` in the
3863    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html).
3864    """
3865
3866    driver: RenderDriverKind
3867    """The thread that runs the session's graphics work, which depends on the
3868    target:
3869
3870    - `RenderDriverKind.CALLER_GRAPHICS_THREAD` for a shared or dedicated EGL
3871      or WGL context, an existing WebGL context, or a browser's WebGPU
3872      device.
3873    - `RenderDriverKind.CORE_WORKER` for a transferred WebGL canvas, an
3874      Android, OpenHarmony, or Win32 window, a Wayland surface, a ring of
3875      Android hardware buffers, dmabufs, DXGI shared textures, or IOSurfaces,
3876      or an offscreen session.
3877    - Either one for another Metal or Vulkan target.
3878
3879    An attach with another driver fails with `Status.UNSUPPORTED`.
3880    """
3881
3882    producer_sync_kinds: GpuSyncKindFlag = field(
3883        default_factory=lambda: GpuSyncKindFlag(0)
3884    )
3885    """The kinds of `GpuSync` that you can wait on before you read an acquired
3886    frame. The session uses one of them that its target supports. Zero lets
3887    the session pick a kind that names no object to wait on.
3888    """
3889
3890    frame_wake: Wake | NativeWake = field(default_factory=lambda: Wake())
3891    """Called when frame results are waiting for
3892    `RenderSessionHandle.drain_frame_results()`. It isn't called again until
3893    a drain takes them.
3894    """
3895
3896    redraw_wake: Wake | NativeWake = field(default_factory=lambda: Wake())
3897    """Called when the session has something new to draw. Demand a frame at your
3898    next display refresh. It isn't called again until you demand a frame, or
3899    while the session has no target.
3900    """
3901
3902    driver_work_wake: Wake | NativeWake = field(default_factory=lambda: Wake())
3903    """Called when a session driven by `RenderDriverKind.CALLER_GRAPHICS_THREAD`
3904    has work for `RenderSessionHandle.service_driver_work()`. It isn't called
3905    again until a service runs.
3906    """
3907
3908    queue_lock: QueueLock | NativeQueueLock = field(default_factory=lambda: QueueLock())
3909    """Your lock on the Vulkan queue, when you submit to it yourself."""
3910
3911    @classmethod
3912    def _from_native(cls, raw):
3913        return cls(
3914            driver=RenderDriverKind(raw["driver"]),
3915            producer_sync_kinds=GpuSyncKindFlag(raw["producer_sync_kinds"]),
3916            frame_wake=Wake(),
3917            redraw_wake=Wake(),
3918            driver_work_wake=Wake(),
3919            queue_lock=QueueLock(),
3920        )

Options for attaching a render session to a map.

See mln_render_session_attach_options in the C API reference.

RenderSessionAttachOptions( driver: RenderDriverKind, producer_sync_kinds: GpuSyncKindFlag = <factory>, frame_wake: Wake | NativeWake = <factory>, redraw_wake: Wake | NativeWake = <factory>, driver_work_wake: Wake | NativeWake = <factory>, queue_lock: QueueLock | NativeQueueLock = <factory>)

The thread that runs the session's graphics work, which depends on the target:

  • RenderDriverKind.CALLER_GRAPHICS_THREAD for a shared or dedicated EGL or WGL context, an existing WebGL context, or a browser's WebGPU device.
  • RenderDriverKind.CORE_WORKER for a transferred WebGL canvas, an Android, OpenHarmony, or Win32 window, a Wayland surface, a ring of Android hardware buffers, dmabufs, DXGI shared textures, or IOSurfaces, or an offscreen session.
  • Either one for another Metal or Vulkan target.

An attach with another driver fails with Status.UNSUPPORTED.

producer_sync_kinds: GpuSyncKindFlag

The kinds of GpuSync that you can wait on before you read an acquired frame. The session uses one of them that its target supports. Zero lets the session pick a kind that names no object to wait on.

frame_wake: Wake | NativeWake

Called when frame results are waiting for RenderSessionHandle.drain_frame_results(). It isn't called again until a drain takes them.

redraw_wake: Wake | NativeWake

Called when the session has something new to draw. Demand a frame at your next display refresh. It isn't called again until you demand a frame, or while the session has no target.

driver_work_wake: Wake | NativeWake

Called when a session driven by RenderDriverKind.CALLER_GRAPHICS_THREAD has work for RenderSessionHandle.service_driver_work(). It isn't called again until a service runs.

queue_lock: QueueLock | NativeQueueLock

Your lock on the Vulkan queue, when you submit to it yourself.

@dataclass(frozen=True, slots=True)
class RenderSessionCapabilities:
3923@dataclass(frozen=True, slots=True)
3924class RenderSessionCapabilities:
3925    """What an attached render session supports.
3926
3927    See `mln_render_session_capabilities` in the
3928    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html).
3929    """
3930
3931    driver: RenderDriverKind
3932
3933    texture_ring_depth: int
3934    """How many textures the session's texture ring has."""
3935
3936    flags: RenderSessionCapabilityFlag
3937
3938    producer_sync_kind: GpuSyncKind
3939    """The kind of `GpuSync` that `AcquiredFrameHandle.producer_sync()` reports."""
3940
3941    consumer_sync_kinds: GpuSyncKindFlag
3942    """The kinds of `GpuSync` that `AcquiredFrameHandle.release()` accepts. They
3943    depend on the target and on what the device supports.
3944    """
3945
3946    @classmethod
3947    def _from_native(cls, raw):
3948        return cls(
3949            driver=RenderDriverKind(raw["driver"]),
3950            texture_ring_depth=raw["texture_ring_depth"],
3951            flags=RenderSessionCapabilityFlag(raw["flags"]),
3952            producer_sync_kind=GpuSyncKind(raw["producer_sync_kind"]),
3953            consumer_sync_kinds=GpuSyncKindFlag(raw["consumer_sync_kinds"]),
3954        )

What an attached render session supports.

See mln_render_session_capabilities in the C API reference.

RenderSessionCapabilities( driver: RenderDriverKind, texture_ring_depth: int, flags: RenderSessionCapabilityFlag, producer_sync_kind: GpuSyncKind, consumer_sync_kinds: GpuSyncKindFlag)
texture_ring_depth: int

How many textures the session's texture ring has.

producer_sync_kind: GpuSyncKind

The kind of GpuSync that AcquiredFrameHandle.producer_sync() reports.

consumer_sync_kinds: GpuSyncKindFlag

The kinds of GpuSync that AcquiredFrameHandle.release() accepts. They depend on the target and on what the device supports.

class RenderSessionCapabilityFlag(enum.IntFlag):
674class RenderSessionCapabilityFlag(IntFlag):
675    """Something that a render session can do.
676
677    See `mln_render_session_capability_flag` in the
678    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html).
679    """
680
681    FRAME_ACQUISITION = 1
682    READBACK = 2
683    PRESENTATION = 4

Something that a render session can do.

See mln_render_session_capability_flag in the C API reference.

class RenderSessionHandle(maplibre_native_ffi._generated_operations._RenderSessionHandleOperations, maplibre_native_ffi._lifecycle.ScopedHandleMixin):

A render session draws a map into a surface or a texture.

See mln_render_session in the C API reference.

def abandon(self) -> RenderAbandonResult:
2264    def abandon(self) -> RenderAbandonResult:
2265        """Stops the session right away, without running its pending graphics
2266        work.
2267
2268        Use it when the target's graphics objects are going away and a detach
2269        can't finish first. Pending work completes with `Status.TARGET_LOST`,
2270        and pending frame demands finish with
2271        `RenderResult.TARGET_NOT_READY`. Once the call returns, the library
2272        no longer uses your graphics objects, and you can attach another
2273        session to the map. Release the session afterward.
2274
2275        Abandon keeps the session's OpenGL and WebGPU objects until the
2276        process exits, and reports how many it kept. Detach the session
2277        instead to free them.
2278
2279        See `mln_render_session_abandon` in the
2280        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
2281        """
2282        return RenderAbandonResult._from_native(self._native.abandon())

Stops the session right away, without running its pending graphics work.

Use it when the target's graphics objects are going away and a detach can't finish first. Pending work completes with Status.TARGET_LOST, and pending frame demands finish with RenderResult.TARGET_NOT_READY. Once the call returns, the library no longer uses your graphics objects, and you can attach another session to the map. Release the session afterward.

Abandon keeps the session's OpenGL and WebGPU objects until the process exits, and reports how many it kept. Detach the session instead to free them.

See mln_render_session_abandon in the C API reference.

def acquire_frame(self) -> AcquiredFrameHandle | None:
2284    def acquire_frame(self) -> AcquiredFrameHandle | None:
2285        """Takes the newest rendered frame from the session's texture ring, if
2286        one is ready.
2287
2288        Older frames that you haven't acquired are dropped, and the session
2289        can render over a frame before you acquire it. While you hold a frame
2290        in every texture of the ring, new frames wait until you release one.
2291        When no frame is ready, it succeeds and writes the null handle.
2292
2293        See `mln_render_session_acquire_frame` in the
2294        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
2295
2296        Errors:
2297
2298        - `Status.UNSUPPORTED` when the session lacks
2299          `RenderSessionCapabilityFlag.FRAME_ACQUISITION`.
2300        - `Status.TARGET_LOST` or `Status.NATIVE_ERROR`, as
2301          `RenderSessionSnapshot.failure_status` reports, when the session
2302          has failed.
2303        - `Status.INVALID_STATE` when you detached, abandoned, released, or
2304          disposed the session.
2305        """
2306        return _maybe(
2307            lambda raw: _adopt_value(raw, "AcquiredFrameHandle", self),
2308            self._native.acquire_frame(),
2309        )

Takes the newest rendered frame from the session's texture ring, if one is ready.

Older frames that you haven't acquired are dropped, and the session can render over a frame before you acquire it. While you hold a frame in every texture of the ring, new frames wait until you release one. When no frame is ready, it succeeds and writes the null handle.

See mln_render_session_acquire_frame in the C API reference.

Errors:

def barrier(self) -> concurrent.futures._base.Future[None]:
2311    def barrier(self) -> Future[None]:
2312        """Ends the session's pending frame demands and waits for its earlier
2313        work.
2314
2315        Frame demands that haven't started, including those that wait for a
2316        map update, finish with `RenderResult.NO_UPDATE`.
2317
2318        See `mln_render_session_barrier` in the
2319        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
2320
2321        Errors:
2322
2323        - `Status.TARGET_LOST` when the session loses its target before the
2324          barrier runs.
2325        """
2326        return self._native.barrier()

Ends the session's pending frame demands and waits for its earlier work.

Frame demands that haven't started, including those that wait for a map update, finish with RenderResult.NO_UPDATE.

See mln_render_session_barrier in the C API reference.

Errors:

def clear_data(self) -> concurrent.futures._base.Future[None]:
2328    def clear_data(self) -> Future[None]:
2329        """Clears the data that the session's renderer holds, such as loaded
2330        tiles, and draws the map again.
2331
2332        See `mln_render_session_clear_data` in the
2333        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
2334
2335        Errors:
2336
2337        - `Status.TARGET_LOST` when the session loses its target before the
2338          work runs.
2339        """
2340        return self._native.clear_data()

Clears the data that the session's renderer holds, such as loaded tiles, and draws the map again.

See mln_render_session_clear_data in the C API reference.

Errors:

def demand_frame(self, demand: FrameDemand) -> None:
2342    def demand_frame(self, demand: FrameDemand) -> None:
2343        """Asks the session to render a frame.
2344
2345        The frame shows the map commands that you sent before the call,
2346        except the changes that an open command group holds back.
2347
2348        You can call it once the attach call returns. While the attach runs,
2349        the demand waits for it to complete. Every demand finishes with one
2350        frame result that carries its token, and
2351        `RenderSessionHandle.drain_frame_results()` takes it. A demand
2352        without `FrameDemandFlag.FORCE` replaces each pending demand with the
2353        same flags.
2354
2355        See `mln_render_session_demand_frame` in the
2356        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
2357
2358        Errors:
2359
2360        - `Status.TARGET_LOST` or `Status.NATIVE_ERROR`, as
2361          `RenderSessionSnapshot.failure_status` reports, when the session
2362          has failed.
2363        - `Status.INVALID_STATE` when you detached, abandoned, released, or
2364          disposed the session, or discarded a frame from every texture of
2365          its ring.
2366        """
2367        return self._native.demand_frame(demand)

Asks the session to render a frame.

The frame shows the map commands that you sent before the call, except the changes that an open command group holds back.

You can call it once the attach call returns. While the attach runs, the demand waits for it to complete. Every demand finishes with one frame result that carries its token, and RenderSessionHandle.drain_frame_results() takes it. A demand without FrameDemandFlag.FORCE replaces each pending demand with the same flags.

See mln_render_session_demand_frame in the C API reference.

Errors:

def detach(self) -> concurrent.futures._base.Future[None]:
2369    def detach(self) -> Future[None]:
2370        """Detaches the session from its map and frees its graphics objects.
2371
2372        Release every acquired frame first. Pending frame demands finish with
2373        `RenderResult.TARGET_NOT_READY`. Once the detach completes, the
2374        library no longer uses your graphics objects, and you can attach
2375        another session to the map. Release the session afterward.
2376
2377        See `mln_render_session_detach` in the
2378        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
2379
2380        Errors:
2381
2382        - `Status.TARGET_LOST` when the session loses its target before the
2383          detach runs.
2384        """
2385        return self._native.detach()

Detaches the session from its map and frees its graphics objects.

Release every acquired frame first. Pending frame demands finish with RenderResult.TARGET_NOT_READY. Once the detach completes, the library no longer uses your graphics objects, and you can attach another session to the map. Release the session afterward.

See mln_render_session_detach in the C API reference.

Errors:

def drain_frame_results( self) -> tuple[RenderFrameResult, ...]:
2387    def drain_frame_results(self) -> tuple[RenderFrameResult, ...]:
2388        """Takes the frame results that the session has queued.
2389
2390        When no result is queued, it succeeds and writes the null handle and
2391        an empty view.
2392
2393        See `mln_render_session_drain_frame_results` in the
2394        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
2395        """
2396        return tuple(
2397            RenderFrameResult._from_native(item)
2398            for item in self._native.drain_frame_results()
2399        )

Takes the frame results that the session has queued.

When no result is queued, it succeeds and writes the null handle and an empty view.

See mln_render_session_drain_frame_results in the C API reference.

def dump_debug_logs(self) -> concurrent.futures._base.Future[None]:
2401    def dump_debug_logs(self) -> Future[None]:
2402        """Logs debugging information about the session's renderer.
2403
2404        See `mln_render_session_dump_debug_logs` in the
2405        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
2406
2407        Errors:
2408
2409        - `Status.TARGET_LOST` when the session loses its target before the
2410          work runs.
2411        """
2412        return self._native.dump_debug_logs()

Logs debugging information about the session's renderer.

See mln_render_session_dump_debug_logs in the C API reference.

Errors:

def get_capabilities(self) -> RenderSessionCapabilities:
2414    def get_capabilities(self) -> RenderSessionCapabilities:
2415        """Reads what the session supports.
2416
2417        See `mln_render_session_get_capabilities` in the
2418        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
2419        """
2420        return RenderSessionCapabilities._from_native(self._native.get_capabilities())

Reads what the session supports.

See mln_render_session_get_capabilities in the C API reference.

def get_cluster_children( self, source_id: str, cluster_id: int) -> concurrent.futures._base.Future[typing.Any]:
2422    def get_cluster_children(self, source_id: str, cluster_id: int) -> Future[Any]:
2423        """Reads the children of a cluster in a clustered GeoJSON source.
2424
2425        `cluster_id` is the "cluster_id" property of a cluster feature. The
2426        result is a GeoJSON feature collection of the clusters and points
2427        that the cluster splits into at the next zoom level.
2428
2429        The query reads the source's data from the session's most recent
2430        render attempt, so a change to the data shows once the session tries
2431        to render again.
2432
2433        A cluster ID belongs to one version of the source's data. After the
2434        data changes, feature queries can return IDs from the earlier version
2435        until the source's tiles reload, and such an ID completes with
2436        `Status.NOT_FOUND` or names a different cluster. Query the features
2437        again for current IDs.
2438
2439        See `mln_render_session_get_cluster_children` in the
2440        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html).
2441
2442        Errors:
2443
2444        - `Status.NOT_FOUND` when the session's most recent render attempt
2445          had no source named `source_id`, or the source has no cluster
2446          `cluster_id`.
2447        - `Status.INVALID_ARGUMENT` when the source isn't a GeoJSON source
2448          with clustering turned on.
2449        """
2450        return self._native.get_cluster_children(source_id, cluster_id)

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 Status.NOT_FOUND or names a different cluster. Query the features again for current IDs.

See mln_render_session_get_cluster_children in the C API reference.

Errors:

  • 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.
  • Status.INVALID_ARGUMENT when the source isn't a GeoJSON source with clustering turned on.
def get_cluster_expansion_zoom( self, source_id: str, cluster_id: int) -> concurrent.futures._base.Future[int]:
2452    def get_cluster_expansion_zoom(
2453        self, source_id: str, cluster_id: int
2454    ) -> Future[int]:
2455        """Reads the zoom level at which a cluster of a clustered GeoJSON source
2456        splits.
2457
2458        `cluster_id` is the "cluster_id" property of a cluster feature. At
2459        the result's zoom level, the cluster splits into two or more clusters
2460        or points.
2461
2462        A cluster ID can go out of date as
2463        `RenderSessionHandle.get_cluster_children()` describes.
2464
2465        See `mln_render_session_get_cluster_expansion_zoom` in the
2466        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html).
2467
2468        Errors:
2469
2470        - `Status.NOT_FOUND` when the session's most recent render attempt
2471          had no source named `source_id`, or the source has no cluster
2472          `cluster_id`.
2473        - `Status.INVALID_ARGUMENT` when the source isn't a GeoJSON source
2474          with clustering turned on.
2475        """
2476        return self._native.get_cluster_expansion_zoom(source_id, cluster_id)

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 RenderSessionHandle.get_cluster_children() describes.

See mln_render_session_get_cluster_expansion_zoom in the C API reference.

Errors:

  • 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.
  • Status.INVALID_ARGUMENT when the source isn't a GeoJSON source with clustering turned on.
def get_cluster_leaves( self, source_id: str, cluster_id: int, limit: int, offset: int) -> concurrent.futures._base.Future[typing.Any]:
2478    def get_cluster_leaves(
2479        self, source_id: str, cluster_id: int, limit: int, offset: int
2480    ) -> Future[Any]:
2481        """Reads the points in a cluster of a clustered GeoJSON source.
2482
2483        `cluster_id` is the "cluster_id" property of a cluster feature. The
2484        result is a GeoJSON feature collection of the original point
2485        features. It skips the first `offset` points and then holds up to
2486        `limit` of them, so a `limit` of 0 gives an empty collection.
2487
2488        A cluster ID can go out of date as
2489        `RenderSessionHandle.get_cluster_children()` describes.
2490
2491        See `mln_render_session_get_cluster_leaves` in the
2492        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html).
2493
2494        Errors:
2495
2496        - `Status.NOT_FOUND` when the session's most recent render attempt
2497          had no source named `source_id`, or the source has no cluster
2498          `cluster_id`.
2499        - `Status.INVALID_ARGUMENT` when the source isn't a GeoJSON source
2500          with clustering turned on.
2501        """
2502        return self._native.get_cluster_leaves(source_id, cluster_id, limit, offset)

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 RenderSessionHandle.get_cluster_children() describes.

See mln_render_session_get_cluster_leaves in the C API reference.

Errors:

  • 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.
  • Status.INVALID_ARGUMENT when the source isn't a GeoJSON source with clustering turned on.
def get_failure(self) -> str:
2504    def get_failure(self) -> str:
2505        """Reads the message of the error that made the session fail.
2506
2507        `RenderSessionSnapshot.failure_status` reports the error's status.
2508        The message is empty while the session hasn't failed, and doesn't
2509        change once it fails.
2510
2511        See `mln_render_session_get_failure` in the
2512        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
2513        """
2514        return self._native.get_failure()

Reads the message of the error that made the session fail.

RenderSessionSnapshot.failure_status reports the error's status. The message is empty while the session hasn't failed, and doesn't change once it fails.

See mln_render_session_get_failure in the C API reference.

def get_snapshot(self) -> RenderSessionSnapshot:
2516    def get_snapshot(self) -> RenderSessionSnapshot:
2517        """Reads the session's current state.
2518
2519        See `mln_render_session_get_snapshot` in the
2520        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
2521        """
2522        return RenderSessionSnapshot._from_native(self._native.get_snapshot())

Reads the session's current state.

See mln_render_session_get_snapshot in the C API reference.

def query_rendered_features( self, geometry: RenderedQueryGeometry, options: RenderedFeatureQueryOptions | None = None) -> concurrent.futures._base.Future[tuple[RenderedFeature, ...]]:
2524    def query_rendered_features(
2525        self,
2526        geometry: RenderedQueryGeometry,
2527        options: RenderedFeatureQueryOptions | None = None,
2528    ) -> Future[tuple[RenderedFeature, ...]]:
2529        """Finds the features that the session drew in an area of the screen.
2530
2531        The query reads the last frame that the session rendered. A feature
2532        that several layers draw appears once for each layer.
2533
2534        See `mln_render_session_query_rendered_features` in the
2535        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html).
2536        """
2537        return map_future(
2538            self._native.query_rendered_features(geometry, options),
2539            lambda value: tuple(RenderedFeature._from_native(item) for item in value),
2540        )

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.

See mln_render_session_query_rendered_features in the C API reference.

def query_source_features( self, source_id: str, options: SourceFeatureQueryOptions | None = None) -> concurrent.futures._base.Future[tuple[SourceFeature, ...]]:
2542    def query_source_features(
2543        self, source_id: str, options: SourceFeatureQueryOptions | None = None
2544    ) -> Future[tuple[SourceFeature, ...]]:
2545        """Finds the features of the source named `source_id`.
2546
2547        The query covers only the tiles that the source has loaded for the
2548        current view. A source loads tiles only while a visible layer uses
2549        it.
2550
2551        See `mln_render_session_query_source_features` in the
2552        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html).
2553        """
2554        return map_future(
2555            self._native.query_source_features(source_id, options),
2556            lambda value: tuple(SourceFeature._from_native(item) for item in value),
2557        )

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.

See mln_render_session_query_source_features in the C API reference.

def read_texture( self) -> concurrent.futures._base.Future[TextureReadbackResult]:
2559    def read_texture(self) -> Future[TextureReadbackResult]:
2560        """Reads the pixels of the last frame that the session rendered.
2561
2562        See `mln_render_session_read_texture` in the
2563        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
2564
2565        Errors:
2566
2567        - `Status.UNSUPPORTED` when the session's capabilities lack
2568          `RenderSessionCapabilityFlag.READBACK`.
2569        - `Status.INVALID_STATE` when the session hasn't rendered a frame
2570          since it attached, resized, or changed its target.
2571        """
2572        return map_future(
2573            self._native.read_texture(),
2574            lambda value: TextureReadbackResult._from_native(value),
2575        )

Reads the pixels of the last frame that the session rendered.

See mln_render_session_read_texture in the C API reference.

Errors:

def reduce_memory_use(self) -> concurrent.futures._base.Future[None]:
2577    def reduce_memory_use(self) -> Future[None]:
2578        """Frees memory that the session's renderer can rebuild, such as caches.
2579
2580        See `mln_render_session_reduce_memory_use` in the
2581        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
2582
2583        Errors:
2584
2585        - `Status.TARGET_LOST` when the session loses its target before the
2586          work runs.
2587        """
2588        return self._native.reduce_memory_use()

Frees memory that the session's renderer can rebuild, such as caches.

See mln_render_session_reduce_memory_use in the C API reference.

Errors:

def release(self) -> concurrent.futures._base.Future[None]:
2590    def release(self) -> Future[None]:
2591        """Releases the session, detaching it first when it is attached.
2592
2593        Pending frame demands finish with `RenderResult.TARGET_NOT_READY`.
2594        Once the release completes, the library no longer uses your graphics
2595        objects, and you can attach another session to the map.
2596
2597        A session driven by `RenderDriverKind.CALLER_GRAPHICS_THREAD`
2598        detaches at your next `RenderSessionHandle.service_driver_work()`, so
2599        keep servicing it until the release completes. When the session isn't
2600        attached, such as while it attaches or after it fails, or when you
2601        release or dispose its map before that service, the release abandons
2602        it as `RenderSessionHandle.abandon()` does.
2603
2604        See `mln_render_session_release` in the
2605        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
2606
2607        Errors:
2608
2609        - `Status.INVALID_STATE` while you hold one of the session's acquired
2610          frames. Release or discard them first.
2611        """
2612        return self._native.release()

Releases the session, detaching it first when it is attached.

Pending frame demands finish with RenderResult.TARGET_NOT_READY. Once the release completes, the library no longer uses your graphics objects, and you can attach another session to the map.

A session driven by RenderDriverKind.CALLER_GRAPHICS_THREAD detaches at your next RenderSessionHandle.service_driver_work(), so keep servicing it until the release completes. When the session isn't attached, such as while it attaches or after it fails, or when you release or dispose its map before that service, the release abandons it as RenderSessionHandle.abandon() does.

See mln_render_session_release in the C API reference.

Errors:

  • Status.INVALID_STATE while you hold one of the session's acquired frames. Release or discard them first.
def release_target(self) -> concurrent.futures._base.Future[None]:
2614    def release_target(self) -> Future[None]:
2615        """Lets go of the session's surface or textures, and keeps the rest of
2616        the session.
2617
2618        Use it when the platform takes a surface away, such as when your app
2619        goes to the background. Release every acquired frame first. Frame
2620        demands that are still pending, and later ones until you give the
2621        session a new target, finish with `RenderResult.TARGET_NOT_READY`.
2622        Once the release completes, you can destroy the old target.
2623
2624        See `mln_render_session_release_target` in the
2625        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
2626
2627        Errors:
2628
2629        - `Status.UNSUPPORTED` when the session renders offscreen or into
2630          Android hardware buffers, dmabufs, DXGI shared textures, or
2631          IOSurfaces that it allocates.
2632        - `Status.UNSUPPORTED` when the target is a WebGL canvas.
2633        - `Status.TARGET_LOST` when the session loses its target before the
2634          release runs.
2635        """
2636        return self._native.release_target()

Lets go of the session's surface or textures, and keeps the rest of the session.

Use it when the platform takes a surface away, such as when your app goes to the background. Release every acquired frame first. Frame demands that are still pending, and later ones until you give the session a new target, finish with RenderResult.TARGET_NOT_READY. Once the release completes, you can destroy the old target.

See mln_render_session_release_target in the C API reference.

Errors:

  • Status.UNSUPPORTED when the session renders offscreen or into Android hardware buffers, dmabufs, DXGI shared textures, or IOSurfaces that it allocates.
  • Status.UNSUPPORTED when the target is a WebGL canvas.
  • Status.TARGET_LOST when the session loses its target before the release runs.
def resize( self, logical_size: LogicalSize) -> concurrent.futures._base.Future[CommandCompletion]:
2638    def resize(self, logical_size: LogicalSize) -> Future[CommandCompletion]:
2639        """Resizes the session's target and its map.
2640
2641        The session renders at the map's scale factor. Release every acquired
2642        frame first.
2643
2644        See `mln_render_session_resize` in the
2645        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
2646
2647        Errors:
2648
2649        - `Status.UNSUPPORTED` when the session renders into a borrowed ring.
2650          Give it new textures of the new size instead.
2651        - `Status.TARGET_LOST` when the session loses its target before the
2652          resize applies.
2653        """
2654        return self._native.resize(logical_size)

Resizes the session's target and its map.

The session renders at the map's scale factor. Release every acquired frame first.

See mln_render_session_resize in the C API reference.

Errors:

  • Status.UNSUPPORTED when the session renders into a borrowed ring. Give it new textures of the new size instead.
  • Status.TARGET_LOST when the session loses its target before the resize applies.
def service_driver_work(self) -> None:
2656    def service_driver_work(self) -> None:
2657        """Runs the session's ready graphics work on your graphics thread.
2658
2659        Use it with `RenderDriverKind.CALLER_GRAPHICS_THREAD`, and call it
2660        from the same thread every time. Call it each time
2661        `RenderSessionAttachOptions.driver_work_wake` is called, even while
2662        you demand no frames, until a detach, release, or disposal of the
2663        session finishes. It returns once no work is ready.
2664
2665        It accepts a released or disposed session until that release or
2666        disposal finishes.
2667
2668        See `mln_render_session_service_driver_work` in the
2669        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
2670        """
2671        return self._native.service_driver_work()

Runs the session's ready graphics work on your graphics thread.

Use it with RenderDriverKind.CALLER_GRAPHICS_THREAD, and call it from the same thread every time. Call it each time RenderSessionAttachOptions.driver_work_wake is called, even while you demand no frames, until a detach, release, or disposal of the session finishes. It returns once no work is ready.

It accepts a released or disposed session until that release or disposal finishes.

See mln_render_session_service_driver_work in the C API reference.

def set_android_surface_target( self, replacement: AndroidSurfaceReplacement) -> concurrent.futures._base.Future[None]:
2673    def set_android_surface_target(
2674        self, replacement: AndroidSurfaceReplacement
2675    ) -> Future[None]:
2676        """Replaces the Android window that the session presents to.
2677
2678        Use it to give the session a window again after
2679        `RenderSessionHandle.release_target()`, to move it to another window,
2680        or to resize it. Once the replacement completes, the session no
2681        longer uses the old window.
2682
2683        See `mln_render_session_set_android_surface_target` in the
2684        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/android_8h.html).
2685
2686        Errors:
2687
2688        - `Status.INVALID_ARGUMENT` when `surface` has no window, such as
2689          after the platform destroyed it.
2690        - `Status.UNSUPPORTED` when, in a Vulkan build, the new window needs
2691          a different color format or pre-rotation support than the old one.
2692          Attach a new session instead.
2693        - `Status.NATIVE_ERROR` when the library can't create the window's
2694          surface.
2695        """
2696        return self._native.set_android_surface_target(replacement)

Replaces the Android window that the session presents to.

Use it to give the session a window again after RenderSessionHandle.release_target(), to move it to another window, or to resize it. Once the replacement completes, the session no longer uses the old window.

See mln_render_session_set_android_surface_target in the C API reference.

Errors:

  • Status.INVALID_ARGUMENT when surface has no window, such as after the platform destroyed it.
  • Status.UNSUPPORTED when, in a Vulkan build, the new window needs a different color format or pre-rotation support than the old one. Attach a new session instead.
  • Status.NATIVE_ERROR when the library can't create the window's surface.
def set_frame_pacer(self, pacer: FramePacerHandle | None = None) -> None:
2698    def set_frame_pacer(self, pacer: FramePacerHandle | None = None) -> None:
2699        """Sets the frame pacer that demands the session's frames.
2700
2701        At the first display refresh after the session has something new to
2702        draw, `pacer` demands a frame without flags and with token 0. One
2703        pacer can serve many sessions. A null `pacer` stops pacing the
2704        session. You can call it once the attach call returns.
2705
2706        See `mln_render_session_set_frame_pacer` in the
2707        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
2708
2709        Errors:
2710
2711        - `Status.TARGET_LOST` or `Status.NATIVE_ERROR`, as
2712          `RenderSessionSnapshot.failure_status` reports, when the session
2713          has failed.
2714        - `Status.INVALID_STATE` when you attached the session with a redraw
2715          wake, or detached, abandoned, released, or disposed it.
2716        """
2717        return self._native.set_frame_pacer(None if pacer is None else pacer._native)

Sets the frame pacer that demands the session's frames.

At the first display refresh after the session has something new to draw, pacer demands a frame without flags and with token 0. One pacer can serve many sessions. A null pacer stops pacing the session. You can call it once the attach call returns.

See mln_render_session_set_frame_pacer in the C API reference.

Errors:

def set_metal_borrowed_texture_target( self, replacement: MetalBorrowedTextureReplacement) -> concurrent.futures._base.Future[None]:
2719    def set_metal_borrowed_texture_target(
2720        self, replacement: MetalBorrowedTextureReplacement
2721    ) -> Future[None]:
2722        """Replaces the Metal textures that a borrowed ring renders into.
2723
2724        Use it to resize the ring, or to give the session textures again
2725        after `RenderSessionHandle.release_target()`. Release every acquired
2726        frame first. Once the replacement completes, the session no longer
2727        uses the old textures.
2728
2729        See `mln_render_session_set_metal_borrowed_texture_target` in the
2730        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
2731
2732        Errors:
2733
2734        - `Status.UNSUPPORTED` when the new textures have a different pixel
2735          format than the old ones. Attach a new session to change it.
2736        """
2737        return self._native.set_metal_borrowed_texture_target(replacement)

Replaces the Metal textures that a borrowed ring renders into.

Use it to resize the ring, or to give the session textures again after RenderSessionHandle.release_target(). Release every acquired frame first. Once the replacement completes, the session no longer uses the old textures.

See mln_render_session_set_metal_borrowed_texture_target in the C API reference.

Errors:

  • Status.UNSUPPORTED when the new textures have a different pixel format than the old ones. Attach a new session to change it.
def set_metal_surface_target( self, replacement: MetalSurfaceReplacement) -> concurrent.futures._base.Future[None]:
2739    def set_metal_surface_target(
2740        self, replacement: MetalSurfaceReplacement
2741    ) -> Future[None]:
2742        """Replaces the Metal layer that the session renders to.
2743
2744        Use it to give the session a layer again after
2745        `RenderSessionHandle.release_target()`, to move it to another layer,
2746        or to resize it. Once the replacement completes, the session no
2747        longer uses the old layer.
2748
2749        See `mln_render_session_set_metal_surface_target` in the
2750        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html).
2751        """
2752        return self._native.set_metal_surface_target(replacement)

Replaces the Metal layer that the session renders to.

Use it to give the session a layer again after RenderSessionHandle.release_target(), to move it to another layer, or to resize it. Once the replacement completes, the session no longer uses the old layer.

See mln_render_session_set_metal_surface_target in the C API reference.

def set_open_gl_borrowed_texture_target( self, replacement: OpenGlBorrowedTextureReplacement) -> concurrent.futures._base.Future[None]:
2754    def set_open_gl_borrowed_texture_target(
2755        self, replacement: OpenGlBorrowedTextureReplacement
2756    ) -> Future[None]:
2757        """Replaces the OpenGL textures that a borrowed ring renders into.
2758
2759        Use it to resize the ring, or to give the session textures again
2760        after `RenderSessionHandle.release_target()`. Release every acquired
2761        frame first. Once the replacement completes, the session no longer
2762        uses the old textures.
2763
2764        See `mln_render_session_set_open_gl_borrowed_texture_target` in the
2765        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
2766        """
2767        return self._native.set_open_gl_borrowed_texture_target(replacement)

Replaces the OpenGL textures that a borrowed ring renders into.

Use it to resize the ring, or to give the session textures again after RenderSessionHandle.release_target(). Release every acquired frame first. Once the replacement completes, the session no longer uses the old textures.

See mln_render_session_set_open_gl_borrowed_texture_target in the C API reference.

def set_open_gl_surface_target( self, replacement: OpenGlSurfaceReplacement) -> concurrent.futures._base.Future[None]:
2769    def set_open_gl_surface_target(
2770        self, replacement: OpenGlSurfaceReplacement
2771    ) -> Future[None]:
2772        """Replaces the OpenGL surface that the session presents to.
2773
2774        Use it to give the session a surface again after
2775        `RenderSessionHandle.release_target()`, to move it to another
2776        surface, or to resize it. Once the replacement completes, the session
2777        no longer uses the old surface.
2778
2779        See `mln_render_session_set_open_gl_surface_target` in the
2780        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html).
2781        """
2782        return self._native.set_open_gl_surface_target(replacement)

Replaces the OpenGL surface that the session presents to.

Use it to give the session a surface again after RenderSessionHandle.release_target(), to move it to another surface, or to resize it. Once the replacement completes, the session no longer uses the old surface.

See mln_render_session_set_open_gl_surface_target in the C API reference.

def set_vulkan_borrowed_texture_target( self, replacement: VulkanBorrowedTextureReplacement) -> concurrent.futures._base.Future[None]:
2784    def set_vulkan_borrowed_texture_target(
2785        self, replacement: VulkanBorrowedTextureReplacement
2786    ) -> Future[None]:
2787        """Replaces the Vulkan images that a borrowed ring renders into.
2788
2789        Use it to resize the ring, or to give the session images again after
2790        `RenderSessionHandle.release_target()`. Release every acquired frame
2791        first. Once the replacement completes, the session no longer uses the
2792        old images.
2793
2794        See `mln_render_session_set_vulkan_borrowed_texture_target` in the
2795        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
2796        """
2797        return self._native.set_vulkan_borrowed_texture_target(replacement)

Replaces the Vulkan images that a borrowed ring renders into.

Use it to resize the ring, or to give the session images again after RenderSessionHandle.release_target(). Release every acquired frame first. Once the replacement completes, the session no longer uses the old images.

See mln_render_session_set_vulkan_borrowed_texture_target in the C API reference.

def set_vulkan_surface_target( self, replacement: VulkanSurfaceReplacement) -> concurrent.futures._base.Future[None]:
2799    def set_vulkan_surface_target(
2800        self, replacement: VulkanSurfaceReplacement
2801    ) -> Future[None]:
2802        """Replaces the Vulkan surface that the session presents to.
2803
2804        Use it to give the session a surface again after
2805        `RenderSessionHandle.release_target()`, to move it to another
2806        surface, or to resize it. Once the replacement completes, the session
2807        no longer uses the old surface.
2808
2809        See `mln_render_session_set_vulkan_surface_target` in the
2810        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html).
2811
2812        Errors:
2813
2814        - `Status.UNSUPPORTED` when the new surface needs a different color
2815          format or pre-rotation support than the old one. Attach a new
2816          session instead.
2817        """
2818        return self._native.set_vulkan_surface_target(replacement)

Replaces the Vulkan surface that the session presents to.

Use it to give the session a surface again after RenderSessionHandle.release_target(), to move it to another surface, or to resize it. Once the replacement completes, the session no longer uses the old surface.

See mln_render_session_set_vulkan_surface_target in the C API reference.

Errors:

  • Status.UNSUPPORTED when the new surface needs a different color format or pre-rotation support than the old one. Attach a new session instead.
def set_wayland_surface_target( self, replacement: WaylandSurfaceReplacement) -> concurrent.futures._base.Future[None]:
2820    def set_wayland_surface_target(
2821        self, replacement: WaylandSurfaceReplacement
2822    ) -> Future[None]:
2823        """Replaces the Wayland surface that the session presents to.
2824
2825        Use it to give the session a surface again after
2826        `RenderSessionHandle.release_target()`, to move it to another
2827        surface, or to resize it. Once the replacement completes, the session
2828        no longer uses the old surface.
2829
2830        See `mln_render_session_set_wayland_surface_target` in the
2831        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/wayland_8h.html).
2832
2833        Errors:
2834
2835        - `Status.UNSUPPORTED` when, in a Vulkan build, the new surface needs
2836          a different color format than the old one. Attach a new session
2837          instead.
2838        - `Status.NATIVE_ERROR` when the library can't present to the new
2839          surface.
2840        """
2841        return self._native.set_wayland_surface_target(replacement)

Replaces the Wayland surface that the session presents to.

Use it to give the session a surface again after RenderSessionHandle.release_target(), to move it to another surface, or to resize it. Once the replacement completes, the session no longer uses the old surface.

See mln_render_session_set_wayland_surface_target in the C API reference.

Errors:

  • Status.UNSUPPORTED when, in a Vulkan build, the new surface needs a different color format than the old one. Attach a new session instead.
  • Status.NATIVE_ERROR when the library can't present to the new surface.
def set_win32_window_target( self, replacement: Win32WindowReplacement) -> concurrent.futures._base.Future[None]:
2843    def set_win32_window_target(
2844        self, replacement: Win32WindowReplacement
2845    ) -> Future[None]:
2846        """Replaces the Win32 window that the session presents to.
2847
2848        Use it to give the session a window again after
2849        `RenderSessionHandle.release_target()`, to move it to another window,
2850        or to resize it. Once the replacement completes, the session no
2851        longer uses the old window.
2852
2853        See `mln_render_session_set_win32_window_target` in the
2854        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/win32_8h.html).
2855
2856        Errors:
2857
2858        - `Status.INVALID_ARGUMENT` when `window` isn't a window, or, in an
2859          OpenGL build, already has another pixel format.
2860        - `Status.INVALID_STATE` when `window` is minimized or has no client
2861          area.
2862        - `Status.INVALID_STATE` when `window` was minimized before the
2863          replacement ran.
2864        - `Status.UNSUPPORTED` when, in a Vulkan build, the new window needs
2865          a different color format than the old one. Attach a new session
2866          instead.
2867        - `Status.NATIVE_ERROR` when the library can't present to the new
2868          window.
2869        """
2870        return self._native.set_win32_window_target(replacement)

Replaces the Win32 window that the session presents to.

Use it to give the session a window again after RenderSessionHandle.release_target(), to move it to another window, or to resize it. Once the replacement completes, the session no longer uses the old window.

See mln_render_session_set_win32_window_target in the C API reference.

Errors:

ready: concurrent.futures._base.Future[None]
199    @property
200    def ready(self) -> Future[None]:
201        """Completes once the session is ready, and fails with `MaplibreError` when it
202        fails to become ready. Asynchronous calls on the session before then wait
203        for it."""
204        return self._ready

Completes once the session is ready, and fails with MaplibreError when it fails to become ready. Asynchronous calls on the session before then wait for it.

id: int
206    @property
207    def id(self) -> int:
208        """The native handle value. It stays readable after release."""
209        return int(self._native.id)

The native handle value. It stays readable after release.

def dispose(self) -> None:
211    def dispose(self) -> None:
212        """Releases the session in any state, and finishes in the background.
213
214        Use it from destructors and finalizers, and
215        `RenderSessionHandle.release()` elsewhere. It ends the session as a
216        release does, except that it abandons a session whose frames you
217        hold, which ends those frames. Keep servicing a session driven by
218        `RenderDriverKind.CALLER_GRAPHICS_THREAD` until
219        `RenderSessionHandle.service_driver_work()` no longer accepts it.
220
221        See `mln_render_session_dispose` in the
222        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
223        """
224        self._native._dispose()

Releases the session in any state, and finishes in the background.

Use it from destructors and finalizers, and RenderSessionHandle.release() elsewhere. It ends the session as a release does, except that it abandons a session whose frames you hold, which ends those frames. Keep servicing a session driven by RenderDriverKind.CALLER_GRAPHICS_THREAD until RenderSessionHandle.service_driver_work() no longer accepts it.

See mln_render_session_dispose in the C API reference.

class RenderSessionHandleDiscarding:
4359class RenderSessionHandleDiscarding:
4360    __slots__ = ("_native",)
4361    _native: _native._RenderSessionHandle
4362
4363    def __init__(self, owner: _RenderSessionHandleOperations):
4364        self._native = owner._native
4365
4366    def resize(self, logical_size: LogicalSize) -> None:
4367        """Resizes the session's target and its map.
4368
4369        The session renders at the map's scale factor. Release every acquired
4370        frame first.
4371
4372        See `mln_render_session_resize` in the
4373        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
4374
4375        Errors:
4376
4377        - `Status.UNSUPPORTED` when the session renders into a borrowed ring.
4378          Give it new textures of the new size instead.
4379        """
4380        return self._native._discard_resize(logical_size)
RenderSessionHandleDiscarding( owner: maplibre_native_ffi._generated_operations._RenderSessionHandleOperations)
4363    def __init__(self, owner: _RenderSessionHandleOperations):
4364        self._native = owner._native
def resize( self, logical_size: LogicalSize) -> None:
4366    def resize(self, logical_size: LogicalSize) -> None:
4367        """Resizes the session's target and its map.
4368
4369        The session renders at the map's scale factor. Release every acquired
4370        frame first.
4371
4372        See `mln_render_session_resize` in the
4373        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
4374
4375        Errors:
4376
4377        - `Status.UNSUPPORTED` when the session renders into a borrowed ring.
4378          Give it new textures of the new size instead.
4379        """
4380        return self._native._discard_resize(logical_size)

Resizes the session's target and its map.

The session renders at the map's scale factor. Release every acquired frame first.

See mln_render_session_resize in the C API reference.

Errors:

  • Status.UNSUPPORTED when the session renders into a borrowed ring. Give it new textures of the new size instead.
@dataclass(frozen=True, slots=True)
class RenderSessionSnapshot:
3957@dataclass(frozen=True, slots=True)
3958class RenderSessionSnapshot:
3959    """The state of a render session at one moment.
3960
3961    See `mln_render_session_snapshot` in the
3962    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
3963    """
3964
3965    state: RenderSessionState
3966
3967    extent: LogicalExtent
3968    """The target's logical size, and the map's scale factor."""
3969
3970    generation: int
3971
3972    frame_generation: int
3973
3974    acquired_frame_count: int
3975
3976    failure_status: Status
3977    """`Status.OK` until the session fails. Then `Status.TARGET_LOST` when it
3978    failed because it lost its target, or `Status.NATIVE_ERROR` when it
3979    failed for another reason.
3980    """
3981
3982    has_target: bool
3983    """Whether the session is attached and has a target to render to. It's false
3984    from when `RenderSessionHandle.release_target()` completes until you give
3985    the session a new target.
3986    """
3987
3988    @classmethod
3989    def _from_native(cls, raw):
3990        return cls(
3991            state=RenderSessionState(raw["state"]),
3992            extent=LogicalExtent._from_native(raw["extent"]),
3993            generation=raw["generation"],
3994            frame_generation=raw["frame_generation"],
3995            acquired_frame_count=raw["acquired_frame_count"],
3996            failure_status=Status(raw["failure_status"]),
3997            has_target=raw["has_target"],
3998        )

The state of a render session at one moment.

See mln_render_session_snapshot in the C API reference.

RenderSessionSnapshot( state: RenderSessionState, extent: LogicalExtent, generation: int, frame_generation: int, acquired_frame_count: int, failure_status: Status, has_target: bool)
extent: LogicalExtent

The target's logical size, and the map's scale factor.

generation: int
frame_generation: int
acquired_frame_count: int
failure_status: Status

Status.OK until the session fails. Then Status.TARGET_LOST when it failed because it lost its target, or Status.NATIVE_ERROR when it failed for another reason.

has_target: bool

Whether the session is attached and has a target to render to. It's false from when RenderSessionHandle.release_target() completes until you give the session a new target.

class RenderSessionState(maplibre_native_ffi._enum.UnknownIntEnum):
686class RenderSessionState(UnknownIntEnum):
687    """Where a render session is in its life.
688
689    See `mln_render_session_state` in the
690    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__session_8h.html).
691    """
692
693    ATTACHING = 1
694    ATTACHED = 2
695    DETACHING = 3
696    DETACHED = 4
697    FAILED = 5
698    ABANDONED = 6

Where a render session is in its life.

See mln_render_session_state in the C API reference.

ATTACHING = <RenderSessionState.ATTACHING: 1>
ATTACHED = <RenderSessionState.ATTACHED: 2>
DETACHING = <RenderSessionState.DETACHING: 3>
DETACHED = <RenderSessionState.DETACHED: 4>
ABANDONED = <RenderSessionState.ABANDONED: 6>
@dataclass(frozen=True, slots=True)
class RenderedFeature:
4001@dataclass(frozen=True, slots=True)
4002class RenderedFeature:
4003    """A feature that a rendered feature query found.
4004
4005    See `mln_rendered_feature` in the
4006    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html).
4007    """
4008
4009    feature: Any
4010    """The feature, as a GeoJSON feature."""
4011
4012    layer_id: str
4013    """The layer that drew the feature."""
4014
4015    source_id: str
4016
4017    source_layer_id: str
4018    """The feature's source layer, or empty when its source has none."""
4019
4020    state: Any
4021    """The feature's state, as a JSON object."""
4022
4023    @classmethod
4024    def _from_native(cls, raw):
4025        return cls(
4026            feature=raw["feature"],
4027            layer_id=raw["layer_id"],
4028            source_id=raw["source_id"],
4029            source_layer_id=raw["source_layer_id"],
4030            state=raw["state"],
4031        )

A feature that a rendered feature query found.

See mln_rendered_feature in the C API reference.

RenderedFeature( feature: Any, layer_id: str, source_id: str, source_layer_id: str, state: Any)
feature: Any

The feature, as a GeoJSON feature.

layer_id: str

The layer that drew the feature.

source_id: str
source_layer_id: str

The feature's source layer, or empty when its source has none.

state: Any

The feature's state, as a JSON object.

@dataclass(frozen=True, slots=True)
class RenderedFeatureQueryOptions:
4034@dataclass(frozen=True, slots=True)
4035class RenderedFeatureQueryOptions:
4036    """Options for a rendered feature query.
4037
4038    See `mln_rendered_feature_query_options` in the
4039    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html).
4040    """
4041
4042    layer_ids: Sequence[str] | None = None
4043    """The layers to query. Without them, the query covers every layer."""
4044
4045    filter: Any = None
4046    """A \\[filter\\](https://maplibre.org/maplibre-style-spec/expressions/) that
4047    each feature must match. Empty matches every feature.
4048    """
4049
4050    def __post_init__(self):
4051        object.__setattr__(self, "layer_ids", _sequence(self.layer_ids))
4052
4053    @classmethod
4054    def _from_native(cls, raw):
4055        return cls(
4056            layer_ids=None
4057            if raw["layer_ids"] is None
4058            else (tuple(item for item in raw["layer_ids"])),
4059            filter=raw["filter"],
4060        )

Options for a rendered feature query.

See mln_rendered_feature_query_options in the C API reference.

RenderedFeatureQueryOptions(layer_ids: Sequence[str] | None = None, filter: Any = None)
layer_ids: Sequence[str] | None

The layers to query. Without them, the query covers every layer.

filter: Any

A [filter](https://maplibre.org/maplibre-style-spec/expressions/) that each feature must match. Empty matches every feature.

@dataclass(frozen=True, slots=True)
class RenderedQueryGeometryBoxVariant:
137@dataclass(frozen=True, slots=True)
138class RenderedQueryGeometryBoxVariant:
139    value: ScreenBox
140    _tag = 2
141
142    @classmethod
143    def _from_native(cls, raw):
144        return cls(ScreenBox._from_native(raw))
RenderedQueryGeometryBoxVariant(value: ScreenBox)
value: ScreenBox
@dataclass(frozen=True, slots=True)
class RenderedQueryGeometryLineStringVariant:
147@dataclass(frozen=True, slots=True)
148class RenderedQueryGeometryLineStringVariant:
149    value: ScreenLineString
150    _tag = 3
151
152    @classmethod
153    def _from_native(cls, raw):
154        return cls(ScreenLineString._from_native(raw))
RenderedQueryGeometryLineStringVariant(value: ScreenLineString)
@dataclass(frozen=True, slots=True)
class RenderedQueryGeometryPointVariant:
127@dataclass(frozen=True, slots=True)
128class RenderedQueryGeometryPointVariant:
129    value: ScreenPoint
130    _tag = 1
131
132    @classmethod
133    def _from_native(cls, raw):
134        return cls(ScreenPoint._from_native(raw))
RenderedQueryGeometryPointVariant(value: ScreenPoint)
value: ScreenPoint
@dataclass(frozen=True, slots=True)
class RenderingStats:
4075@dataclass(frozen=True, slots=True)
4076class RenderingStats:
4077    """Statistics about the frames that a map renders.
4078
4079    See `mln_rendering_stats` in the
4080    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4081    """
4082
4083    encoding_time_ms: float
4084    """The time that the frame took to encode, in milliseconds."""
4085
4086    rendering_time_ms: float
4087    """The time that the frame took to render, in milliseconds."""
4088
4089    frame_count: int
4090    """The frames rendered so far."""
4091
4092    draw_call_count: int
4093    """The draw calls in the frame."""
4094
4095    total_draw_call_count: int
4096    """The draw calls in every frame so far."""
4097
4098    @classmethod
4099    def _from_native(cls, raw):
4100        return cls(
4101            encoding_time_ms=raw["encoding_time_ms"],
4102            rendering_time_ms=raw["rendering_time_ms"],
4103            frame_count=raw["frame_count"],
4104            draw_call_count=raw["draw_call_count"],
4105            total_draw_call_count=raw["total_draw_call_count"],
4106        )

Statistics about the frames that a map renders.

See mln_rendering_stats in the C API reference.

RenderingStats( encoding_time_ms: float, rendering_time_ms: float, frame_count: int, draw_call_count: int, total_draw_call_count: int)
encoding_time_ms: float

The time that the frame took to encode, in milliseconds.

rendering_time_ms: float

The time that the frame took to render, in milliseconds.

frame_count: int

The frames rendered so far.

draw_call_count: int

The draw calls in the frame.

total_draw_call_count: int

The draw calls in every frame so far.

class ResourceErrorReason(maplibre_native_ffi._enum.UnknownIntEnum):
701class ResourceErrorReason(UnknownIntEnum):
702    """Why a resource request failed.
703
704    See `mln_resource_error_reason` in the
705    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
706    """
707
708    OTHER = 0
709    NOT_FOUND = 1
710    SERVER = 2
711    CONNECTION = 3
712    RATE_LIMIT = 4

Why a resource request failed.

See mln_resource_error_reason in the C API reference.

CONNECTION = <ResourceErrorReason.CONNECTION: 3>
RATE_LIMIT = <ResourceErrorReason.RATE_LIMIT: 4>
class ResourceKind(maplibre_native_ffi._enum.UnknownIntEnum):
715class ResourceKind(UnknownIntEnum):
716    """The kind of a resource that the library loads.
717
718    See `mln_resource_kind` in the
719    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
720    """
721
722    UNKNOWN = 0
723    STYLE = 1
724    SOURCE = 2
725    TILE = 3
726    GLYPHS = 4
727    SPRITE_IMAGE = 5
728    SPRITE_JSON = 6
729    IMAGE = 7

The kind of a resource that the library loads.

See mln_resource_kind in the C API reference.

UNKNOWN = <ResourceKind.UNKNOWN: 0>
STYLE = <ResourceKind.STYLE: 1>
SOURCE = <ResourceKind.SOURCE: 2>
TILE = <ResourceKind.TILE: 3>
GLYPHS = <ResourceKind.GLYPHS: 4>
SPRITE_IMAGE = <ResourceKind.SPRITE_IMAGE: 5>
SPRITE_JSON = <ResourceKind.SPRITE_JSON: 6>
IMAGE = <ResourceKind.IMAGE: 7>
class ResourceKindFlag(enum.IntFlag):
732class ResourceKindFlag(IntFlag):
733    """A resource kind, as a bit in a set.
734
735    See `mln_resource_kind_flag` in the
736    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
737    """
738
739    UNKNOWN = 1
740    STYLE = 2
741    SOURCE = 4
742    TILE = 8
743    GLYPHS = 16
744    SPRITE_IMAGE = 32
745    SPRITE_JSON = 64
746    IMAGE = 128
747    ALL = 255

A resource kind, as a bit in a set.

See mln_resource_kind_flag in the C API reference.

UNKNOWN = <ResourceKindFlag.UNKNOWN: 1>
STYLE = <ResourceKindFlag.STYLE: 2>
SOURCE = <ResourceKindFlag.SOURCE: 4>
TILE = <ResourceKindFlag.TILE: 8>
GLYPHS = <ResourceKindFlag.GLYPHS: 16>
SPRITE_IMAGE = <ResourceKindFlag.SPRITE_IMAGE: 32>
SPRITE_JSON = <ResourceKindFlag.SPRITE_JSON: 64>
IMAGE = <ResourceKindFlag.IMAGE: 128>
ALL = <ResourceKindFlag.ALL: 255>
class ResourceLoadingMethod(maplibre_native_ffi._enum.UnknownIntEnum):
750class ResourceLoadingMethod(UnknownIntEnum):
751    """Where a request may load its resource from.
752
753    See `mln_resource_loading_method` in the
754    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
755    """
756
757    ALL = 0
758    CACHE_ONLY = 1
759    NETWORK_ONLY = 2

Where a request may load its resource from.

See mln_resource_loading_method in the C API reference.

class ResourcePriority(maplibre_native_ffi._enum.UnknownIntEnum):
762class ResourcePriority(UnknownIntEnum):
763    """The priority of a resource request.
764
765    See `mln_resource_priority` in the
766    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
767    """
768
769    REGULAR = 0
770    LOW = 1

The priority of a resource request.

See mln_resource_priority in the C API reference.

REGULAR = <ResourcePriority.REGULAR: 0>
@dataclass(frozen=True, slots=True)
class ResourceProvider:
4109@dataclass(frozen=True, slots=True)
4110class ResourceProvider:
4111    """A resource provider, for `RuntimeHandle.set_resource_provider()`.
4112
4113    See `mln_resource_provider` in the
4114    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4115    """
4116
4117    callback: ResourceProviderCallback
4118    routes: Sequence[ResourceRoute] = ()
4119    """The requests that the provider serves. Without routes, it serves every
4120    network request.
4121    """
4122
4123    def __post_init__(self):
4124        object.__setattr__(self, "routes", _sequence(self.routes))
4125
4126    def _invoke_callback(self, request, handle):
4127        callback = self.callback
4128        handle = _adopt_value(handle, "ResourceRequestHandle")
4129        try:
4130            return callback(ResourceRequestInfo._from_native(request), handle)
4131        except BaseException:
4132            handle.release()
4133            raise

A resource provider, for RuntimeHandle.set_resource_provider().

See mln_resource_provider in the C API reference.

ResourceProvider( callback: ResourceProviderCallback, routes: Sequence[ResourceRoute] = ())
routes: Sequence[ResourceRoute]

The requests that the provider serves. Without routes, it serves every network request.

class ResourceProviderCallback(typing.Protocol):
5921class ResourceProviderCallback(Protocol):
5922    """Serves a network request in place of the library.
5923
5924    Answer with `ResourceRequestHandle.complete()`, or hand the request back
5925    to the library with `ResourceRequestHandle.pass_through()`. Either can
5926    come now or later, from any thread. A request released without an answer
5927    fails.
5928
5929    See `mln_resource_provider_callback` in the
5930    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
5931    """
5932
5933    def __call__(
5934        self, request: ResourceRequestInfo, handle: ResourceRequestHandle, /
5935    ) -> None: ...

Serves a network request in place of the library.

Answer with ResourceRequestHandle.complete(), or hand the request back to the library with ResourceRequestHandle.pass_through(). Either can come now or later, from any thread. A request released without an answer fails.

See mln_resource_provider_callback in the C API reference.

ResourceProviderCallback(*args, **kwargs)
1903def _no_init_or_replace_init(self, *args, **kwargs):
1904    cls = type(self)
1905
1906    if cls._is_protocol:
1907        raise TypeError('Protocols cannot be instantiated')
1908
1909    # Already using a custom `__init__`. No need to calculate correct
1910    # `__init__` to call. This can lead to RecursionError. See bpo-45121.
1911    if cls.__init__ is not _no_init_or_replace_init:
1912        return
1913
1914    # Initially, `__init__` of a protocol subclass is set to `_no_init_or_replace_init`.
1915    # The first instantiation of the subclass will call `_no_init_or_replace_init` which
1916    # searches for a proper new `__init__` in the MRO. The new `__init__`
1917    # replaces the subclass' old `__init__` (ie `_no_init_or_replace_init`). Subsequent
1918    # instantiation of the protocol subclass will thus use the new
1919    # `__init__` and no longer call `_no_init_or_replace_init`.
1920    for base in cls.__mro__:
1921        init = base.__dict__.get('__init__', _no_init_or_replace_init)
1922        if init is not _no_init_or_replace_init:
1923            cls.__init__ = init
1924            break
1925    else:
1926        # should not happen
1927        cls.__init__ = object.__init__
1928
1929    cls.__init__(self, *args, **kwargs)
@dataclass(frozen=True, slots=True)
class ResourceRange:
4136@dataclass(frozen=True, slots=True)
4137class ResourceRange:
4138    """The bytes from `start` to `end` of a resource, both included.
4139
4140    See `mln_resource_range` in the
4141    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4142    """
4143
4144    start: int
4145
4146    end: int
4147
4148    @classmethod
4149    def _from_native(cls, raw):
4150        return cls(start=raw["start"], end=raw["end"])

The bytes from start to end of a resource, both included.

See mln_resource_range in the C API reference.

ResourceRange(start: int, end: int)
start: int
end: int
class ResourceRequestCancelCallback(typing.Protocol):
5938class ResourceRequestCancelCallback(Protocol):
5939    """Reports that the library no longer needs a resource request.
5940
5941    The request no longer accepts an answer, so stop working on it and
5942    release it.
5943
5944    See `mln_resource_request_cancel_callback` in the
5945    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
5946    """
5947
5948    def __call__(self, /) -> None: ...

Reports that the library no longer needs a resource request.

The request no longer accepts an answer, so stop working on it and release it.

See mln_resource_request_cancel_callback in the C API reference.

ResourceRequestCancelCallback(*args, **kwargs)
1903def _no_init_or_replace_init(self, *args, **kwargs):
1904    cls = type(self)
1905
1906    if cls._is_protocol:
1907        raise TypeError('Protocols cannot be instantiated')
1908
1909    # Already using a custom `__init__`. No need to calculate correct
1910    # `__init__` to call. This can lead to RecursionError. See bpo-45121.
1911    if cls.__init__ is not _no_init_or_replace_init:
1912        return
1913
1914    # Initially, `__init__` of a protocol subclass is set to `_no_init_or_replace_init`.
1915    # The first instantiation of the subclass will call `_no_init_or_replace_init` which
1916    # searches for a proper new `__init__` in the MRO. The new `__init__`
1917    # replaces the subclass' old `__init__` (ie `_no_init_or_replace_init`). Subsequent
1918    # instantiation of the protocol subclass will thus use the new
1919    # `__init__` and no longer call `_no_init_or_replace_init`.
1920    for base in cls.__mro__:
1921        init = base.__dict__.get('__init__', _no_init_or_replace_init)
1922        if init is not _no_init_or_replace_init:
1923            cls.__init__ = init
1924            break
1925    else:
1926        # should not happen
1927        cls.__init__ = object.__init__
1928
1929    cls.__init__(self, *args, **kwargs)
@dataclass(frozen=True, slots=True)
class ResourceRequestCancelHandler:
4153@dataclass(frozen=True, slots=True)
4154class ResourceRequestCancelHandler:
4155    """A cancel callback, for `ResourceRequestHandle.set_cancel_callback()`.
4156
4157    See `mln_resource_request_cancel_handler` in the
4158    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4159    """
4160
4161    callback: ResourceRequestCancelCallback
4162
4163    def _invoke_callback(self):
4164        callback = self.callback
4165        return callback()

A cancel callback, for ResourceRequestHandle.set_cancel_callback().

See mln_resource_request_cancel_handler in the C API reference.

ResourceRequestCancelHandler( callback: ResourceRequestCancelCallback)
class ResourceRequestHandle(maplibre_native_ffi._generated_operations._ResourceRequestHandleOperations, maplibre_native_ffi._lifecycle.ScopedHandleMixin):

A resource load that a resource provider answers.

See mln_resource_request in the C API reference.

def complete( self, response: ResourceResponse) -> None:
2880    def complete(self, response: ResourceResponse) -> None:
2881        """Answers a resource request.
2882
2883        A failed answer fails the request with `ResourceErrorReason.OTHER`,
2884        as `ResourceRequestHandle.release()` does.
2885
2886        See `mln_resource_request_complete` in the
2887        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
2888
2889        Errors:
2890
2891        - `Status.INVALID_STATE` when the library cancelled the request.
2892        """
2893        return _answer(self, lambda: self._native.complete(response))

Answers a resource request.

A failed answer fails the request with ResourceErrorReason.OTHER, as ResourceRequestHandle.release() does.

See mln_resource_request_complete in the C API reference.

Errors:

def is_cancelled(self) -> bool:
2895    def is_cancelled(self) -> bool:
2896        """Reads whether the library cancelled a resource request.
2897
2898        See `mln_resource_request_is_cancelled` in the
2899        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
2900        """
2901        return self._native.is_cancelled()

Reads whether the library cancelled a resource request.

See mln_resource_request_is_cancelled in the C API reference.

def pass_through(self) -> None:
2903    def pass_through(self) -> None:
2904        """Hands a resource request back to the library to load as usual.
2905
2906        A failed call fails the request with `ResourceErrorReason.OTHER`, as
2907        `ResourceRequestHandle.release()` does.
2908
2909        See `mln_resource_request_pass_through` in the
2910        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
2911
2912        Errors:
2913
2914        - `Status.INVALID_STATE` when the library cancelled the request.
2915        """
2916        return _answer(self, lambda: self._native.pass_through())

Hands a resource request back to the library to load as usual.

A failed call fails the request with ResourceErrorReason.OTHER, as ResourceRequestHandle.release() does.

See mln_resource_request_pass_through in the C API reference.

Errors:

def release(self) -> None:
2918    def release(self) -> None:
2919        """Releases a resource request.
2920
2921        Releasing a request without an answer fails it with
2922        `ResourceErrorReason.OTHER`.
2923
2924        See `mln_resource_request_release` in the
2925        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
2926        """
2927        return self._native.release()

Releases a resource request.

Releasing a request without an answer fails it with ResourceErrorReason.OTHER.

See mln_resource_request_release in the C API reference.

def set_cancel_callback( self, handler: ResourceRequestCancelHandler) -> bool:
2929    def set_cancel_callback(self, handler: ResourceRequestCancelHandler) -> bool:
2930        """Calls a callback when the library cancels a resource request.
2931
2932        The callback never runs after the request is answered. A request
2933        takes one cancel callback. When the library has already cancelled the
2934        request, the call reports that instead and the callback never runs.
2935
2936        See `mln_resource_request_set_cancel_callback` in the
2937        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
2938        """
2939        return self._native.set_cancel_callback(handler)

Calls a callback when the library cancels a resource request.

The callback never runs after the request is answered. A request takes one cancel callback. When the library has already cancelled the request, the call reports that instead and the callback never runs.

See mln_resource_request_set_cancel_callback in the C API reference.

id: int
247    @property
248    def id(self) -> int:
249        """The native handle value. It stays readable after release."""
250        return int(self._native.id)

The native handle value. It stays readable after release.

@dataclass(frozen=True, slots=True)
class ResourceRequestInfo:
4168@dataclass(frozen=True, slots=True)
4169class ResourceRequestInfo:
4170    """A request that a resource provider serves.
4171
4172    When the cache holds an earlier copy of the resource, the `prior_` fields
4173    describe it.
4174
4175    See `mln_resource_request_info` in the
4176    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4177    """
4178
4179    requested_url: str
4180    """The URL as the style names it."""
4181
4182    resolved_url: str
4183    """The URL to load, after the library expands any shorthand in
4184    `requested_url` and before any resource transform. Routes match this URL.
4185    """
4186
4187    kind: ResourceKind
4188
4189    loading_method: ResourceLoadingMethod
4190
4191    priority: ResourcePriority
4192
4193    usage: ResourceUsage
4194
4195    storage_policy: ResourceStoragePolicy
4196
4197    range: ResourceRange | None
4198    """The only bytes of the resource that the request wants."""
4199
4200    prior_modified_unix_ms: int | None
4201
4202    prior_expires_unix_ms: int | None
4203
4204    prior_etag: str
4205    """Empty when the earlier copy has no ETag."""
4206
4207    prior_data: bytes
4208
4209    @classmethod
4210    def _from_native(cls, raw):
4211        return cls(
4212            requested_url=raw["requested_url"],
4213            resolved_url=raw["resolved_url"],
4214            kind=ResourceKind(raw["kind"]),
4215            loading_method=ResourceLoadingMethod(raw["loading_method"]),
4216            priority=ResourcePriority(raw["priority"]),
4217            usage=ResourceUsage(raw["usage"]),
4218            storage_policy=ResourceStoragePolicy(raw["storage_policy"]),
4219            range=_maybe(ResourceRange._from_native, raw["range"]),
4220            prior_modified_unix_ms=raw["prior_modified_unix_ms"],
4221            prior_expires_unix_ms=raw["prior_expires_unix_ms"],
4222            prior_etag=raw["prior_etag"],
4223            prior_data=raw["prior_data"],
4224        )

A request that a resource provider serves.

When the cache holds an earlier copy of the resource, the prior_ fields describe it.

See mln_resource_request_info in the C API reference.

ResourceRequestInfo( requested_url: str, resolved_url: str, kind: ResourceKind, loading_method: ResourceLoadingMethod, priority: ResourcePriority, usage: ResourceUsage, storage_policy: ResourceStoragePolicy, range: ResourceRange | None, prior_modified_unix_ms: int | None, prior_expires_unix_ms: int | None, prior_etag: str, prior_data: bytes)
requested_url: str

The URL as the style names it.

resolved_url: str

The URL to load, after the library expands any shorthand in requested_url and before any resource transform. Routes match this URL.

kind: ResourceKind
loading_method: ResourceLoadingMethod
priority: ResourcePriority
usage: ResourceUsage
storage_policy: ResourceStoragePolicy
range: ResourceRange | None

The only bytes of the resource that the request wants.

prior_modified_unix_ms: int | None
prior_expires_unix_ms: int | None
prior_etag: str

Empty when the earlier copy has no ETag.

prior_data: bytes
@dataclass(frozen=True, slots=True)
class ResourceResponse:
4227@dataclass(frozen=True, slots=True)
4228class ResourceResponse:
4229    """The answer to a resource request.
4230
4231    See `mln_resource_response` in the
4232    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4233    """
4234
4235    status: ResourceResponseStatus = ResourceResponseStatus.OK
4236
4237    error_reason: ResourceErrorReason = ResourceErrorReason.OTHER
4238    """Why the request failed, for `ResourceResponseStatus.ERROR`."""
4239
4240    bytes: Buffer = b""
4241    """The resource, for `ResourceResponseStatus.OK`."""
4242
4243    error_message: str = ""
4244    """A description of the error, for `ResourceResponseStatus.ERROR`."""
4245
4246    must_revalidate: bool = False
4247    """Whether the library must request the resource again before it reuses this
4248    copy.
4249    """
4250
4251    modified_unix_ms: int | None = None
4252
4253    expires_unix_ms: int | None = None
4254
4255    etag: str = ""
4256    """Empty when the resource has no ETag."""
4257
4258    retry_after_unix_ms: int | None = None
4259    """When to retry, for `ResourceResponseStatus.ERROR`."""
4260
4261    def __post_init__(self):
4262        object.__setattr__(self, "bytes", _bytes(self.bytes))
4263
4264    @classmethod
4265    def _from_native(cls, raw):
4266        return cls(
4267            status=ResourceResponseStatus(raw["status"]),
4268            error_reason=ResourceErrorReason(raw["error_reason"]),
4269            bytes=raw["bytes"],
4270            error_message=raw["error_message"],
4271            must_revalidate=raw["must_revalidate"],
4272            modified_unix_ms=raw["modified_unix_ms"],
4273            expires_unix_ms=raw["expires_unix_ms"],
4274            etag=raw["etag"],
4275            retry_after_unix_ms=raw["retry_after_unix_ms"],
4276        )

The answer to a resource request.

See mln_resource_response in the C API reference.

ResourceResponse( status: ResourceResponseStatus = <ResourceResponseStatus.OK: 0>, error_reason: ResourceErrorReason = <ResourceErrorReason.OTHER: 0>, bytes: Buffer = b'', error_message: str = '', must_revalidate: bool = False, modified_unix_ms: int | None = None, expires_unix_ms: int | None = None, etag: str = '', retry_after_unix_ms: int | None = None)
error_reason: ResourceErrorReason

Why the request failed, for ResourceResponseStatus.ERROR.

bytes: Buffer

The resource, for ResourceResponseStatus.OK.

error_message: str

A description of the error, for ResourceResponseStatus.ERROR.

must_revalidate: bool

Whether the library must request the resource again before it reuses this copy.

modified_unix_ms: int | None
expires_unix_ms: int | None
etag: str

Empty when the resource has no ETag.

retry_after_unix_ms: int | None

When to retry, for ResourceResponseStatus.ERROR.

class ResourceResponseStatus(maplibre_native_ffi._enum.UnknownIntEnum):
773class ResourceResponseStatus(UnknownIntEnum):
774    """The outcome of a resource request.
775
776    See `mln_resource_response_status` in the
777    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
778    """
779
780    OK = 0
781    ERROR = 1
782    NO_CONTENT = 2
783    NOT_MODIFIED = 3

The outcome of a resource request.

See mln_resource_response_status in the C API reference.

@dataclass(frozen=True, slots=True)
class ResourceRoute:
4279@dataclass(frozen=True, slots=True)
4280class ResourceRoute:
4281    """The requests that a resource provider serves.
4282
4283    See `mln_resource_route` in the
4284    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4285    """
4286
4287    kinds: ResourceKindFlag = field(default_factory=lambda: ResourceKindFlag(0))
4288    """The kinds of resource that the route covers. Zero covers every kind."""
4289
4290    flags: UrlMatchFlag = field(default_factory=lambda: UrlMatchFlag(0))
4291
4292    url: str = ""
4293
4294    @classmethod
4295    def _from_native(cls, raw):
4296        return cls(
4297            kinds=ResourceKindFlag(raw["kinds"]),
4298            flags=UrlMatchFlag(raw["flags"]),
4299            url=raw["url"],
4300        )

The requests that a resource provider serves.

See mln_resource_route in the C API reference.

ResourceRoute( kinds: ResourceKindFlag = <factory>, flags: UrlMatchFlag = <factory>, url: str = '')

The kinds of resource that the route covers. Zero covers every kind.

flags: UrlMatchFlag
url: str
class ResourceStoragePolicy(maplibre_native_ffi._enum.UnknownIntEnum):
786class ResourceStoragePolicy(UnknownIntEnum):
787    """Whether the library keeps a loaded resource in its cache.
788
789    See `mln_resource_storage_policy` in the
790    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
791    """
792
793    PERMANENT = 0
794    VOLATILE = 1

Whether the library keeps a loaded resource in its cache.

See mln_resource_storage_policy in the C API reference.

@dataclass(frozen=True, slots=True)
class ResourceTransform:
4303@dataclass(frozen=True, slots=True)
4304class ResourceTransform:
4305    """How to rewrite request URLs, for
4306    `RuntimeHandle.set_resource_transform()`.
4307
4308    Set either `callback` or `rules`, not both.
4309
4310    See `mln_resource_transform` in the
4311    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4312    """
4313
4314    callback: ResourceTransformCallback | None = None
4315    rules: Sequence[ResourceTransformRule] = ()
4316    """The first rule that matches a request adds its parameters, and no other.
4317    A request that no rule matches keeps its URL.
4318    """
4319
4320    def __post_init__(self):
4321        object.__setattr__(self, "rules", _sequence(self.rules))
4322
4323    def _invoke_callback(self, kind, url, request):
4324        callback = self.callback
4325        assert callback is not None
4326        request = _adopt_value(request, "ResourceTransformRequestHandle")
4327        try:
4328            return callback(ResourceKind(kind), url, request)
4329        except BaseException:
4330            request.release()
4331            raise

How to rewrite request URLs, for RuntimeHandle.set_resource_transform().

Set either callback or rules, not both.

See mln_resource_transform in the C API reference.

ResourceTransform( callback: ResourceTransformCallback | None = None, rules: Sequence[ResourceTransformRule] = ())
callback: ResourceTransformCallback | None
rules: Sequence[ResourceTransformRule]

The first rule that matches a request adds its parameters, and no other. A request that no rule matches keeps its URL.

class ResourceTransformCallback(typing.Protocol):
5951class ResourceTransformCallback(Protocol):
5952    """Rewrites the URL of a network request before the library sends it.
5953
5954    The request waits until you answer with
5955    `ResourceTransformRequestHandle.complete()` or
5956    `ResourceTransformRequestHandle.fail()`. To keep `url`, complete with it.
5957    Releasing `request` without an answer fails the request. You can answer
5958    now or later, from any thread.
5959
5960    See `mln_resource_transform_callback` in the
5961    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
5962    """
5963
5964    def __call__(
5965        self, kind: ResourceKind, url: str, request: ResourceTransformRequestHandle, /
5966    ) -> None: ...

Rewrites the URL of a network request before the library sends it.

The request waits until you answer with ResourceTransformRequestHandle.complete() or ResourceTransformRequestHandle.fail(). To keep url, complete with it. Releasing request without an answer fails the request. You can answer now or later, from any thread.

See mln_resource_transform_callback in the C API reference.

ResourceTransformCallback(*args, **kwargs)
1903def _no_init_or_replace_init(self, *args, **kwargs):
1904    cls = type(self)
1905
1906    if cls._is_protocol:
1907        raise TypeError('Protocols cannot be instantiated')
1908
1909    # Already using a custom `__init__`. No need to calculate correct
1910    # `__init__` to call. This can lead to RecursionError. See bpo-45121.
1911    if cls.__init__ is not _no_init_or_replace_init:
1912        return
1913
1914    # Initially, `__init__` of a protocol subclass is set to `_no_init_or_replace_init`.
1915    # The first instantiation of the subclass will call `_no_init_or_replace_init` which
1916    # searches for a proper new `__init__` in the MRO. The new `__init__`
1917    # replaces the subclass' old `__init__` (ie `_no_init_or_replace_init`). Subsequent
1918    # instantiation of the protocol subclass will thus use the new
1919    # `__init__` and no longer call `_no_init_or_replace_init`.
1920    for base in cls.__mro__:
1921        init = base.__dict__.get('__init__', _no_init_or_replace_init)
1922        if init is not _no_init_or_replace_init:
1923            cls.__init__ = init
1924            break
1925    else:
1926        # should not happen
1927        cls.__init__ = object.__init__
1928
1929    cls.__init__(self, *args, **kwargs)
@dataclass(frozen=True, slots=True)
class ResourceTransformError:
4334@dataclass(frozen=True, slots=True)
4335class ResourceTransformError:
4336    """Why a resource transform fails a request.
4337
4338    See `mln_resource_transform_error` in the
4339    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4340    """
4341
4342    reason: ResourceErrorReason = ResourceErrorReason.OTHER
4343
4344    message: str = ""
4345
4346    retry_after_unix_ms: int | None = None
4347    """When to retry, for `ResourceErrorReason.RATE_LIMIT`."""
4348
4349    @classmethod
4350    def _from_native(cls, raw):
4351        return cls(
4352            reason=ResourceErrorReason(raw["reason"]),
4353            message=raw["message"],
4354            retry_after_unix_ms=raw["retry_after_unix_ms"],
4355        )

Why a resource transform fails a request.

See mln_resource_transform_error in the C API reference.

ResourceTransformError( reason: ResourceErrorReason = <ResourceErrorReason.OTHER: 0>, message: str = '', retry_after_unix_ms: int | None = None)
message: str
retry_after_unix_ms: int | None

When to retry, for ResourceErrorReason.RATE_LIMIT.

class ResourceTransformRequestHandle(maplibre_native_ffi._generated_operations._ResourceTransformRequestHandleOperations, maplibre_native_ffi._lifecycle.ScopedHandleMixin):

A URL rewrite that a resource transform answers with the URL to load.

See mln_resource_transform_request in the C API reference.

def complete(self, url: str) -> None:
2945    def complete(self, url: str) -> None:
2946        """Answers a resource transform request with the URL to load instead.
2947
2948        `url` must not be empty. A failed answer fails the request with
2949        `ResourceErrorReason.OTHER`, as
2950        `ResourceTransformRequestHandle.release()` does.
2951
2952        See `mln_resource_transform_request_complete` in the
2953        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
2954        """
2955        return _answer(self, lambda: self._native.complete(url))

Answers a resource transform request with the URL to load instead.

url must not be empty. A failed answer fails the request with ResourceErrorReason.OTHER, as ResourceTransformRequestHandle.release() does.

See mln_resource_transform_request_complete in the C API reference.

def fail( self, error: ResourceTransformError) -> None:
2957    def fail(self, error: ResourceTransformError) -> None:
2958        """Fails a resource transform request without sending it.
2959
2960        The library retries a request that failed for a reason it retries,
2961        such as `ResourceErrorReason.CONNECTION`, and the retry calls the
2962        transform again. When this call fails, the request fails with
2963        `ResourceErrorReason.OTHER`, as
2964        `ResourceTransformRequestHandle.release()` does.
2965
2966        See `mln_resource_transform_request_fail` in the
2967        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
2968        """
2969        return _answer(self, lambda: self._native.fail(error))

Fails a resource transform request without sending it.

The library retries a request that failed for a reason it retries, such as ResourceErrorReason.CONNECTION, and the retry calls the transform again. When this call fails, the request fails with ResourceErrorReason.OTHER, as ResourceTransformRequestHandle.release() does.

See mln_resource_transform_request_fail in the C API reference.

def release(self) -> None:
2971    def release(self) -> None:
2972        """Releases a resource transform request.
2973
2974        Releasing a request without an answer fails it with
2975        `ResourceErrorReason.OTHER`.
2976
2977        See `mln_resource_transform_request_release` in the
2978        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
2979        """
2980        return self._native.release()

Releases a resource transform request.

Releasing a request without an answer fails it with ResourceErrorReason.OTHER.

See mln_resource_transform_request_release in the C API reference.

id: int
275    @property
276    def id(self) -> int:
277        """The native handle value. It stays readable after release."""
278        return int(self._native.id)

The native handle value. It stays readable after release.

@dataclass(frozen=True, slots=True)
class ResourceTransformRule:
4358@dataclass(frozen=True, slots=True)
4359class ResourceTransformRule:
4360    """Query parameters to add to the URLs of requests that match a pattern.
4361
4362    The library adds the parameters, in order, at the end of the URL's query
4363    and before any fragment. It keeps the parameters that the URL already
4364    has, even one with the same name.
4365
4366    See `mln_resource_transform_rule` in the
4367    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4368    """
4369
4370    kinds: ResourceKindFlag = field(default_factory=lambda: ResourceKindFlag(0))
4371    """The kinds of resource that the rule covers. Zero covers every kind."""
4372
4373    flags: UrlMatchFlag = field(default_factory=lambda: UrlMatchFlag(0))
4374
4375    url: str = ""
4376
4377    parameters: Sequence[UrlQueryParameter] = ()
4378
4379    def __post_init__(self):
4380        object.__setattr__(self, "parameters", _sequence(self.parameters))
4381
4382    @classmethod
4383    def _from_native(cls, raw):
4384        return cls(
4385            kinds=ResourceKindFlag(raw["kinds"]),
4386            flags=UrlMatchFlag(raw["flags"]),
4387            url=raw["url"],
4388            parameters=tuple(
4389                UrlQueryParameter._from_native(item) for item in raw["parameters"]
4390            ),
4391        )

Query parameters to add to the URLs of requests that match a pattern.

The library adds the parameters, in order, at the end of the URL's query and before any fragment. It keeps the parameters that the URL already has, even one with the same name.

See mln_resource_transform_rule in the C API reference.

ResourceTransformRule( kinds: ResourceKindFlag = <factory>, flags: UrlMatchFlag = <factory>, url: str = '', parameters: Sequence[UrlQueryParameter] = ())

The kinds of resource that the rule covers. Zero covers every kind.

flags: UrlMatchFlag
url: str
parameters: Sequence[UrlQueryParameter]
class ResourceUsage(maplibre_native_ffi._enum.UnknownIntEnum):
797class ResourceUsage(UnknownIntEnum):
798    """Whether a request loads a resource for a map or an offline region.
799
800    See `mln_resource_usage` in the
801    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
802    """
803
804    ONLINE = 0
805    OFFLINE = 1

Whether a request loads a resource for a map or an offline region.

See mln_resource_usage in the C API reference.

ONLINE = <ResourceUsage.ONLINE: 0>
OFFLINE = <ResourceUsage.OFFLINE: 1>
@dataclass(frozen=True, slots=True)
class RuntimeEvent:
4394@dataclass(frozen=True, slots=True)
4395class RuntimeEvent:
4396    """An event that a runtime or one of its maps raised.
4397
4398    See `mln_runtime_event` in the
4399    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4400    """
4401
4402    type: RuntimeEventType
4403
4404    source_type: RuntimeEventSourceType
4405
4406    source: int
4407    """The runtime or map that raised the event, as `source_type` says."""
4408
4409    generation: int
4410    """For a map event, a map snapshot with this generation or a later one
4411    includes what the event reports. Zero for a runtime event.
4412    """
4413
4414    message: str
4415    """The error's text for an event that reports a failure, or empty."""
4416
4417    payload: (
4418        RuntimeEventCameraChangeVariant
4419        | RuntimeEventLoadingFailedVariant
4420        | RuntimeEventRenderFrameVariant
4421        | RuntimeEventStyleImageVariant
4422        | RuntimeEventTileActionVariant
4423        | RuntimeEventSourceChangedVariant
4424        | RuntimeEventOfflineRegionStatusVariant
4425        | RuntimeEventOfflineRegionResponseErrorVariant
4426        | RuntimeEventOfflineRegionTileCountLimitVariant
4427        | RuntimeEventGlyphsVariant
4428        | RuntimeEventSpriteVariant
4429        | UnknownVariant
4430        | None
4431    )
4432
4433    @classmethod
4434    def _from_native(cls, raw):
4435        return cls(
4436            type=RuntimeEventType(raw["type"]),
4437            source_type=RuntimeEventSourceType(raw["source_type"]),
4438            source=raw["source"],
4439            generation=raw["generation"],
4440            message=raw["message"],
4441            payload=_copy_variant(
4442                raw["payload"],
4443                {
4444                    "camera_change": RuntimeEventCameraChangeVariant,
4445                    "loading_failed": RuntimeEventLoadingFailedVariant,
4446                    "render_frame": RuntimeEventRenderFrameVariant,
4447                    "style_image": RuntimeEventStyleImageVariant,
4448                    "tile_action": RuntimeEventTileActionVariant,
4449                    "source_changed": RuntimeEventSourceChangedVariant,
4450                    "offline_region_status": RuntimeEventOfflineRegionStatusVariant,
4451                    "offline_region_response_error": RuntimeEventOfflineRegionResponseErrorVariant,
4452                    "offline_region_tile_count_limit": RuntimeEventOfflineRegionTileCountLimitVariant,
4453                    "glyphs": RuntimeEventGlyphsVariant,
4454                    "sprite": RuntimeEventSpriteVariant,
4455                },
4456                0,
4457            ),
4458        )

An event that a runtime or one of its maps raised.

See mln_runtime_event in the C API reference.

source_type: RuntimeEventSourceType
source: int

The runtime or map that raised the event, as source_type says.

generation: int

For a map event, a map snapshot with this generation or a later one includes what the event reports. Zero for a runtime event.

message: str

The error's text for an event that reports a failure, or empty.

class RuntimeEventCallback(typing.Protocol):
5969class RuntimeEventCallback(Protocol):
5970    """Receives a batch of events.
5971
5972    See `mln_runtime_event_callback` in the
5973    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
5974    """
5975
5976    def __call__(self, events: tuple[RuntimeEvent, ...], /) -> None: ...

Receives a batch of events.

See mln_runtime_event_callback in the C API reference.

RuntimeEventCallback(*args, **kwargs)
1903def _no_init_or_replace_init(self, *args, **kwargs):
1904    cls = type(self)
1905
1906    if cls._is_protocol:
1907        raise TypeError('Protocols cannot be instantiated')
1908
1909    # Already using a custom `__init__`. No need to calculate correct
1910    # `__init__` to call. This can lead to RecursionError. See bpo-45121.
1911    if cls.__init__ is not _no_init_or_replace_init:
1912        return
1913
1914    # Initially, `__init__` of a protocol subclass is set to `_no_init_or_replace_init`.
1915    # The first instantiation of the subclass will call `_no_init_or_replace_init` which
1916    # searches for a proper new `__init__` in the MRO. The new `__init__`
1917    # replaces the subclass' old `__init__` (ie `_no_init_or_replace_init`). Subsequent
1918    # instantiation of the protocol subclass will thus use the new
1919    # `__init__` and no longer call `_no_init_or_replace_init`.
1920    for base in cls.__mro__:
1921        init = base.__dict__.get('__init__', _no_init_or_replace_init)
1922        if init is not _no_init_or_replace_init:
1923            cls.__init__ = init
1924            break
1925    else:
1926        # should not happen
1927        cls.__init__ = object.__init__
1928
1929    cls.__init__(self, *args, **kwargs)
@dataclass(frozen=True, slots=True)
class RuntimeEventCameraChange:
4461@dataclass(frozen=True, slots=True)
4462class RuntimeEventCameraChange:
4463    """The details of `RuntimeEventType.MAP_CAMERA_WILL_CHANGE` and
4464    `RuntimeEventType.MAP_CAMERA_DID_CHANGE`.
4465
4466    See `mln_runtime_event_camera_change` in the
4467    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4468    """
4469
4470    mode: CameraChangeMode
4471
4472    source: CameraChangeSource
4473
4474    @classmethod
4475    def _from_native(cls, raw):
4476        return cls(
4477            mode=CameraChangeMode(raw["mode"]), source=CameraChangeSource(raw["source"])
4478        )

The details of RuntimeEventType.MAP_CAMERA_WILL_CHANGE and RuntimeEventType.MAP_CAMERA_DID_CHANGE.

See mln_runtime_event_camera_change in the C API reference.

RuntimeEventCameraChange( mode: CameraChangeMode, source: CameraChangeSource)
@dataclass(frozen=True, slots=True)
class RuntimeEventCameraChangeVariant:
177@dataclass(frozen=True, slots=True)
178class RuntimeEventCameraChangeVariant:
179    value: RuntimeEventCameraChange
180    _tag = 1
181
182    @classmethod
183    def _from_native(cls, raw):
184        return cls(RuntimeEventCameraChange._from_native(raw))
RuntimeEventCameraChangeVariant( value: RuntimeEventCameraChange)
class RuntimeEventFlag(enum.IntFlag):
808class RuntimeEventFlag(IntFlag):
809    """An event type, as a bit in a set.
810
811    See `mln_runtime_event_flag` in the
812    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
813    """
814
815    NONE = 0
816    MAP_CAMERA_WILL_CHANGE = 2
817    MAP_CAMERA_IS_CHANGING = 4
818    MAP_CAMERA_DID_CHANGE = 8
819    MAP_STYLE_LOADED = 16
820    MAP_LOADING_STARTED = 32
821    MAP_LOADING_FINISHED = 64
822    MAP_LOADING_FAILED = 128
823    MAP_IDLE = 256
824    MAP_RENDER_ERROR = 512
825    MAP_RENDER_FRAME_STARTED = 1024
826    MAP_RENDER_FRAME_FINISHED = 2048
827    MAP_RENDER_MAP_STARTED = 4096
828    MAP_RENDER_MAP_FINISHED = 8192
829    MAP_STYLE_IMAGE_MISSING = 16384
830    MAP_TILE_ACTION = 32768
831    MAP_SOURCE_CHANGED = 65536
832    OFFLINE_REGION_STATUS_CHANGED = 131072
833    OFFLINE_REGION_RESPONSE_ERROR = 262144
834    OFFLINE_REGION_TILE_COUNT_LIMIT_EXCEEDED = 524288
835    MAP_GLYPHS_REQUESTED = 1048576
836    MAP_GLYPHS_LOADED = 2097152
837    MAP_GLYPHS_ERROR = 4194304
838    MAP_SPRITE_REQUESTED = 8388608
839    MAP_SPRITE_LOADED = 16777216
840    MAP_SPRITE_ERROR = 33554432
841    ALL_MAP_EVENTS = 66191358
842    ALL_RUNTIME_EVENTS = 917504
843    ALL = 67108862

An event type, as a bit in a set.

See mln_runtime_event_flag in the C API reference.

NONE = <RuntimeEventFlag.NONE: 0>
MAP_CAMERA_WILL_CHANGE = <RuntimeEventFlag.MAP_CAMERA_WILL_CHANGE: 2>
MAP_CAMERA_IS_CHANGING = <RuntimeEventFlag.MAP_CAMERA_IS_CHANGING: 4>
MAP_CAMERA_DID_CHANGE = <RuntimeEventFlag.MAP_CAMERA_DID_CHANGE: 8>
MAP_STYLE_LOADED = <RuntimeEventFlag.MAP_STYLE_LOADED: 16>
MAP_LOADING_STARTED = <RuntimeEventFlag.MAP_LOADING_STARTED: 32>
MAP_LOADING_FINISHED = <RuntimeEventFlag.MAP_LOADING_FINISHED: 64>
MAP_LOADING_FAILED = <RuntimeEventFlag.MAP_LOADING_FAILED: 128>
MAP_IDLE = <RuntimeEventFlag.MAP_IDLE: 256>
MAP_RENDER_ERROR = <RuntimeEventFlag.MAP_RENDER_ERROR: 512>
MAP_RENDER_FRAME_STARTED = <RuntimeEventFlag.MAP_RENDER_FRAME_STARTED: 1024>
MAP_RENDER_FRAME_FINISHED = <RuntimeEventFlag.MAP_RENDER_FRAME_FINISHED: 2048>
MAP_RENDER_MAP_STARTED = <RuntimeEventFlag.MAP_RENDER_MAP_STARTED: 4096>
MAP_RENDER_MAP_FINISHED = <RuntimeEventFlag.MAP_RENDER_MAP_FINISHED: 8192>
MAP_STYLE_IMAGE_MISSING = <RuntimeEventFlag.MAP_STYLE_IMAGE_MISSING: 16384>
MAP_TILE_ACTION = <RuntimeEventFlag.MAP_TILE_ACTION: 32768>
MAP_SOURCE_CHANGED = <RuntimeEventFlag.MAP_SOURCE_CHANGED: 65536>
OFFLINE_REGION_STATUS_CHANGED = <RuntimeEventFlag.OFFLINE_REGION_STATUS_CHANGED: 131072>
OFFLINE_REGION_RESPONSE_ERROR = <RuntimeEventFlag.OFFLINE_REGION_RESPONSE_ERROR: 262144>
OFFLINE_REGION_TILE_COUNT_LIMIT_EXCEEDED = <RuntimeEventFlag.OFFLINE_REGION_TILE_COUNT_LIMIT_EXCEEDED: 524288>
MAP_GLYPHS_REQUESTED = <RuntimeEventFlag.MAP_GLYPHS_REQUESTED: 1048576>
MAP_GLYPHS_LOADED = <RuntimeEventFlag.MAP_GLYPHS_LOADED: 2097152>
MAP_GLYPHS_ERROR = <RuntimeEventFlag.MAP_GLYPHS_ERROR: 4194304>
MAP_SPRITE_REQUESTED = <RuntimeEventFlag.MAP_SPRITE_REQUESTED: 8388608>
MAP_SPRITE_LOADED = <RuntimeEventFlag.MAP_SPRITE_LOADED: 16777216>
MAP_SPRITE_ERROR = <RuntimeEventFlag.MAP_SPRITE_ERROR: 33554432>
ALL_MAP_EVENTS = <RuntimeEventFlag.ALL_MAP_EVENTS: 66191358>
ALL_RUNTIME_EVENTS = <RuntimeEventFlag.ALL_RUNTIME_EVENTS: 917504>
ALL = <RuntimeEventFlag.ALL: 67108862>
@dataclass(frozen=True, slots=True)
class RuntimeEventGlyphs:
4481@dataclass(frozen=True, slots=True)
4482class RuntimeEventGlyphs:
4483    """The details of a glyph event.
4484
4485    The event covers the glyphs from `first` to `last`, both included.
4486
4487    See `mln_runtime_event_glyphs` in the
4488    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4489    """
4490
4491    font_stack: tuple[str, ...]
4492    """The fonts that the glyphs come from, in order of preference."""
4493
4494    first: int
4495
4496    last: int
4497
4498    font_face: bool
4499
4500    @classmethod
4501    def _from_native(cls, raw):
4502        return cls(
4503            font_stack=tuple(item for item in raw["font_stack"]),
4504            first=raw["first"],
4505            last=raw["last"],
4506            font_face=raw["font_face"],
4507        )

The details of a glyph event.

The event covers the glyphs from first to last, both included.

See mln_runtime_event_glyphs in the C API reference.

RuntimeEventGlyphs(font_stack: tuple[str, ...], first: int, last: int, font_face: bool)
font_stack: tuple[str, ...]

The fonts that the glyphs come from, in order of preference.

first: int
last: int
font_face: bool
@dataclass(frozen=True, slots=True)
class RuntimeEventGlyphsVariant:
267@dataclass(frozen=True, slots=True)
268class RuntimeEventGlyphsVariant:
269    value: RuntimeEventGlyphs
270    _tag = 10
271
272    @classmethod
273    def _from_native(cls, raw):
274        return cls(RuntimeEventGlyphs._from_native(raw))
RuntimeEventGlyphsVariant(value: RuntimeEventGlyphs)
@dataclass(frozen=True, slots=True)
class RuntimeEventHandler:
4510@dataclass(frozen=True, slots=True)
4511class RuntimeEventHandler:
4512    """An event callback, for `RuntimeHandle.set_event_handler()`.
4513
4514    See `mln_runtime_event_handler` in the
4515    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4516    """
4517
4518    callback: RuntimeEventCallback
4519
4520    def _invoke_callback(self, events):
4521        callback = self.callback
4522        return callback(tuple(RuntimeEvent._from_native(item) for item in events))

An event callback, for RuntimeHandle.set_event_handler().

See mln_runtime_event_handler in the C API reference.

RuntimeEventHandler(callback: RuntimeEventCallback)
@dataclass(frozen=True, slots=True)
class RuntimeEventLoadingFailed:
4525@dataclass(frozen=True, slots=True)
4526class RuntimeEventLoadingFailed:
4527    """The details of `RuntimeEventType.MAP_LOADING_FAILED`.
4528
4529    See `mln_runtime_event_loading_failed` in the
4530    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4531    """
4532
4533    error: MapLoadError
4534
4535    @classmethod
4536    def _from_native(cls, raw):
4537        return cls(error=MapLoadError(raw["error"]))

The details of RuntimeEventType.MAP_LOADING_FAILED.

See mln_runtime_event_loading_failed in the C API reference.

RuntimeEventLoadingFailed(error: MapLoadError)
error: MapLoadError
@dataclass(frozen=True, slots=True)
class RuntimeEventLoadingFailedVariant:
187@dataclass(frozen=True, slots=True)
188class RuntimeEventLoadingFailedVariant:
189    value: RuntimeEventLoadingFailed
190    _tag = 2
191
192    @classmethod
193    def _from_native(cls, raw):
194        return cls(RuntimeEventLoadingFailed._from_native(raw))
RuntimeEventLoadingFailedVariant( value: RuntimeEventLoadingFailed)
@dataclass(frozen=True, slots=True)
class RuntimeEventOfflineRegionResponseError:
4540@dataclass(frozen=True, slots=True)
4541class RuntimeEventOfflineRegionResponseError:
4542    """The details of `RuntimeEventType.OFFLINE_REGION_RESPONSE_ERROR`.
4543
4544    See `mln_runtime_event_offline_region_response_error` in the
4545    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4546    """
4547
4548    region_id: int
4549
4550    reason: ResourceErrorReason
4551
4552    @classmethod
4553    def _from_native(cls, raw):
4554        return cls(
4555            region_id=raw["region_id"], reason=ResourceErrorReason(raw["reason"])
4556        )

The details of RuntimeEventType.OFFLINE_REGION_RESPONSE_ERROR.

See mln_runtime_event_offline_region_response_error in the C API reference.

RuntimeEventOfflineRegionResponseError( region_id: int, reason: ResourceErrorReason)
region_id: int
@dataclass(frozen=True, slots=True)
class RuntimeEventOfflineRegionResponseErrorVariant:
247@dataclass(frozen=True, slots=True)
248class RuntimeEventOfflineRegionResponseErrorVariant:
249    value: RuntimeEventOfflineRegionResponseError
250    _tag = 8
251
252    @classmethod
253    def _from_native(cls, raw):
254        return cls(RuntimeEventOfflineRegionResponseError._from_native(raw))
RuntimeEventOfflineRegionResponseErrorVariant( value: RuntimeEventOfflineRegionResponseError)
@dataclass(frozen=True, slots=True)
class RuntimeEventOfflineRegionStatus:
4559@dataclass(frozen=True, slots=True)
4560class RuntimeEventOfflineRegionStatus:
4561    """The details of `RuntimeEventType.OFFLINE_REGION_STATUS_CHANGED`.
4562
4563    See `mln_runtime_event_offline_region_status` in the
4564    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4565    """
4566
4567    region_id: int
4568
4569    status: OfflineRegionStatus
4570
4571    @classmethod
4572    def _from_native(cls, raw):
4573        return cls(
4574            region_id=raw["region_id"],
4575            status=OfflineRegionStatus._from_native(raw["status"]),
4576        )

The details of RuntimeEventType.OFFLINE_REGION_STATUS_CHANGED.

See mln_runtime_event_offline_region_status in the C API reference.

RuntimeEventOfflineRegionStatus( region_id: int, status: OfflineRegionStatus)
region_id: int
@dataclass(frozen=True, slots=True)
class RuntimeEventOfflineRegionStatusVariant:
237@dataclass(frozen=True, slots=True)
238class RuntimeEventOfflineRegionStatusVariant:
239    value: RuntimeEventOfflineRegionStatus
240    _tag = 7
241
242    @classmethod
243    def _from_native(cls, raw):
244        return cls(RuntimeEventOfflineRegionStatus._from_native(raw))
RuntimeEventOfflineRegionStatusVariant( value: RuntimeEventOfflineRegionStatus)
@dataclass(frozen=True, slots=True)
class RuntimeEventOfflineRegionTileCountLimit:
4579@dataclass(frozen=True, slots=True)
4580class RuntimeEventOfflineRegionTileCountLimit:
4581    """The details of
4582    `RuntimeEventType.OFFLINE_REGION_TILE_COUNT_LIMIT_EXCEEDED`.
4583
4584    See `mln_runtime_event_offline_region_tile_count_limit` in the
4585    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4586    """
4587
4588    region_id: int
4589
4590    limit: int
4591    """The number of demo server tiles that the cache file's offline regions may
4592    hold together.
4593    """
4594
4595    @classmethod
4596    def _from_native(cls, raw):
4597        return cls(region_id=raw["region_id"], limit=raw["limit"])

The details of RuntimeEventType.OFFLINE_REGION_TILE_COUNT_LIMIT_EXCEEDED.

See mln_runtime_event_offline_region_tile_count_limit in the C API reference.

RuntimeEventOfflineRegionTileCountLimit(region_id: int, limit: int)
region_id: int
limit: int

The number of demo server tiles that the cache file's offline regions may hold together.

@dataclass(frozen=True, slots=True)
class RuntimeEventOfflineRegionTileCountLimitVariant:
257@dataclass(frozen=True, slots=True)
258class RuntimeEventOfflineRegionTileCountLimitVariant:
259    value: RuntimeEventOfflineRegionTileCountLimit
260    _tag = 9
261
262    @classmethod
263    def _from_native(cls, raw):
264        return cls(RuntimeEventOfflineRegionTileCountLimit._from_native(raw))
RuntimeEventOfflineRegionTileCountLimitVariant( value: RuntimeEventOfflineRegionTileCountLimit)
@dataclass(frozen=True, slots=True)
class RuntimeEventRenderFrame:
4600@dataclass(frozen=True, slots=True)
4601class RuntimeEventRenderFrame:
4602    """The details of `RuntimeEventType.MAP_RENDER_FRAME_FINISHED`.
4603
4604    See `mln_runtime_event_render_frame` in the
4605    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4606    """
4607
4608    mode: RenderMode
4609
4610    needs_repaint: bool
4611
4612    placement_changed: bool
4613
4614    stats: RenderingStats
4615
4616    @classmethod
4617    def _from_native(cls, raw):
4618        return cls(
4619            mode=RenderMode(raw["mode"]),
4620            needs_repaint=raw["needs_repaint"],
4621            placement_changed=raw["placement_changed"],
4622            stats=RenderingStats._from_native(raw["stats"]),
4623        )

The details of RuntimeEventType.MAP_RENDER_FRAME_FINISHED.

See mln_runtime_event_render_frame in the C API reference.

RuntimeEventRenderFrame( mode: RenderMode, needs_repaint: bool, placement_changed: bool, stats: RenderingStats)
mode: RenderMode
needs_repaint: bool
placement_changed: bool
@dataclass(frozen=True, slots=True)
class RuntimeEventRenderFrameVariant:
197@dataclass(frozen=True, slots=True)
198class RuntimeEventRenderFrameVariant:
199    value: RuntimeEventRenderFrame
200    _tag = 3
201
202    @classmethod
203    def _from_native(cls, raw):
204        return cls(RuntimeEventRenderFrame._from_native(raw))
RuntimeEventRenderFrameVariant(value: RuntimeEventRenderFrame)
@dataclass(frozen=True, slots=True)
class RuntimeEventSourceChanged:
4626@dataclass(frozen=True, slots=True)
4627class RuntimeEventSourceChanged:
4628    """The details of `RuntimeEventType.MAP_SOURCE_CHANGED`.
4629
4630    See `mln_runtime_event_source_changed` in the
4631    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4632    """
4633
4634    source_id: str
4635
4636    @classmethod
4637    def _from_native(cls, raw):
4638        return cls(source_id=raw["source_id"])

The details of RuntimeEventType.MAP_SOURCE_CHANGED.

See mln_runtime_event_source_changed in the C API reference.

RuntimeEventSourceChanged(source_id: str)
source_id: str
@dataclass(frozen=True, slots=True)
class RuntimeEventSourceChangedVariant:
227@dataclass(frozen=True, slots=True)
228class RuntimeEventSourceChangedVariant:
229    value: RuntimeEventSourceChanged
230    _tag = 6
231
232    @classmethod
233    def _from_native(cls, raw):
234        return cls(RuntimeEventSourceChanged._from_native(raw))
RuntimeEventSourceChangedVariant( value: RuntimeEventSourceChanged)
class RuntimeEventSourceType(maplibre_native_ffi._enum.UnknownIntEnum):
846class RuntimeEventSourceType(UnknownIntEnum):
847    """The kind of handle that raised an event.
848
849    See `mln_runtime_event_source_type` in the
850    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
851    """
852
853    RUNTIME = 0
854    MAP = 1

The kind of handle that raised an event.

See mln_runtime_event_source_type in the C API reference.

@dataclass(frozen=True, slots=True)
class RuntimeEventSprite:
4641@dataclass(frozen=True, slots=True)
4642class RuntimeEventSprite:
4643    """The details of a sprite event.
4644
4645    `id` and `url` are both empty when the style has no sprite.
4646
4647    See `mln_runtime_event_sprite` in the
4648    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4649    """
4650
4651    id: str
4652
4653    url: str
4654
4655    @classmethod
4656    def _from_native(cls, raw):
4657        return cls(id=raw["id"], url=raw["url"])

The details of a sprite event.

id and url are both empty when the style has no sprite.

See mln_runtime_event_sprite in the C API reference.

RuntimeEventSprite(id: str, url: str)
id: str
url: str
@dataclass(frozen=True, slots=True)
class RuntimeEventSpriteVariant:
277@dataclass(frozen=True, slots=True)
278class RuntimeEventSpriteVariant:
279    value: RuntimeEventSprite
280    _tag = 11
281
282    @classmethod
283    def _from_native(cls, raw):
284        return cls(RuntimeEventSprite._from_native(raw))
RuntimeEventSpriteVariant(value: RuntimeEventSprite)
@dataclass(frozen=True, slots=True)
class RuntimeEventStyleImage:
4660@dataclass(frozen=True, slots=True)
4661class RuntimeEventStyleImage:
4662    """The details of `RuntimeEventType.MAP_STYLE_IMAGE_MISSING`.
4663
4664    See `mln_runtime_event_style_image` in the
4665    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4666    """
4667
4668    image_id: str
4669
4670    @classmethod
4671    def _from_native(cls, raw):
4672        return cls(image_id=raw["image_id"])

The details of RuntimeEventType.MAP_STYLE_IMAGE_MISSING.

See mln_runtime_event_style_image in the C API reference.

RuntimeEventStyleImage(image_id: str)
image_id: str
@dataclass(frozen=True, slots=True)
class RuntimeEventStyleImageVariant:
207@dataclass(frozen=True, slots=True)
208class RuntimeEventStyleImageVariant:
209    value: RuntimeEventStyleImage
210    _tag = 4
211
212    @classmethod
213    def _from_native(cls, raw):
214        return cls(RuntimeEventStyleImage._from_native(raw))
RuntimeEventStyleImageVariant(value: RuntimeEventStyleImage)
@dataclass(frozen=True, slots=True)
class RuntimeEventTileAction:
4675@dataclass(frozen=True, slots=True)
4676class RuntimeEventTileAction:
4677    """The details of `RuntimeEventType.MAP_TILE_ACTION`.
4678
4679    See `mln_runtime_event_tile_action` in the
4680    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4681    """
4682
4683    source_id: str
4684    """The source that the tile belongs to."""
4685
4686    operation: TileOperation
4687
4688    tile_id: TileId
4689
4690    @classmethod
4691    def _from_native(cls, raw):
4692        return cls(
4693            source_id=raw["source_id"],
4694            operation=TileOperation(raw["operation"]),
4695            tile_id=TileId._from_native(raw["tile_id"]),
4696        )

The details of RuntimeEventType.MAP_TILE_ACTION.

See mln_runtime_event_tile_action in the C API reference.

RuntimeEventTileAction( source_id: str, operation: TileOperation, tile_id: TileId)
source_id: str

The source that the tile belongs to.

operation: TileOperation
tile_id: TileId
@dataclass(frozen=True, slots=True)
class RuntimeEventTileActionVariant:
217@dataclass(frozen=True, slots=True)
218class RuntimeEventTileActionVariant:
219    value: RuntimeEventTileAction
220    _tag = 5
221
222    @classmethod
223    def _from_native(cls, raw):
224        return cls(RuntimeEventTileAction._from_native(raw))
RuntimeEventTileActionVariant(value: RuntimeEventTileAction)
class RuntimeEventType(maplibre_native_ffi._enum.UnknownIntEnum):
857class RuntimeEventType(UnknownIntEnum):
858    """The kind of an event.
859
860    Only maps in `MapMode.CONTINUOUS` raise
861    `RuntimeEventType.MAP_LOADING_FINISHED`, `RuntimeEventType.MAP_IDLE`, and
862    the render frame and render map events. Offline region events come only
863    for the regions and types that
864    `RuntimeHandle.set_offline_region_observed()` selects.
865
866    See `mln_runtime_event_type` in the
867    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
868    """
869
870    MAP_CAMERA_WILL_CHANGE = 1
871    MAP_CAMERA_IS_CHANGING = 2
872    MAP_CAMERA_DID_CHANGE = 3
873    MAP_STYLE_LOADED = 4
874    MAP_LOADING_STARTED = 5
875    MAP_LOADING_FINISHED = 6
876    MAP_LOADING_FAILED = 7
877    MAP_IDLE = 8
878    MAP_RENDER_ERROR = 9
879    MAP_RENDER_FRAME_STARTED = 10
880    MAP_RENDER_FRAME_FINISHED = 11
881    MAP_RENDER_MAP_STARTED = 12
882    MAP_RENDER_MAP_FINISHED = 13
883    MAP_STYLE_IMAGE_MISSING = 14
884    MAP_TILE_ACTION = 15
885    MAP_SOURCE_CHANGED = 16
886    OFFLINE_REGION_STATUS_CHANGED = 17
887    OFFLINE_REGION_RESPONSE_ERROR = 18
888    OFFLINE_REGION_TILE_COUNT_LIMIT_EXCEEDED = 19
889    MAP_GLYPHS_REQUESTED = 20
890    MAP_GLYPHS_LOADED = 21
891    MAP_GLYPHS_ERROR = 22
892    MAP_SPRITE_REQUESTED = 23
893    MAP_SPRITE_LOADED = 24
894    MAP_SPRITE_ERROR = 25

The kind of an event.

Only maps in MapMode.CONTINUOUS raise RuntimeEventType.MAP_LOADING_FINISHED, RuntimeEventType.MAP_IDLE, and the render frame and render map events. Offline region events come only for the regions and types that RuntimeHandle.set_offline_region_observed() selects.

See mln_runtime_event_type in the C API reference.

MAP_CAMERA_WILL_CHANGE = <RuntimeEventType.MAP_CAMERA_WILL_CHANGE: 1>
MAP_CAMERA_IS_CHANGING = <RuntimeEventType.MAP_CAMERA_IS_CHANGING: 2>
MAP_CAMERA_DID_CHANGE = <RuntimeEventType.MAP_CAMERA_DID_CHANGE: 3>
MAP_STYLE_LOADED = <RuntimeEventType.MAP_STYLE_LOADED: 4>
MAP_LOADING_STARTED = <RuntimeEventType.MAP_LOADING_STARTED: 5>
MAP_LOADING_FINISHED = <RuntimeEventType.MAP_LOADING_FINISHED: 6>
MAP_LOADING_FAILED = <RuntimeEventType.MAP_LOADING_FAILED: 7>
MAP_IDLE = <RuntimeEventType.MAP_IDLE: 8>
MAP_RENDER_ERROR = <RuntimeEventType.MAP_RENDER_ERROR: 9>
MAP_RENDER_FRAME_STARTED = <RuntimeEventType.MAP_RENDER_FRAME_STARTED: 10>
MAP_RENDER_FRAME_FINISHED = <RuntimeEventType.MAP_RENDER_FRAME_FINISHED: 11>
MAP_RENDER_MAP_STARTED = <RuntimeEventType.MAP_RENDER_MAP_STARTED: 12>
MAP_RENDER_MAP_FINISHED = <RuntimeEventType.MAP_RENDER_MAP_FINISHED: 13>
MAP_STYLE_IMAGE_MISSING = <RuntimeEventType.MAP_STYLE_IMAGE_MISSING: 14>
MAP_TILE_ACTION = <RuntimeEventType.MAP_TILE_ACTION: 15>
MAP_SOURCE_CHANGED = <RuntimeEventType.MAP_SOURCE_CHANGED: 16>
OFFLINE_REGION_STATUS_CHANGED = <RuntimeEventType.OFFLINE_REGION_STATUS_CHANGED: 17>
OFFLINE_REGION_RESPONSE_ERROR = <RuntimeEventType.OFFLINE_REGION_RESPONSE_ERROR: 18>
OFFLINE_REGION_TILE_COUNT_LIMIT_EXCEEDED = <RuntimeEventType.OFFLINE_REGION_TILE_COUNT_LIMIT_EXCEEDED: 19>
MAP_GLYPHS_REQUESTED = <RuntimeEventType.MAP_GLYPHS_REQUESTED: 20>
MAP_GLYPHS_LOADED = <RuntimeEventType.MAP_GLYPHS_LOADED: 21>
MAP_GLYPHS_ERROR = <RuntimeEventType.MAP_GLYPHS_ERROR: 22>
MAP_SPRITE_REQUESTED = <RuntimeEventType.MAP_SPRITE_REQUESTED: 23>
MAP_SPRITE_LOADED = <RuntimeEventType.MAP_SPRITE_LOADED: 24>
MAP_SPRITE_ERROR = <RuntimeEventType.MAP_SPRITE_ERROR: 25>
class RuntimeHandle(maplibre_native_ffi._generated_operations._RuntimeHandleOperations, maplibre_native_ffi._lifecycle.ScopedHandleMixin):

A runtime owns maps and the network and cache settings that they share.

See mln_runtime in the C API reference.

def clear_event_handler( self) -> concurrent.futures._base.Future[CommandCompletion]:
2986    def clear_event_handler(self) -> Future[CommandCompletion]:
2987        """Stops sending the events of the runtime and its maps to a callback.
2988
2989        See `mln_runtime_clear_event_handler` in the
2990        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
2991        """
2992        return self._native.clear_event_handler()

Stops sending the events of the runtime and its maps to a callback.

See mln_runtime_clear_event_handler in the C API reference.

def clear_http_header_transform( self) -> concurrent.futures._base.Future[CommandCompletion]:
2994    def clear_http_header_transform(self) -> Future[CommandCompletion]:
2995        """Stops adding headers to the runtime's HTTP requests.
2996
2997        See `mln_runtime_clear_http_header_transform` in the
2998        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
2999        """
3000        return self._native.clear_http_header_transform()

Stops adding headers to the runtime's HTTP requests.

See mln_runtime_clear_http_header_transform in the C API reference.

def clear_resource_provider( self) -> concurrent.futures._base.Future[CommandCompletion]:
3002    def clear_resource_provider(self) -> Future[CommandCompletion]:
3003        """Removes the runtime's resource provider, so the library loads every
3004        request itself.
3005
3006        See `mln_runtime_clear_resource_provider` in the
3007        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
3008        """
3009        return self._native.clear_resource_provider()

Removes the runtime's resource provider, so the library loads every request itself.

See mln_runtime_clear_resource_provider in the C API reference.

def clear_resource_transform( self) -> concurrent.futures._base.Future[CommandCompletion]:
3011    def clear_resource_transform(self) -> Future[CommandCompletion]:
3012        """Stops rewriting the URLs of the runtime's network requests.
3013
3014        See `mln_runtime_clear_resource_transform` in the
3015        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
3016        """
3017        return self._native.clear_resource_transform()

Stops rewriting the URLs of the runtime's network requests.

See mln_runtime_clear_resource_transform in the C API reference.

@classmethod
def create( cls, options: RuntimeOptions | None = None) -> RuntimeHandle:
3019    @classmethod
3020    def create(cls, options: RuntimeOptions | None = None) -> RuntimeHandle:
3021        """Creates a runtime.
3022
3023        A runtime holds maps and the resource loading, cache, and offline
3024        regions that they share. In a browser, create runtimes on a Web
3025        Worker, not on the main thread.
3026
3027        See `mln_runtime_create` in the
3028        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
3029
3030        Errors:
3031
3032        - `Status.INVALID_ARGUMENT` when the cache database file that
3033          `options` names can't be opened or created.
3034        """
3035        return _adopt_value(
3036            _native._RuntimeHandle.create(options), "RuntimeHandle", None
3037        )

Creates a runtime.

A runtime holds maps and the resource loading, cache, and offline regions that they share. In a browser, create runtimes on a Web Worker, not on the main thread.

See mln_runtime_create in the C API reference.

Errors:

def create_map( self, options: MapOptions) -> MapHandle:
3039    def create_map(self, options: MapOptions) -> MapHandle:
3040        """Creates a map on `runtime`.
3041
3042        Asynchronous calls on the map before the completion runs wait for it,
3043        and complete with `Status.INVALID_STATE` when creation fails.
3044
3045        See `mln_runtime_create_map` in the
3046        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3047        """
3048        raw = self._native.create_map(options)
3049        return _adopt_value(raw["map"], "MapHandle", self, raw["ready"])

Creates a map on runtime.

Asynchronous calls on the map before the completion runs wait for it, and complete with Status.INVALID_STATE when creation fails.

See mln_runtime_create_map in the C API reference.

def create_offline_region( self, definition: OfflineRegionDefinition, metadata: Buffer) -> concurrent.futures._base.Future[OfflineRegionInfo]:
3051    def create_offline_region(
3052        self, definition: OfflineRegionDefinition, metadata: Buffer
3053    ) -> Future[OfflineRegionInfo]:
3054        """Creates an offline region in the runtime's cache file.
3055
3056        `metadata` holds any bytes to store with the region, such as its
3057        name. The region doesn't download until
3058        `RuntimeHandle.set_offline_region_download_state()` makes its
3059        download active.
3060
3061        See `mln_runtime_create_offline_region` in the
3062        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3063        """
3064        return map_future(
3065            self._native.create_offline_region(definition, metadata),
3066            lambda value: OfflineRegionInfo._from_native(value),
3067        )

Creates an offline region in the runtime's cache file.

metadata holds any bytes to store with the region, such as its name. The region doesn't download until RuntimeHandle.set_offline_region_download_state() makes its download active.

See mln_runtime_create_offline_region in the C API reference.

def delete_offline_region(self, region_id: int) -> concurrent.futures._base.Future[None]:
3069    def delete_offline_region(self, region_id: int) -> Future[None]:
3070        """Deletes the offline region `region_id` from the runtime's cache file.
3071
3072        See `mln_runtime_delete_offline_region` in the
3073        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3074
3075        Errors:
3076
3077        - `Status.NOT_FOUND` when the cache file has no region `region_id`.
3078        """
3079        return self._native.delete_offline_region(region_id)

Deletes the offline region region_id from the runtime's cache file.

See mln_runtime_delete_offline_region in the C API reference.

Errors:

def get_offline_region( self, region_id: int) -> concurrent.futures._base.Future[OfflineRegionInfo | None]:
3081    def get_offline_region(self, region_id: int) -> Future[OfflineRegionInfo | None]:
3082        """Reads the offline region `region_id`.
3083
3084        The result is null when the cache file has no region with that ID.
3085
3086        See `mln_runtime_get_offline_region` in the
3087        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3088        """
3089        return map_future(
3090            self._native.get_offline_region(region_id),
3091            lambda value: _maybe(OfflineRegionInfo._from_native, value),
3092        )

Reads the offline region region_id.

The result is null when the cache file has no region with that ID.

See mln_runtime_get_offline_region in the C API reference.

def get_offline_region_status( self, region_id: int) -> concurrent.futures._base.Future[OfflineRegionStatus]:
3094    def get_offline_region_status(self, region_id: int) -> Future[OfflineRegionStatus]:
3095        """Reads the download progress of the offline region `region_id`.
3096
3097        While the download is active, the counts cover what it has visited.
3098        Once it's inactive, they cover every resource the region holds,
3099        including those that only earlier versions of its style listed, so
3100        the completed counts can exceed the required counts.
3101
3102        See `mln_runtime_get_offline_region_status` in the
3103        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3104
3105        Errors:
3106
3107        - `Status.NOT_FOUND` when the cache file has no region `region_id`.
3108        """
3109        return map_future(
3110            self._native.get_offline_region_status(region_id),
3111            lambda value: OfflineRegionStatus._from_native(value),
3112        )

Reads the download progress of the offline region region_id.

While the download is active, the counts cover what it has visited. Once it's inactive, they cover every resource the region holds, including those that only earlier versions of its style listed, so the completed counts can exceed the required counts.

See mln_runtime_get_offline_region_status in the C API reference.

Errors:

def invalidate_offline_region(self, region_id: int) -> concurrent.futures._base.Future[None]:
3114    def invalidate_offline_region(self, region_id: int) -> Future[None]:
3115        """Makes maps check each resource of the offline region `region_id` with
3116        the server before they use it.
3117
3118        The region keeps its resources. Starting its download again fetches
3119        the invalidated resources for offline use. If the style or a TileJSON
3120        document is then missing or invalid, the download reports an offline
3121        region response error and goes on from the stored copy. Resources
3122        that the current style no longer lists stay in the region until it's
3123        deleted.
3124
3125        See `mln_runtime_invalidate_offline_region` in the
3126        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3127
3128        Errors:
3129
3130        - `Status.NOT_FOUND` when the cache file has no region `region_id`.
3131        """
3132        return self._native.invalidate_offline_region(region_id)

Makes maps check each resource of the offline region region_id with the server before they use it.

The region keeps its resources. Starting its download again fetches the invalidated resources for offline use. If the style or a TileJSON document is then missing or invalid, the download reports an offline region response error and goes on from the stored copy. Resources that the current style no longer lists stay in the region until it's deleted.

See mln_runtime_invalidate_offline_region in the C API reference.

Errors:

def list_offline_regions( self) -> concurrent.futures._base.Future[tuple[OfflineRegionInfo, ...]]:
3134    def list_offline_regions(self) -> Future[tuple[OfflineRegionInfo, ...]]:
3135        """Lists the offline regions in the runtime's cache file.
3136
3137        See `mln_runtime_list_offline_regions` in the
3138        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3139        """
3140        return map_future(
3141            self._native.list_offline_regions(),
3142            lambda value: tuple(OfflineRegionInfo._from_native(item) for item in value),
3143        )

Lists the offline regions in the runtime's cache file.

See mln_runtime_list_offline_regions in the C API reference.

def merge_offline_regions( self, side_database_path: str) -> concurrent.futures._base.Future[tuple[OfflineRegionInfo, ...]]:
3145    def merge_offline_regions(
3146        self, side_database_path: str
3147    ) -> Future[tuple[OfflineRegionInfo, ...]]:
3148        """Copies the offline regions of another cache file into the runtime's
3149        cache file.
3150
3151        A region whose definition and metadata match one that the runtime's
3152        file already has isn't copied again. The result lists the runtime's
3153        copy of each region in the other file.
3154
3155        See `mln_runtime_merge_offline_regions` in the
3156        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3157
3158        Errors:
3159
3160        - `Status.INVALID_ARGUMENT` when `side_database_path` isn't a
3161          readable database file.
3162        - `Status.NATIVE_ERROR` when the merge would exceed the tile limit
3163          that `RuntimeEventType.OFFLINE_REGION_TILE_COUNT_LIMIT_EXCEEDED`
3164          describes.
3165        """
3166        return map_future(
3167            self._native.merge_offline_regions(side_database_path),
3168            lambda value: tuple(OfflineRegionInfo._from_native(item) for item in value),
3169        )

Copies the offline regions of another cache file into the runtime's cache file.

A region whose definition and metadata match one that the runtime's file already has isn't copied again. The result lists the runtime's copy of each region in the other file.

See mln_runtime_merge_offline_regions in the C API reference.

Errors:

def release(self) -> concurrent.futures._base.Future[None]:
3171    def release(self) -> Future[None]:
3172        """Releases a runtime.
3173
3174        Release the runtime's maps first.
3175
3176        See `mln_runtime_release` in the
3177        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
3178        """
3179        return self._native.release()

Releases a runtime.

Release the runtime's maps first.

See mln_runtime_release in the C API reference.

def run_cache_database_operation( self, operation: CacheDatabaseOperation) -> concurrent.futures._base.Future[None]:
3181    def run_cache_database_operation(
3182        self, operation: CacheDatabaseOperation
3183    ) -> Future[None]:
3184        """Runs a maintenance action on the runtime's cache database.
3185
3186        See `mln_runtime_run_cache_database_operation` in the
3187        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
3188        """
3189        return self._native.run_cache_database_operation(operation)

Runs a maintenance action on the runtime's cache database.

See mln_runtime_run_cache_database_operation in the C API reference.

def set_event_handler( self, handler: RuntimeEventHandler) -> concurrent.futures._base.Future[CommandCompletion]:
3191    def set_event_handler(
3192        self, handler: RuntimeEventHandler
3193    ) -> Future[CommandCompletion]:
3194        """Sends the events of the runtime and its maps to a callback.
3195
3196        The callback replaces the one set before.
3197
3198        See `mln_runtime_set_event_handler` in the
3199        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
3200        """
3201        return self._native.set_event_handler(handler)

Sends the events of the runtime and its maps to a callback.

The callback replaces the one set before.

See mln_runtime_set_event_handler in the C API reference.

def set_http_header_transform( self, transform: HttpHeaderTransform) -> concurrent.futures._base.Future[CommandCompletion]:
3203    def set_http_header_transform(
3204        self, transform: HttpHeaderTransform
3205    ) -> Future[CommandCompletion]:
3206        """Adds headers to the runtime's HTTP requests.
3207
3208        The transform replaces the one set before. In a browser or on
3209        OpenHarmony, serve the requests with
3210        `RuntimeHandle.set_resource_provider()` instead.
3211
3212        See `mln_runtime_set_http_header_transform` in the
3213        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
3214
3215        Errors:
3216
3217        - `Status.UNSUPPORTED` when the library runs in a browser or on
3218          OpenHarmony.
3219        """
3220        return self._native.set_http_header_transform(transform)

Adds headers to the runtime's HTTP requests.

The transform replaces the one set before. In a browser or on OpenHarmony, serve the requests with RuntimeHandle.set_resource_provider() instead.

See mln_runtime_set_http_header_transform in the C API reference.

Errors:

def set_maximum_ambient_cache_size(self, size: int) -> concurrent.futures._base.Future[None]:
3222    def set_maximum_ambient_cache_size(self, size: int) -> Future[None]:
3223        """Limits the size of the runtime's ambient cache.
3224
3225        `size` is in bytes. Offline regions don't count toward it. It
3226        defaults to 50 MB, or to 0 in the browser when the runtime has no
3227        cache file.
3228
3229        See `mln_runtime_set_maximum_ambient_cache_size` in the
3230        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
3231        """
3232        return self._native.set_maximum_ambient_cache_size(size)

Limits the size of the runtime's ambient cache.

size is in bytes. Offline regions don't count toward it. It defaults to 50 MB, or to 0 in the browser when the runtime has no cache file.

See mln_runtime_set_maximum_ambient_cache_size in the C API reference.

def set_offline_region_download_state( self, region_id: int, state: OfflineRegionDownloadState) -> concurrent.futures._base.Future[None]:
3234    def set_offline_region_download_state(
3235        self, region_id: int, state: OfflineRegionDownloadState
3236    ) -> Future[None]:
3237        """Starts or pauses the download of the offline region `region_id`.
3238
3239        Setting the state that the download already has does nothing. A
3240        download stops when the runtime closes.
3241
3242        See `mln_runtime_set_offline_region_download_state` in the
3243        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3244
3245        Errors:
3246
3247        - `Status.NOT_FOUND` when the cache file has no region `region_id`.
3248        """
3249        return self._native.set_offline_region_download_state(region_id, state)

Starts or pauses the download of the offline region region_id.

Setting the state that the download already has does nothing. A download stops when the runtime closes.

See mln_runtime_set_offline_region_download_state in the C API reference.

Errors:

def set_offline_region_observed( self, region_id: int, events: RuntimeEventFlag) -> concurrent.futures._base.Future[None]:
3251    def set_offline_region_observed(
3252        self, region_id: int, events: RuntimeEventFlag
3253    ) -> Future[None]:
3254        """Selects the events that the runtime reports about the download of the
3255        offline region `region_id`.
3256
3257        `events` holds bits of `RuntimeEventFlag.ALL_RUNTIME_EVENTS` and
3258        replaces the region's previous selection. `RuntimeEventFlag.NONE`
3259        stops the region's events.
3260
3261        See `mln_runtime_set_offline_region_observed` in the
3262        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3263
3264        Errors:
3265
3266        - `Status.NOT_FOUND` when the cache file has no region `region_id`.
3267        """
3268        return self._native.set_offline_region_observed(region_id, events)

Selects the events that the runtime reports about the download of the offline region region_id.

events holds bits of RuntimeEventFlag.ALL_RUNTIME_EVENTS and replaces the region's previous selection. RuntimeEventFlag.NONE stops the region's events.

See mln_runtime_set_offline_region_observed in the C API reference.

Errors:

def set_resource_provider( self, provider: ResourceProvider) -> concurrent.futures._base.Future[CommandCompletion]:
3270    def set_resource_provider(
3271        self, provider: ResourceProvider
3272    ) -> Future[CommandCompletion]:
3273        """Serves the runtime's network requests through a callback.
3274
3275        The provider receives the network requests that its routes match, and
3276        the library loads the rest as usual. A provider can serve URL schemes
3277        that the library can't load itself. The provider replaces the one set
3278        before.
3279
3280        See `mln_runtime_set_resource_provider` in the
3281        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
3282        """
3283        return self._native.set_resource_provider(provider)

Serves the runtime's network requests through a callback.

The provider receives the network requests that its routes match, and the library loads the rest as usual. A provider can serve URL schemes that the library can't load itself. The provider replaces the one set before.

See mln_runtime_set_resource_provider in the C API reference.

def set_resource_transform( self, transform: ResourceTransform) -> concurrent.futures._base.Future[CommandCompletion]:
3285    def set_resource_transform(
3286        self, transform: ResourceTransform
3287    ) -> Future[CommandCompletion]:
3288        """Rewrites the URLs of the runtime's network requests.
3289
3290        The transform replaces the one set before.
3291
3292        See `mln_runtime_set_resource_transform` in the
3293        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
3294        """
3295        return self._native.set_resource_transform(transform)

Rewrites the URLs of the runtime's network requests.

The transform replaces the one set before.

See mln_runtime_set_resource_transform in the C API reference.

def update_offline_region_metadata( self, region_id: int, metadata: Buffer) -> concurrent.futures._base.Future[OfflineRegionInfo]:
3297    def update_offline_region_metadata(
3298        self, region_id: int, metadata: Buffer
3299    ) -> Future[OfflineRegionInfo]:
3300        """Replaces the metadata of the offline region `region_id`.
3301
3302        See `mln_runtime_update_offline_region_metadata` in the
3303        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
3304
3305        Errors:
3306
3307        - `Status.NOT_FOUND` when the cache file has no region `region_id`.
3308        """
3309        return map_future(
3310            self._native.update_offline_region_metadata(region_id, metadata),
3311            lambda value: OfflineRegionInfo._from_native(value),
3312        )

Replaces the metadata of the offline region region_id.

See mln_runtime_update_offline_region_metadata in the C API reference.

Errors:

id: int
301    @property
302    def id(self) -> int:
303        """The native handle value, which runtime events report as their source.
304
305        It stays readable after release, so events drained later still match
306        the handle that produced them.
307        """
308        return int(self._native.id)

The native handle value, which runtime events report as their source.

It stays readable after release, so events drained later still match the handle that produced them.

def dispose(self) -> None:
310    def dispose(self) -> None:
311        """Releases a runtime in any state, without waiting.
312
313        The runtime finishes its teardown after its maps are released.
314
315        See `mln_runtime_dispose` in the
316        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
317        """
318        self._native._dispose()

Releases a runtime in any state, without waiting.

The runtime finishes its teardown after its maps are released.

See mln_runtime_dispose in the C API reference.

class RuntimeHandleDiscarding:
4383class RuntimeHandleDiscarding:
4384    __slots__ = ("_native",)
4385    _native: _native._RuntimeHandle
4386
4387    def __init__(self, owner: _RuntimeHandleOperations):
4388        self._native = owner._native
4389
4390    def clear_event_handler(self) -> None:
4391        """Stops sending the events of the runtime and its maps to a callback.
4392
4393        See `mln_runtime_clear_event_handler` in the
4394        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4395        """
4396        return self._native._discard_clear_event_handler()
4397
4398    def clear_http_header_transform(self) -> None:
4399        """Stops adding headers to the runtime's HTTP requests.
4400
4401        See `mln_runtime_clear_http_header_transform` in the
4402        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4403        """
4404        return self._native._discard_clear_http_header_transform()
4405
4406    def clear_resource_provider(self) -> None:
4407        """Removes the runtime's resource provider, so the library loads every
4408        request itself.
4409
4410        See `mln_runtime_clear_resource_provider` in the
4411        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4412        """
4413        return self._native._discard_clear_resource_provider()
4414
4415    def clear_resource_transform(self) -> None:
4416        """Stops rewriting the URLs of the runtime's network requests.
4417
4418        See `mln_runtime_clear_resource_transform` in the
4419        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4420        """
4421        return self._native._discard_clear_resource_transform()
4422
4423    def set_event_handler(self, handler: RuntimeEventHandler) -> None:
4424        """Sends the events of the runtime and its maps to a callback.
4425
4426        The callback replaces the one set before.
4427
4428        See `mln_runtime_set_event_handler` in the
4429        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4430        """
4431        return self._native._discard_set_event_handler(handler)
4432
4433    def set_http_header_transform(self, transform: HttpHeaderTransform) -> None:
4434        """Adds headers to the runtime's HTTP requests.
4435
4436        The transform replaces the one set before. In a browser or on
4437        OpenHarmony, serve the requests with
4438        `RuntimeHandle.set_resource_provider()` instead.
4439
4440        See `mln_runtime_set_http_header_transform` in the
4441        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4442
4443        Errors:
4444
4445        - `Status.UNSUPPORTED` when the library runs in a browser or on
4446          OpenHarmony.
4447        """
4448        return self._native._discard_set_http_header_transform(transform)
4449
4450    def set_resource_provider(self, provider: ResourceProvider) -> None:
4451        """Serves the runtime's network requests through a callback.
4452
4453        The provider receives the network requests that its routes match, and
4454        the library loads the rest as usual. A provider can serve URL schemes
4455        that the library can't load itself. The provider replaces the one set
4456        before.
4457
4458        See `mln_runtime_set_resource_provider` in the
4459        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4460        """
4461        return self._native._discard_set_resource_provider(provider)
4462
4463    def set_resource_transform(self, transform: ResourceTransform) -> None:
4464        """Rewrites the URLs of the runtime's network requests.
4465
4466        The transform replaces the one set before.
4467
4468        See `mln_runtime_set_resource_transform` in the
4469        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4470        """
4471        return self._native._discard_set_resource_transform(transform)
RuntimeHandleDiscarding( owner: maplibre_native_ffi._generated_operations._RuntimeHandleOperations)
4387    def __init__(self, owner: _RuntimeHandleOperations):
4388        self._native = owner._native
def clear_event_handler(self) -> None:
4390    def clear_event_handler(self) -> None:
4391        """Stops sending the events of the runtime and its maps to a callback.
4392
4393        See `mln_runtime_clear_event_handler` in the
4394        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4395        """
4396        return self._native._discard_clear_event_handler()

Stops sending the events of the runtime and its maps to a callback.

See mln_runtime_clear_event_handler in the C API reference.

def clear_http_header_transform(self) -> None:
4398    def clear_http_header_transform(self) -> None:
4399        """Stops adding headers to the runtime's HTTP requests.
4400
4401        See `mln_runtime_clear_http_header_transform` in the
4402        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4403        """
4404        return self._native._discard_clear_http_header_transform()

Stops adding headers to the runtime's HTTP requests.

See mln_runtime_clear_http_header_transform in the C API reference.

def clear_resource_provider(self) -> None:
4406    def clear_resource_provider(self) -> None:
4407        """Removes the runtime's resource provider, so the library loads every
4408        request itself.
4409
4410        See `mln_runtime_clear_resource_provider` in the
4411        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4412        """
4413        return self._native._discard_clear_resource_provider()

Removes the runtime's resource provider, so the library loads every request itself.

See mln_runtime_clear_resource_provider in the C API reference.

def clear_resource_transform(self) -> None:
4415    def clear_resource_transform(self) -> None:
4416        """Stops rewriting the URLs of the runtime's network requests.
4417
4418        See `mln_runtime_clear_resource_transform` in the
4419        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4420        """
4421        return self._native._discard_clear_resource_transform()

Stops rewriting the URLs of the runtime's network requests.

See mln_runtime_clear_resource_transform in the C API reference.

def set_event_handler( self, handler: RuntimeEventHandler) -> None:
4423    def set_event_handler(self, handler: RuntimeEventHandler) -> None:
4424        """Sends the events of the runtime and its maps to a callback.
4425
4426        The callback replaces the one set before.
4427
4428        See `mln_runtime_set_event_handler` in the
4429        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4430        """
4431        return self._native._discard_set_event_handler(handler)

Sends the events of the runtime and its maps to a callback.

The callback replaces the one set before.

See mln_runtime_set_event_handler in the C API reference.

def set_http_header_transform( self, transform: HttpHeaderTransform) -> None:
4433    def set_http_header_transform(self, transform: HttpHeaderTransform) -> None:
4434        """Adds headers to the runtime's HTTP requests.
4435
4436        The transform replaces the one set before. In a browser or on
4437        OpenHarmony, serve the requests with
4438        `RuntimeHandle.set_resource_provider()` instead.
4439
4440        See `mln_runtime_set_http_header_transform` in the
4441        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4442
4443        Errors:
4444
4445        - `Status.UNSUPPORTED` when the library runs in a browser or on
4446          OpenHarmony.
4447        """
4448        return self._native._discard_set_http_header_transform(transform)

Adds headers to the runtime's HTTP requests.

The transform replaces the one set before. In a browser or on OpenHarmony, serve the requests with RuntimeHandle.set_resource_provider() instead.

See mln_runtime_set_http_header_transform in the C API reference.

Errors:

def set_resource_provider( self, provider: ResourceProvider) -> None:
4450    def set_resource_provider(self, provider: ResourceProvider) -> None:
4451        """Serves the runtime's network requests through a callback.
4452
4453        The provider receives the network requests that its routes match, and
4454        the library loads the rest as usual. A provider can serve URL schemes
4455        that the library can't load itself. The provider replaces the one set
4456        before.
4457
4458        See `mln_runtime_set_resource_provider` in the
4459        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4460        """
4461        return self._native._discard_set_resource_provider(provider)

Serves the runtime's network requests through a callback.

The provider receives the network requests that its routes match, and the library loads the rest as usual. A provider can serve URL schemes that the library can't load itself. The provider replaces the one set before.

See mln_runtime_set_resource_provider in the C API reference.

def set_resource_transform( self, transform: ResourceTransform) -> None:
4463    def set_resource_transform(self, transform: ResourceTransform) -> None:
4464        """Rewrites the URLs of the runtime's network requests.
4465
4466        The transform replaces the one set before.
4467
4468        See `mln_runtime_set_resource_transform` in the
4469        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4470        """
4471        return self._native._discard_set_resource_transform(transform)

Rewrites the URLs of the runtime's network requests.

The transform replaces the one set before.

See mln_runtime_set_resource_transform in the C API reference.

@dataclass(frozen=True, slots=True)
class RuntimeOptions:
4699@dataclass(frozen=True, slots=True)
4700class RuntimeOptions:
4701    """Options for `RuntimeHandle.create()`.
4702
4703    See `mln_runtime_options` in the
4704    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
4705    """
4706
4707    asset_path: str = ""
4708    """The directory that `asset://` URLs load from. Empty uses the working
4709    directory, or the app's assets on Android.
4710    """
4711
4712    cache_path: str = ""
4713    """The path of the cache database file, which holds the ambient cache and
4714    offline regions. Its directory must be writable. Empty keeps the cache in
4715    memory.
4716    """
4717
4718    @classmethod
4719    def _from_native(cls, raw):
4720        return cls(asset_path=raw["asset_path"], cache_path=raw["cache_path"])

Options for RuntimeHandle.create().

See mln_runtime_options in the C API reference.

RuntimeOptions(asset_path: str = '', cache_path: str = '')
asset_path: str

The directory that asset:// URLs load from. Empty uses the working directory, or the app's assets on Android.

cache_path: str

The path of the cache database file, which holds the ambient cache and offline regions. Its directory must be writable. Empty keeps the cache in memory.

@dataclass(frozen=True, slots=True)
class ScreenBox:
4723@dataclass(frozen=True, slots=True)
4724class ScreenBox:
4725    """A rectangle of the screen, from its `min` corner to its `max` corner.
4726
4727    See `mln_screen_box` in the
4728    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html).
4729    """
4730
4731    min: ScreenPoint = field(default_factory=lambda: ScreenPoint())
4732
4733    max: ScreenPoint = field(default_factory=lambda: ScreenPoint())
4734
4735    @classmethod
4736    def _from_native(cls, raw):
4737        return cls(
4738            min=ScreenPoint._from_native(raw["min"]),
4739            max=ScreenPoint._from_native(raw["max"]),
4740        )

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

See mln_screen_box in the C API reference.

ScreenBox( min: ScreenPoint = <factory>, max: ScreenPoint = <factory>)
@dataclass(frozen=True, slots=True)
class ScreenLineString:
4743@dataclass(frozen=True, slots=True)
4744class ScreenLineString:
4745    """A line through points on the screen.
4746
4747    See `mln_screen_line_string` in the
4748    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html).
4749    """
4750
4751    points: Sequence[ScreenPoint] = ()
4752
4753    def __post_init__(self):
4754        object.__setattr__(self, "points", _sequence(self.points))
4755
4756    @classmethod
4757    def _from_native(cls, raw):
4758        return cls(
4759            points=tuple(ScreenPoint._from_native(item) for item in raw["points"])
4760        )

A line through points on the screen.

See mln_screen_line_string in the C API reference.

ScreenLineString( points: Sequence[ScreenPoint] = ())
points: Sequence[ScreenPoint]
@dataclass(frozen=True, slots=True)
class ScreenPoint:
4763@dataclass(frozen=True, slots=True)
4764class ScreenPoint:
4765    """A point on the screen, in logical pixels from the map's top-left corner.
4766
4767    See `mln_screen_point` in the
4768    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
4769    """
4770
4771    x: float = 0.0
4772
4773    y: float = 0.0
4774
4775    @classmethod
4776    def _from_native(cls, raw):
4777        return cls(x=raw["x"], y=raw["y"])

A point on the screen, in logical pixels from the map's top-left corner.

See mln_screen_point in the C API reference.

ScreenPoint(x: float = 0.0, y: float = 0.0)
x: float
y: float
@dataclass(frozen=True, slots=True)
class SourceFeature:
4780@dataclass(frozen=True, slots=True)
4781class SourceFeature:
4782    """A feature that a source feature query found.
4783
4784    See `mln_source_feature` in the
4785    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html).
4786    """
4787
4788    feature: Any
4789    """The feature, as a GeoJSON feature."""
4790
4791    source_layer_id: str
4792    """The feature's source layer, or empty when its source has none."""
4793
4794    @classmethod
4795    def _from_native(cls, raw):
4796        return cls(feature=raw["feature"], source_layer_id=raw["source_layer_id"])

A feature that a source feature query found.

See mln_source_feature in the C API reference.

SourceFeature(feature: Any, source_layer_id: str)
feature: Any

The feature, as a GeoJSON feature.

source_layer_id: str

The feature's source layer, or empty when its source has none.

@dataclass(frozen=True, slots=True)
class SourceFeatureQueryOptions:
4799@dataclass(frozen=True, slots=True)
4800class SourceFeatureQueryOptions:
4801    """Options for a source feature query.
4802
4803    See `mln_source_feature_query_options` in the
4804    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/query_8h.html).
4805    """
4806
4807    source_layer_ids: Sequence[str] | None = None
4808    """The source layers to query. A vector source finds features only in the
4809    source layers named here.
4810    """
4811
4812    filter: Any = None
4813    """A \\[filter\\](https://maplibre.org/maplibre-style-spec/expressions/) that
4814    each feature must match. Empty matches every feature.
4815    """
4816
4817    def __post_init__(self):
4818        object.__setattr__(self, "source_layer_ids", _sequence(self.source_layer_ids))
4819
4820    @classmethod
4821    def _from_native(cls, raw):
4822        return cls(
4823            source_layer_ids=None
4824            if raw["source_layer_ids"] is None
4825            else (tuple(item for item in raw["source_layer_ids"])),
4826            filter=raw["filter"],
4827        )

Options for a source feature query.

See mln_source_feature_query_options in the C API reference.

SourceFeatureQueryOptions(source_layer_ids: Sequence[str] | None = None, filter: Any = None)
source_layer_ids: Sequence[str] | None

The source layers to query. A vector source finds features only in the source layers named here.

filter: Any

A [filter](https://maplibre.org/maplibre-style-spec/expressions/) that each feature must match. Empty matches every feature.

class Status(maplibre_native_ffi._enum.UnknownIntEnum):
897class Status(UnknownIntEnum):
898    """The result of a call or of asynchronous work.
899
900    See `mln_status` in the
901    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/base_8h.html).
902    """
903
904    OK = 0
905    INVALID_ARGUMENT = -1
906    INVALID_STATE = -2
907    WRONG_THREAD = -3
908    UNSUPPORTED = -4
909    NATIVE_ERROR = -5
910    CANCELLED = -6
911    BUSY = -7
912    TARGET_LOST = -8
913    NOT_FOUND = -10
914    ALREADY_EXISTS = -11

The result of a call or of asynchronous work.

See mln_status in the C API reference.

OK = <Status.OK: 0>
INVALID_ARGUMENT = <Status.INVALID_ARGUMENT: -1>
INVALID_STATE = <Status.INVALID_STATE: -2>
WRONG_THREAD = <Status.WRONG_THREAD: -3>
UNSUPPORTED = <Status.UNSUPPORTED: -4>
NATIVE_ERROR = <Status.NATIVE_ERROR: -5>
CANCELLED = <Status.CANCELLED: -6>
BUSY = <Status.BUSY: -7>
TARGET_LOST = <Status.TARGET_LOST: -8>
NOT_FOUND = <Status.NOT_FOUND: -10>
ALREADY_EXISTS = <Status.ALREADY_EXISTS: -11>
class StyleExpressionHandle(maplibre_native_ffi._generated_operations._StyleExpressionHandleOperations, maplibre_native_ffi._lifecycle.ScopedHandleMixin):

A parsed style expression.

See mln_style_expression in the C API reference.

@classmethod
def create( cls, expression: Any, options: StyleExpressionOptions | None = None) -> StyleExpressionHandle:
3322    @classmethod
3323    def create(
3324        cls, expression: Any, options: StyleExpressionOptions | None = None
3325    ) -> StyleExpressionHandle:
3326        """Parses a style
3327        \\[expression\\](https://maplibre.org/maplibre-style-spec/expressions/)
3328        to evaluate without a map.
3329
3330        See `mln_style_expression_create` in the
3331        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style__expression_8h.html).
3332
3333        Errors:
3334
3335        - `Status.INVALID_ARGUMENT` when `expression` isn't a valid
3336          expression, or its result can't have the expected type.
3337        """
3338        return _adopt_value(
3339            _native._StyleExpressionHandle.create(expression, options),
3340            "StyleExpressionHandle",
3341            None,
3342        )

Parses a style [expression](https://maplibre.org/maplibre-style-spec/expressions/) to evaluate without a map.

See mln_style_expression_create in the C API reference.

Errors:

def evaluate( self, inputs: StyleExpressionInputs | None = None) -> Any:
3344    def evaluate(self, inputs: StyleExpressionInputs | None = None) -> Any:
3345        """Evaluates a style expression and writes its result as JSON.
3346
3347        A number in the result that isn't finite becomes null. A color is
3348        `["rgba", r, g, b, a]`, with red, green, and blue from 0 to 255 and
3349        alpha from 0 to 1, each exact only to single precision. Formatted
3350        text is a `["format", …]` expression, an image is `{"name": …,
3351        "available": …}`, padding is `[top, right, bottom, left]`, and a
3352        variable anchor offset is `[anchor, [x, y], …]`.
3353
3354        See `mln_style_expression_evaluate` in the
3355        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style__expression_8h.html).
3356
3357        Errors:
3358
3359        - `Status.INVALID_ARGUMENT` when the expression fails to evaluate,
3360          such as when it reads an input that `inputs` doesn't set.
3361        """
3362        return self._native.evaluate(inputs)

Evaluates a style expression and writes its result as JSON.

A number in the result that isn't finite becomes null. A color is ["rgba", r, g, b, a], with red, green, and blue from 0 to 255 and alpha from 0 to 1, each exact only to single precision. Formatted text is a ["format", …] expression, an image is {"name": …, "available": …}, padding is [top, right, bottom, left], and a variable anchor offset is [anchor, [x, y], …].

See mln_style_expression_evaluate in the C API reference.

Errors:

  • Status.INVALID_ARGUMENT when the expression fails to evaluate, such as when it reads an input that inputs doesn't set.
def get_info(self) -> StyleExpressionInfo:
3364    def get_info(self) -> StyleExpressionInfo:
3365        """Reads what a style expression's result depends on.
3366
3367        See `mln_style_expression_get_info` in the
3368        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style__expression_8h.html).
3369        """
3370        return StyleExpressionInfo._from_native(self._native.get_info())

Reads what a style expression's result depends on.

See mln_style_expression_get_info in the C API reference.

def release(self) -> None:
3372    def release(self) -> None:
3373        """Releases a parsed style expression.
3374
3375        See `mln_style_expression_release` in the
3376        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style__expression_8h.html).
3377        """
3378        return self._native.release()

Releases a parsed style expression.

See mln_style_expression_release in the C API reference.

id: int
341    @property
342    def id(self) -> int:
343        """The native handle value. It stays readable after release."""
344        return int(self._native.id)

The native handle value. It stays readable after release.

@dataclass(frozen=True, slots=True)
class StyleExpressionInfo:
4830@dataclass(frozen=True, slots=True)
4831class StyleExpressionInfo:
4832    """What a style expression's result depends on.
4833
4834    See `mln_style_expression_info` in the
4835    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style__expression_8h.html).
4836    """
4837
4838    is_feature_constant: bool
4839    """True when the result doesn't depend on the feature or its state."""
4840
4841    is_zoom_constant: bool
4842    """True when the result doesn't depend on the zoom level."""
4843
4844    @classmethod
4845    def _from_native(cls, raw):
4846        return cls(
4847            is_feature_constant=raw["is_feature_constant"],
4848            is_zoom_constant=raw["is_zoom_constant"],
4849        )

What a style expression's result depends on.

See mln_style_expression_info in the C API reference.

StyleExpressionInfo(is_feature_constant: bool, is_zoom_constant: bool)
is_feature_constant: bool

True when the result doesn't depend on the feature or its state.

is_zoom_constant: bool

True when the result doesn't depend on the zoom level.

@dataclass(frozen=True, slots=True)
class StyleExpressionInputs:
4852@dataclass(frozen=True, slots=True)
4853class StyleExpressionInputs:
4854    """The inputs that a style expression reads while it evaluates.
4855
4856    See `mln_style_expression_inputs` in the
4857    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style__expression_8h.html).
4858    """
4859
4860    zoom: float | None = None
4861
4862    color_ramp_parameter: float | None = None
4863    """The value of `heatmap-density`, `line-progress`, and `elevation`."""
4864
4865    feature: Any = None
4866    """The feature to evaluate against, as a GeoJSON feature, or empty for none."""
4867
4868    feature_state: Any = None
4869    """The feature's state, as a JSON object, or empty for none."""
4870
4871    global_state: Any = None
4872    """The values that `global-state` reads, as a JSON object, or empty for
4873    none.
4874    """
4875
4876    canonical_tile_id: CanonicalTileId | None = None
4877    """The tile that holds the feature. `within` and `distance` need it to read
4878    the feature's geometry.
4879    """
4880
4881    available_images: Sequence[str] = ()
4882    """The IDs of the images that `image` treats as available."""
4883
4884    def __post_init__(self):
4885        object.__setattr__(self, "available_images", _sequence(self.available_images))
4886
4887    @classmethod
4888    def _from_native(cls, raw):
4889        return cls(
4890            zoom=raw["zoom"],
4891            color_ramp_parameter=raw["color_ramp_parameter"],
4892            feature=raw["feature"],
4893            feature_state=raw["feature_state"],
4894            global_state=raw["global_state"],
4895            canonical_tile_id=_maybe(
4896                CanonicalTileId._from_native, raw["canonical_tile_id"]
4897            ),
4898            available_images=tuple(item for item in raw["available_images"]),
4899        )

The inputs that a style expression reads while it evaluates.

See mln_style_expression_inputs in the C API reference.

StyleExpressionInputs( zoom: float | None = None, color_ramp_parameter: float | None = None, feature: Any = None, feature_state: Any = None, global_state: Any = None, canonical_tile_id: CanonicalTileId | None = None, available_images: Sequence[str] = ())
zoom: float | None
color_ramp_parameter: float | None

The value of heatmap-density, line-progress, and elevation.

feature: Any

The feature to evaluate against, as a GeoJSON feature, or empty for none.

feature_state: Any

The feature's state, as a JSON object, or empty for none.

global_state: Any

The values that global-state reads, as a JSON object, or empty for none.

canonical_tile_id: CanonicalTileId | None

The tile that holds the feature. within and distance need it to read the feature's geometry.

available_images: Sequence[str]

The IDs of the images that image treats as available.

@dataclass(frozen=True, slots=True)
class StyleExpressionOptions:
4902@dataclass(frozen=True, slots=True)
4903class StyleExpressionOptions:
4904    """Options for parsing a style expression.
4905
4906    See `mln_style_expression_options` in the
4907    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style__expression_8h.html).
4908    """
4909
4910    expected_type: StyleExpressionType | None = None
4911    """The type that the result must have."""
4912
4913    @classmethod
4914    def _from_native(cls, raw):
4915        return cls(
4916            expected_type=_maybe(StyleExpressionType._from_native, raw["expected_type"])
4917        )

Options for parsing a style expression.

See mln_style_expression_options in the C API reference.

StyleExpressionOptions( expected_type: StyleExpressionType | None = None)
expected_type: StyleExpressionType | None

The type that the result must have.

@dataclass(frozen=True, slots=True)
class StyleExpressionType:
4920@dataclass(frozen=True, slots=True)
4921class StyleExpressionType:
4922    """The type of a style expression's result.
4923
4924    See `mln_style_expression_type` in the
4925    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style__expression_8h.html).
4926    """
4927
4928    kind: StyleExpressionTypeKind = StyleExpressionTypeKind.VALUE
4929
4930    item_kind: StyleExpressionTypeKind = StyleExpressionTypeKind.VALUE
4931    """The type of each item when `kind` is `StyleExpressionTypeKind.ARRAY`. It
4932    can't be an array itself.
4933    """
4934
4935    item_count: int = 0
4936    """The length of an array, or 0 for any length."""
4937
4938    @classmethod
4939    def _from_native(cls, raw):
4940        return cls(
4941            kind=StyleExpressionTypeKind(raw["kind"]),
4942            item_kind=StyleExpressionTypeKind(raw["item_kind"]),
4943            item_count=raw["item_count"],
4944        )

The type of a style expression's result.

See mln_style_expression_type in the C API reference.

StyleExpressionType( kind: StyleExpressionTypeKind = <StyleExpressionTypeKind.VALUE: 0>, item_kind: StyleExpressionTypeKind = <StyleExpressionTypeKind.VALUE: 0>, item_count: int = 0)

The type of each item when kind is StyleExpressionTypeKind.ARRAY. It can't be an array itself.

item_count: int

The length of an array, or 0 for any length.

class StyleExpressionTypeKind(maplibre_native_ffi._enum.UnknownIntEnum):
917class StyleExpressionTypeKind(UnknownIntEnum):
918    """The type of a style expression's result, or of the items of an array
919    result.
920
921    See `mln_style_expression_type_kind` in the
922    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style__expression_8h.html).
923    """
924
925    VALUE = 0
926    NUMBER = 1
927    STRING = 2
928    BOOLEAN = 3
929    COLOR = 4
930    OBJECT = 5
931    FORMATTED = 6
932    IMAGE = 7
933    PADDING = 8
934    VARIABLE_ANCHOR_OFFSET_COLLECTION = 9
935    ARRAY = 10

The type of a style expression's result, or of the items of an array result.

See mln_style_expression_type_kind in the C API reference.

VARIABLE_ANCHOR_OFFSET_COLLECTION = <StyleExpressionTypeKind.VARIABLE_ANCHOR_OFFSET_COLLECTION: 9>
@dataclass(frozen=True, slots=True)
class StyleImageInfo:
4947@dataclass(frozen=True, slots=True)
4948class StyleImageInfo:
4949    """An image in the map's style.
4950
4951    See `mln_style_image_info` in the
4952    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
4953    """
4954
4955    width: int
4956
4957    height: int
4958
4959    pixels: bytes
4960    """The premultiplied RGBA pixels, in rows of `width` \\* 4 bytes, from the
4961    top row down.
4962    """
4963
4964    stretch_x: tuple[ImageStretch, ...]
4965
4966    stretch_y: tuple[ImageStretch, ...]
4967
4968    content: ImageContent | None
4969
4970    text_fit_width: StyleImageTextFit | None
4971
4972    text_fit_height: StyleImageTextFit | None
4973
4974    pixel_ratio: float
4975
4976    sdf: bool
4977
4978    keep_unused: bool
4979
4980    @classmethod
4981    def _from_native(cls, raw):
4982        return cls(
4983            width=raw["width"],
4984            height=raw["height"],
4985            pixels=raw["pixels"],
4986            stretch_x=tuple(
4987                ImageStretch._from_native(item) for item in raw["stretch_x"]
4988            ),
4989            stretch_y=tuple(
4990                ImageStretch._from_native(item) for item in raw["stretch_y"]
4991            ),
4992            content=_maybe(ImageContent._from_native, raw["content"]),
4993            text_fit_width=_maybe(StyleImageTextFit, raw["text_fit_width"]),
4994            text_fit_height=_maybe(StyleImageTextFit, raw["text_fit_height"]),
4995            pixel_ratio=raw["pixel_ratio"],
4996            sdf=raw["sdf"],
4997            keep_unused=raw["keep_unused"],
4998        )

An image in the map's style.

See mln_style_image_info in the C API reference.

StyleImageInfo( width: int, height: int, pixels: bytes, stretch_x: tuple[ImageStretch, ...], stretch_y: tuple[ImageStretch, ...], content: ImageContent | None, text_fit_width: StyleImageTextFit | None, text_fit_height: StyleImageTextFit | None, pixel_ratio: float, sdf: bool, keep_unused: bool)
width: int
height: int
pixels: bytes

The premultiplied RGBA pixels, in rows of width * 4 bytes, from the top row down.

stretch_x: tuple[ImageStretch, ...]
stretch_y: tuple[ImageStretch, ...]
content: ImageContent | None
text_fit_width: StyleImageTextFit | None
text_fit_height: StyleImageTextFit | None
pixel_ratio: float
sdf: bool
keep_unused: bool
@dataclass(frozen=True, slots=True)
class StyleImageOptions:
5001@dataclass(frozen=True, slots=True)
5002class StyleImageOptions:
5003    """Options for a style image, as the
5004    \\[sprite\\](https://maplibre.org/maplibre-style-spec/sprite/) spec
5005    describes them.
5006
5007    See `mln_style_image_options` in the
5008    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
5009    """
5010
5011    stretch_x: Sequence[ImageStretch] | None = None
5012    """The ranges of columns that stretch, in increasing order without overlap."""
5013
5014    stretch_y: Sequence[ImageStretch] | None = None
5015    """The ranges of rows that stretch, in increasing order without overlap."""
5016
5017    content: ImageContent | None = None
5018
5019    text_fit_width: StyleImageTextFit | None = None
5020
5021    text_fit_height: StyleImageTextFit | None = None
5022
5023    pixel_ratio: float | None = None
5024
5025    sdf: bool | None = None
5026
5027    keep_unused: bool | None = None
5028    """Keeps the image after no layer uses it. Without this, the map can remove
5029    an image that it asked for through
5030    `RuntimeEventType.MAP_STYLE_IMAGE_MISSING`.
5031    """
5032
5033    def __post_init__(self):
5034        object.__setattr__(self, "stretch_x", _sequence(self.stretch_x))
5035        object.__setattr__(self, "stretch_y", _sequence(self.stretch_y))
5036
5037    @classmethod
5038    def _from_native(cls, raw):
5039        return cls(
5040            stretch_x=None
5041            if raw["stretch_x"] is None
5042            else (tuple(ImageStretch._from_native(item) for item in raw["stretch_x"])),
5043            stretch_y=None
5044            if raw["stretch_y"] is None
5045            else (tuple(ImageStretch._from_native(item) for item in raw["stretch_y"])),
5046            content=_maybe(ImageContent._from_native, raw["content"]),
5047            text_fit_width=_maybe(StyleImageTextFit, raw["text_fit_width"]),
5048            text_fit_height=_maybe(StyleImageTextFit, raw["text_fit_height"]),
5049            pixel_ratio=raw["pixel_ratio"],
5050            sdf=raw["sdf"],
5051            keep_unused=raw["keep_unused"],
5052        )

Options for a style image, as the [sprite](https://maplibre.org/maplibre-style-spec/sprite/) spec describes them.

See mln_style_image_options in the C API reference.

StyleImageOptions( stretch_x: Sequence[ImageStretch] | None = None, stretch_y: Sequence[ImageStretch] | None = None, content: ImageContent | None = None, text_fit_width: StyleImageTextFit | None = None, text_fit_height: StyleImageTextFit | None = None, pixel_ratio: float | None = None, sdf: bool | None = None, keep_unused: bool | None = None)
stretch_x: Sequence[ImageStretch] | None

The ranges of columns that stretch, in increasing order without overlap.

stretch_y: Sequence[ImageStretch] | None

The ranges of rows that stretch, in increasing order without overlap.

content: ImageContent | None
text_fit_width: StyleImageTextFit | None
text_fit_height: StyleImageTextFit | None
pixel_ratio: float | None
sdf: bool | None
keep_unused: bool | None

Keeps the image after no layer uses it. Without this, the map can remove an image that it asked for through RuntimeEventType.MAP_STYLE_IMAGE_MISSING.

class StyleImageTextFit(maplibre_native_ffi._enum.UnknownIntEnum):
938class StyleImageTextFit(UnknownIntEnum):
939    """How an image stretches to fit text along one axis.
940
941    See `mln_style_image_text_fit` in the
942    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
943    """
944
945    STRETCH_OR_SHRINK = 0
946    STRETCH_ONLY = 1
947    PROPORTIONAL = 2

How an image stretches to fit text along one axis.

See mln_style_image_text_fit in the C API reference.

STRETCH_OR_SHRINK = <StyleImageTextFit.STRETCH_OR_SHRINK: 0>
STRETCH_ONLY = <StyleImageTextFit.STRETCH_ONLY: 1>
PROPORTIONAL = <StyleImageTextFit.PROPORTIONAL: 2>
@dataclass(frozen=True, slots=True)
class StyleLayerInfo:
5055@dataclass(frozen=True, slots=True)
5056class StyleLayerInfo:
5057    """A layer in the map's style.
5058
5059    See `mln_style_layer_info` in the
5060    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
5061    """
5062
5063    id: str
5064
5065    type: str
5066    """The layer's
5067    \\[type\\](https://maplibre.org/maplibre-style-spec/layers/#type), such as
5068    `fill`.
5069    """
5070
5071    source_id: str
5072
5073    source_layer: str
5074
5075    min_zoom: float
5076    """The zoom level where the layer starts to show, or negative infinity when
5077    the layer doesn't set one.
5078    """
5079
5080    max_zoom: float
5081    """The zoom level where the layer stops showing, or infinity when the layer
5082    doesn't set one.
5083    """
5084
5085    visibility: StyleLayerVisibility
5086
5087    @classmethod
5088    def _from_native(cls, raw):
5089        return cls(
5090            id=raw["id"],
5091            type=raw["type"],
5092            source_id=raw["source_id"],
5093            source_layer=raw["source_layer"],
5094            min_zoom=raw["min_zoom"],
5095            max_zoom=raw["max_zoom"],
5096            visibility=StyleLayerVisibility(raw["visibility"]),
5097        )

A layer in the map's style.

See mln_style_layer_info in the C API reference.

StyleLayerInfo( id: str, type: str, source_id: str, source_layer: str, min_zoom: float, max_zoom: float, visibility: StyleLayerVisibility)
id: str
type: str

The layer's [type](https://maplibre.org/maplibre-style-spec/layers/#type), such as fill.

source_id: str
source_layer: str
min_zoom: float

The zoom level where the layer starts to show, or negative infinity when the layer doesn't set one.

max_zoom: float

The zoom level where the layer stops showing, or infinity when the layer doesn't set one.

visibility: StyleLayerVisibility
class StyleLayerVisibility(maplibre_native_ffi._enum.UnknownIntEnum):
950class StyleLayerVisibility(UnknownIntEnum):
951    """Whether a layer shows.
952
953    See `mln_style_layer_visibility` in the
954    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
955    """
956
957    VISIBLE = 0
958    NONE = 1

Whether a layer shows.

See mln_style_layer_visibility in the C API reference.

class StyleRasterDemEncoding(maplibre_native_ffi._enum.UnknownIntEnum):
961class StyleRasterDemEncoding(UnknownIntEnum):
962    """How a raster DEM tile encodes elevation in its colors.
963
964    See `mln_style_raster_dem_encoding` in the
965    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
966    """
967
968    MAPBOX = 0
969    TERRARIUM = 1

How a raster DEM tile encodes elevation in its colors.

See mln_style_raster_dem_encoding in the C API reference.

@dataclass(frozen=True, slots=True)
class StyleSourceInfo:
5100@dataclass(frozen=True, slots=True)
5101class StyleSourceInfo:
5102    """A source in the map's style.
5103
5104    See `mln_style_source_info` in the
5105    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
5106    """
5107
5108    id: str
5109
5110    type: StyleSourceType
5111
5112    is_volatile: bool
5113
5114    attribution: str
5115
5116    url: str
5117
5118    tile_json: StyleSourceTileInfo | None
5119    """The tiles that the style lists in the source itself, instead of at a URL."""
5120
5121    bounds: LatLngBounds | None
5122
5123    tile_size: int | None
5124
5125    vector_encoding: StyleVectorTileEncoding | None
5126
5127    raster_encoding: StyleRasterDemEncoding | None
5128
5129    geo_json: GeoJsonSourceOptions | None
5130    """A GeoJSON source's options, with every field set."""
5131
5132    @classmethod
5133    def _from_native(cls, raw):
5134        return cls(
5135            id=raw["id"],
5136            type=StyleSourceType(raw["type"]),
5137            is_volatile=raw["is_volatile"],
5138            attribution=raw["attribution"],
5139            url=raw["url"],
5140            tile_json=_maybe(StyleSourceTileInfo._from_native, raw["tile_json"]),
5141            bounds=_maybe(LatLngBounds._from_native, raw["bounds"]),
5142            tile_size=raw["tile_size"],
5143            vector_encoding=_maybe(StyleVectorTileEncoding, raw["vector_encoding"]),
5144            raster_encoding=_maybe(StyleRasterDemEncoding, raw["raster_encoding"]),
5145            geo_json=_maybe(GeoJsonSourceOptions._from_native, raw["geo_json"]),
5146        )

A source in the map's style.

See mln_style_source_info in the C API reference.

StyleSourceInfo( id: str, type: StyleSourceType, is_volatile: bool, attribution: str, url: str, tile_json: StyleSourceTileInfo | None, bounds: LatLngBounds | None, tile_size: int | None, vector_encoding: StyleVectorTileEncoding | None, raster_encoding: StyleRasterDemEncoding | None, geo_json: GeoJsonSourceOptions | None)
id: str
is_volatile: bool
attribution: str
url: str
tile_json: StyleSourceTileInfo | None

The tiles that the style lists in the source itself, instead of at a URL.

bounds: LatLngBounds | None
tile_size: int | None
vector_encoding: StyleVectorTileEncoding | None
raster_encoding: StyleRasterDemEncoding | None
geo_json: GeoJsonSourceOptions | None

A GeoJSON source's options, with every field set.

@dataclass(frozen=True, slots=True)
class StyleSourceTileInfo:
5149@dataclass(frozen=True, slots=True)
5150class StyleSourceTileInfo:
5151    """The tiles of a source, as the style lists them.
5152
5153    See `mln_style_source_tile_info` in the
5154    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
5155    """
5156
5157    tile_urls: tuple[str, ...]
5158
5159    min_zoom: float
5160
5161    max_zoom: float
5162
5163    scheme: StyleTileScheme
5164
5165    @classmethod
5166    def _from_native(cls, raw):
5167        return cls(
5168            tile_urls=tuple(item for item in raw["tile_urls"]),
5169            min_zoom=raw["min_zoom"],
5170            max_zoom=raw["max_zoom"],
5171            scheme=StyleTileScheme(raw["scheme"]),
5172        )

The tiles of a source, as the style lists them.

See mln_style_source_tile_info in the C API reference.

StyleSourceTileInfo( tile_urls: tuple[str, ...], min_zoom: float, max_zoom: float, scheme: StyleTileScheme)
tile_urls: tuple[str, ...]
min_zoom: float
max_zoom: float
scheme: StyleTileScheme
class StyleSourceType(maplibre_native_ffi._enum.UnknownIntEnum):
972class StyleSourceType(UnknownIntEnum):
973    """The type of a style source.
974
975    See `mln_style_source_type` in the
976    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
977    """
978
979    UNKNOWN = 0
980    VECTOR = 1
981    RASTER = 2
982    RASTER_DEM = 3
983    GEO_JSON = 4
984    IMAGE = 5
985    VIDEO = 6
986    ANNOTATIONS = 7
987    CUSTOM_GEOMETRY = 8
988    CUSTOM_VECTOR = 9

The type of a style source.

See mln_style_source_type in the C API reference.

UNKNOWN = <StyleSourceType.UNKNOWN: 0>
VECTOR = <StyleSourceType.VECTOR: 1>
RASTER = <StyleSourceType.RASTER: 2>
RASTER_DEM = <StyleSourceType.RASTER_DEM: 3>
GEO_JSON = <StyleSourceType.GEO_JSON: 4>
IMAGE = <StyleSourceType.IMAGE: 5>
VIDEO = <StyleSourceType.VIDEO: 6>
ANNOTATIONS = <StyleSourceType.ANNOTATIONS: 7>
CUSTOM_GEOMETRY = <StyleSourceType.CUSTOM_GEOMETRY: 8>
CUSTOM_VECTOR = <StyleSourceType.CUSTOM_VECTOR: 9>
class StyleTileScheme(maplibre_native_ffi._enum.UnknownIntEnum):
 991class StyleTileScheme(UnknownIntEnum):
 992    """Whether a tileset counts tile rows from the north (XYZ) or the south
 993    (TMS).
 994
 995    See `mln_style_tile_scheme` in the
 996    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
 997    """
 998
 999    XYZ = 0
1000    TMS = 1

Whether a tileset counts tile rows from the north (XYZ) or the south (TMS).

See mln_style_tile_scheme in the C API reference.

XYZ = <StyleTileScheme.XYZ: 0>
TMS = <StyleTileScheme.TMS: 1>
@dataclass(frozen=True, slots=True)
class StyleTransitionOptions:
5175@dataclass(frozen=True, slots=True)
5176class StyleTransitionOptions:
5177    """The default
5178    \\[transition\\](https://maplibre.org/maplibre-style-spec/transition/) for
5179    changes to a style's paint properties.
5180
5181    See `mln_style_transition_options` in the
5182    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
5183    """
5184
5185    duration_ms: float | None = None
5186
5187    delay_ms: float | None = None
5188
5189    enable_placement_transitions: bool | None = None
5190    """Whether symbols fade in and out as the map places them."""
5191
5192    @classmethod
5193    def _from_native(cls, raw):
5194        return cls(
5195            duration_ms=raw["duration_ms"],
5196            delay_ms=raw["delay_ms"],
5197            enable_placement_transitions=raw["enable_placement_transitions"],
5198        )

The default [transition](https://maplibre.org/maplibre-style-spec/transition/) for changes to a style's paint properties.

See mln_style_transition_options in the C API reference.

StyleTransitionOptions( duration_ms: float | None = None, delay_ms: float | None = None, enable_placement_transitions: bool | None = None)
duration_ms: float | None
delay_ms: float | None
enable_placement_transitions: bool | None

Whether symbols fade in and out as the map places them.

class StyleVectorTileEncoding(maplibre_native_ffi._enum.UnknownIntEnum):
1003class StyleVectorTileEncoding(UnknownIntEnum):
1004    """The format of vector tiles.
1005
1006    See `mln_style_vector_tile_encoding` in the
1007    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/style_8h.html).
1008    """
1009
1010    MVT = 0
1011    MLT = 1

The format of vector tiles.

See mln_style_vector_tile_encoding in the C API reference.

@dataclass(frozen=True, slots=True)
class TextureImageInfo:
5201@dataclass(frozen=True, slots=True)
5202class TextureImageInfo:
5203    """The layout of the pixels that `RenderSessionHandle.read_texture()` reads.
5204
5205    See `mln_texture_image_info` in the
5206    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
5207    """
5208
5209    width: int
5210
5211    height: int
5212
5213    stride: int
5214    """The bytes from the start of one row to the start of the next."""
5215
5216    byte_length: int
5217
5218    @classmethod
5219    def _from_native(cls, raw):
5220        return cls(
5221            width=raw["width"],
5222            height=raw["height"],
5223            stride=raw["stride"],
5224            byte_length=raw["byte_length"],
5225        )

The layout of the pixels that RenderSessionHandle.read_texture() reads.

See mln_texture_image_info in the C API reference.

TextureImageInfo(width: int, height: int, stride: int, byte_length: int)
width: int
height: int
stride: int

The bytes from the start of one row to the start of the next.

byte_length: int
@dataclass(frozen=True, slots=True)
class TextureReadbackResult:
5228@dataclass(frozen=True, slots=True)
5229class TextureReadbackResult:
5230    """The pixels that `RenderSessionHandle.read_texture()` reads.
5231
5232    See `mln_texture_readback_result` in the
5233    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
5234    """
5235
5236    data: bytes
5237    """Premultiplied RGBA pixels with 8 bits per channel, in rows from top to
5238    bottom.
5239    """
5240
5241    info: TextureImageInfo
5242
5243    @classmethod
5244    def _from_native(cls, raw):
5245        return cls(data=raw["data"], info=TextureImageInfo._from_native(raw["info"]))

The pixels that RenderSessionHandle.read_texture() reads.

See mln_texture_readback_result in the C API reference.

TextureReadbackResult( data: bytes, info: TextureImageInfo)
data: bytes

Premultiplied RGBA pixels with 8 bits per channel, in rows from top to bottom.

@dataclass(frozen=True, slots=True)
class TileId:
5248@dataclass(frozen=True, slots=True)
5249class TileId:
5250    """The ID of a tile.
5251
5252    `canonical_x` and `canonical_y` place the tile in the source's grid at
5253    zoom `canonical_z`. `overscaled_z` is the zoom that the map draws the
5254    tile at, and is greater when the source has no tiles that deep. `wrap`
5255    says which copy of the world holds the tile: zero for the main one,
5256    negative to the west, and positive to the east.
5257
5258    See `mln_tile_id` in the
5259    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
5260    """
5261
5262    overscaled_z: int
5263
5264    wrap: int
5265
5266    canonical_z: int
5267
5268    canonical_x: int
5269
5270    canonical_y: int
5271
5272    @classmethod
5273    def _from_native(cls, raw):
5274        return cls(
5275            overscaled_z=raw["overscaled_z"],
5276            wrap=raw["wrap"],
5277            canonical_z=raw["canonical_z"],
5278            canonical_x=raw["canonical_x"],
5279            canonical_y=raw["canonical_y"],
5280        )

The ID of a tile.

canonical_x and canonical_y place the tile in the source's grid at zoom canonical_z. overscaled_z is the zoom that the map draws the tile at, and is greater when the source has no tiles that deep. wrap says which copy of the world holds the tile: zero for the main one, negative to the west, and positive to the east.

See mln_tile_id in the C API reference.

TileId( overscaled_z: int, wrap: int, canonical_z: int, canonical_x: int, canonical_y: int)
overscaled_z: int
wrap: int
canonical_z: int
canonical_x: int
canonical_y: int
class TileLodMode(maplibre_native_ffi._enum.UnknownIntEnum):
1014class TileLodMode(UnknownIntEnum):
1015    """How the map picks the level of detail of its tiles.
1016
1017    See `mln_tile_lod_mode` in the
1018    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1019    """
1020
1021    DEFAULT = 0
1022    DISTANCE = 1

How the map picks the level of detail of its tiles.

See mln_tile_lod_mode in the C API reference.

DEFAULT = <TileLodMode.DEFAULT: 0>
DISTANCE = <TileLodMode.DISTANCE: 1>
class TileOperation(maplibre_native_ffi._enum.UnknownIntEnum):
1025class TileOperation(UnknownIntEnum):
1026    """A step in loading a tile.
1027
1028    See `mln_tile_operation` in the
1029    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
1030    """
1031
1032    REQUESTED_FROM_CACHE = 0
1033    REQUESTED_FROM_NETWORK = 1
1034    LOAD_FROM_NETWORK = 2
1035    LOAD_FROM_CACHE = 3
1036    START_PARSE = 4
1037    END_PARSE = 5
1038    ERROR = 6
1039    CANCELLED = 7
1040    NULL = 8

A step in loading a tile.

See mln_tile_operation in the C API reference.

REQUESTED_FROM_CACHE = <TileOperation.REQUESTED_FROM_CACHE: 0>
REQUESTED_FROM_NETWORK = <TileOperation.REQUESTED_FROM_NETWORK: 1>
LOAD_FROM_NETWORK = <TileOperation.LOAD_FROM_NETWORK: 2>
LOAD_FROM_CACHE = <TileOperation.LOAD_FROM_CACHE: 3>
START_PARSE = <TileOperation.START_PARSE: 4>
END_PARSE = <TileOperation.END_PARSE: 5>
ERROR = <TileOperation.ERROR: 6>
CANCELLED = <TileOperation.CANCELLED: 7>
NULL = <TileOperation.NULL: 8>
@dataclass(frozen=True, slots=True)
class UnitBezier:
5283@dataclass(frozen=True, slots=True)
5284class UnitBezier:
5285    """A timing curve from (0, 0) to (1, 1), with the control points (`x1`,
5286    `y1`) and (`x2`, `y2`).
5287
5288    `x1` and `x2` are between 0 and 1.
5289
5290    See `mln_unit_bezier` in the
5291    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
5292    """
5293
5294    x1: float = 0.0
5295
5296    y1: float = 0.0
5297
5298    x2: float = 0.0
5299
5300    y2: float = 0.0
5301
5302    @classmethod
5303    def _from_native(cls, raw):
5304        return cls(x1=raw["x1"], y1=raw["y1"], x2=raw["x2"], y2=raw["y2"])

A timing curve from (0, 0) to (1, 1), with the control points (x1, y1) and (x2, y2).

x1 and x2 are between 0 and 1.

See mln_unit_bezier in the C API reference.

UnitBezier(x1: float = 0.0, y1: float = 0.0, x2: float = 0.0, y2: float = 0.0)
x1: float
y1: float
x2: float
y2: float
@dataclass(frozen=True, slots=True)
class UnknownVariant:
22@dataclass(frozen=True, slots=True)
23class UnknownVariant:
24    tag: int
25
26    @property
27    def _tag(self):
28        return self.tag
UnknownVariant(tag: int)
tag: int
class UrlMatchFlag(enum.IntFlag):
1043class UrlMatchFlag(IntFlag):
1044    """How a URL pattern matches a request's URL.
1045
1046    A pattern matches the whole URL, query included. Without flags, it
1047    matches only the URL that equals it exactly.
1048
1049    See `mln_url_match_flag` in the
1050    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
1051    """
1052
1053    GLOB = 1

How a URL pattern matches a request's URL.

A pattern matches the whole URL, query included. Without flags, it matches only the URL that equals it exactly.

See mln_url_match_flag in the C API reference.

GLOB = <UrlMatchFlag.GLOB: 1>
@dataclass(frozen=True, slots=True)
class UrlQueryParameter:
5307@dataclass(frozen=True, slots=True)
5308class UrlQueryParameter:
5309    """A query parameter that a resource transform rule adds to a URL.
5310
5311    Pass `name` and `value` unencoded. The library percent-encodes every byte
5312    of them except the letters, digits, `-`, `.`, `_`, and `~`, and adds them
5313    as `name=value`.
5314
5315    See `mln_url_query_parameter` in the
5316    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
5317    """
5318
5319    name: str
5320
5321    value: str = ""
5322
5323    @classmethod
5324    def _from_native(cls, raw):
5325        return cls(name=raw["name"], value=raw["value"])

A query parameter that a resource transform rule adds to a URL.

Pass name and value unencoded. The library percent-encodes every byte of them except the letters, digits, -, ., _, and ~, and adds them as name=value.

See mln_url_query_parameter in the C API reference.

UrlQueryParameter(name: str, value: str = '')
name: str
value: str
@dataclass(frozen=True, slots=True)
class Vec3:
5328@dataclass(frozen=True, slots=True)
5329class Vec3:
5330    """A vector in three dimensions.
5331
5332    See `mln_vec3` in the
5333    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
5334    """
5335
5336    x: float = 0.0
5337
5338    y: float = 0.0
5339
5340    z: float = 0.0
5341
5342    @classmethod
5343    def _from_native(cls, raw):
5344        return cls(x=raw["x"], y=raw["y"], z=raw["z"])

A vector in three dimensions.

See mln_vec3 in the C API reference.

Vec3(x: float = 0.0, y: float = 0.0, z: float = 0.0)
x: float
y: float
z: float
class ViewportMode(maplibre_native_ffi._enum.UnknownIntEnum):
1056class ViewportMode(UnknownIntEnum):
1057    """The vertical direction of the image that the map renders.
1058
1059    See `mln_viewport_mode` in the
1060    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/map_8h.html).
1061    """
1062
1063    DEFAULT = 0
1064    FLIPPED_Y = 1

The vertical direction of the image that the map renders.

See mln_viewport_mode in the C API reference.

DEFAULT = <ViewportMode.DEFAULT: 0>
FLIPPED_Y = <ViewportMode.FLIPPED_Y: 1>
@dataclass(frozen=True, slots=True)
class VulkanBorrowedTexture:
5347@dataclass(frozen=True, slots=True)
5348class VulkanBorrowedTexture:
5349    """A Vulkan image of a borrowed ring.
5350
5351    See `mln_vulkan_borrowed_texture` in the
5352    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
5353    """
5354
5355    image: int
5356    """Your VkImage."""
5357
5358    image_view: int
5359    """A 2D VkImageView of `image` with one mip level and one layer."""
5360
5361    @classmethod
5362    def _from_native(cls, raw):
5363        return cls(image=raw["image"], image_view=raw["image_view"])

A Vulkan image of a borrowed ring.

See mln_vulkan_borrowed_texture in the C API reference.

VulkanBorrowedTexture(image: int, image_view: int)
image: int

Your VkImage.

image_view: int

A 2D VkImageView of image with one mip level and one layer.

@dataclass(frozen=True, slots=True)
class VulkanBorrowedTextureDescriptor:
5366@dataclass(frozen=True, slots=True)
5367class VulkanBorrowedTextureDescriptor:
5368    """A ring of your Vulkan images, for
5369    `MapHandle.attach_vulkan_borrowed_texture()`.
5370
5371    `logical_size` sets the map's size. `physical_width` and
5372    `physical_height` give the images' size in pixels, which is usually
5373    `logical_size` times the map's scale factor. Each image must have that
5374    size, `format`, and VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, and belong to
5375    the context's device. The ring holds up to `TEXTURE_RING_MAX_DEPTH`
5376    distinct images.
5377
5378    The session uses the images until a replacement or release of the target
5379    completes, a detach or release of the session completes, or an abandon of
5380    it returns.
5381
5382    See `mln_vulkan_borrowed_texture_descriptor` in the
5383    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
5384    """
5385
5386    logical_size: LogicalSize
5387
5388    physical_width: int
5389
5390    physical_height: int
5391
5392    context: VulkanContextDescriptor
5393
5394    textures: Sequence[VulkanBorrowedTexture]
5395
5396    format: int
5397    """The images' VkFormat."""
5398
5399    final_layout: int
5400    """The VkImageLayout that each frame leaves its image in."""
5401
5402    owner: VulkanImageOwner = VulkanImageOwner.GRAPHICS_QUEUE
5403
5404    def __post_init__(self):
5405        object.__setattr__(self, "textures", _sequence(self.textures))
5406
5407    @classmethod
5408    def _from_native(cls, raw):
5409        return cls(
5410            logical_size=LogicalSize._from_native(raw["logical_size"]),
5411            physical_width=raw["physical_width"],
5412            physical_height=raw["physical_height"],
5413            context=VulkanContextDescriptor._from_native(raw["context"]),
5414            textures=tuple(
5415                VulkanBorrowedTexture._from_native(item) for item in raw["textures"]
5416            ),
5417            format=raw["format"],
5418            final_layout=raw["final_layout"],
5419            owner=VulkanImageOwner(raw["owner"]),
5420        )

A ring of your Vulkan images, for MapHandle.attach_vulkan_borrowed_texture().

logical_size sets the map's size. physical_width and physical_height give the images' size in pixels, which is usually logical_size times the map's scale factor. Each image must have that size, format, and VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, and belong to the context's device. The ring holds up to TEXTURE_RING_MAX_DEPTH distinct images.

The session uses the images until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.

See mln_vulkan_borrowed_texture_descriptor in the C API reference.

VulkanBorrowedTextureDescriptor( logical_size: LogicalSize, physical_width: int, physical_height: int, context: VulkanContextDescriptor, textures: Sequence[VulkanBorrowedTexture], format: int, final_layout: int, owner: VulkanImageOwner = <VulkanImageOwner.GRAPHICS_QUEUE: 0>)
logical_size: LogicalSize
physical_width: int
physical_height: int
textures: Sequence[VulkanBorrowedTexture]
format: int

The images' VkFormat.

final_layout: int

The VkImageLayout that each frame leaves its image in.

@dataclass(frozen=True, slots=True)
class VulkanBorrowedTextureReplacement:
5423@dataclass(frozen=True, slots=True)
5424class VulkanBorrowedTextureReplacement:
5425    """New Vulkan images for a borrowed ring, for
5426    `RenderSessionHandle.set_vulkan_borrowed_texture_target()`.
5427
5428    The members and the images follow the rules of
5429    `VulkanBorrowedTextureDescriptor`. The ring keeps its depth, context,
5430    `format`, `final_layout`, and `owner`, so give it as many images as it
5431    attached with, in that format, on the same device.
5432
5433    See `mln_vulkan_borrowed_texture_replacement` in the
5434    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
5435    """
5436
5437    logical_size: LogicalSize
5438
5439    physical_width: int
5440
5441    physical_height: int
5442
5443    textures: Sequence[VulkanBorrowedTexture]
5444
5445    def __post_init__(self):
5446        object.__setattr__(self, "textures", _sequence(self.textures))
5447
5448    @classmethod
5449    def _from_native(cls, raw):
5450        return cls(
5451            logical_size=LogicalSize._from_native(raw["logical_size"]),
5452            physical_width=raw["physical_width"],
5453            physical_height=raw["physical_height"],
5454            textures=tuple(
5455                VulkanBorrowedTexture._from_native(item) for item in raw["textures"]
5456            ),
5457        )

New Vulkan images for a borrowed ring, for RenderSessionHandle.set_vulkan_borrowed_texture_target().

The members and the images follow the rules of VulkanBorrowedTextureDescriptor. The ring keeps its depth, context, format, final_layout, and owner, so give it as many images as it attached with, in that format, on the same device.

See mln_vulkan_borrowed_texture_replacement in the C API reference.

VulkanBorrowedTextureReplacement( logical_size: LogicalSize, physical_width: int, physical_height: int, textures: Sequence[VulkanBorrowedTexture])
logical_size: LogicalSize
physical_width: int
physical_height: int
textures: Sequence[VulkanBorrowedTexture]
@dataclass(frozen=True, slots=True)
class VulkanContextDescriptor:
5460@dataclass(frozen=True, slots=True)
5461class VulkanContextDescriptor:
5462    """The Vulkan device and queue that a render session uses.
5463
5464    Keep these objects alive until a detach or release of the session
5465    completes, or an abandon of it returns.
5466
5467    See `mln_vulkan_context_descriptor` in the
5468    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html).
5469    """
5470
5471    instance: int
5472    """A `VkInstance`."""
5473
5474    physical_device: int
5475    """A `VkPhysicalDevice`."""
5476
5477    device: int
5478    """A `VkDevice`."""
5479
5480    graphics_queue: int
5481    """A `VkQueue` from `graphics_queue_family_index` that supports graphics. If
5482    you submit to it too, set `RenderSessionAttachOptions.queue_lock`.
5483    """
5484
5485    graphics_queue_family_index: int = 0
5486
5487    get_instance_proc_addr: int = 0
5488    """Your `vkGetInstanceProcAddr`, or null to use the Vulkan loader's."""
5489
5490    get_device_proc_addr: int = 0
5491    """Your `vkGetDeviceProcAddr`, or null to look it up from the instance."""
5492
5493    @classmethod
5494    def _from_native(cls, raw):
5495        return cls(
5496            instance=raw["instance"],
5497            physical_device=raw["physical_device"],
5498            device=raw["device"],
5499            graphics_queue=raw["graphics_queue"],
5500            graphics_queue_family_index=raw["graphics_queue_family_index"],
5501            get_instance_proc_addr=raw["get_instance_proc_addr"],
5502            get_device_proc_addr=raw["get_device_proc_addr"],
5503        )

The Vulkan device and queue that a render session uses.

Keep these objects alive until a detach or release of the session completes, or an abandon of it returns.

See mln_vulkan_context_descriptor in the C API reference.

VulkanContextDescriptor( instance: int, physical_device: int, device: int, graphics_queue: int, graphics_queue_family_index: int = 0, get_instance_proc_addr: int = 0, get_device_proc_addr: int = 0)
instance: int

A VkInstance.

physical_device: int

A VkPhysicalDevice.

device: int

A VkDevice.

graphics_queue: int

A VkQueue from graphics_queue_family_index that supports graphics. If you submit to it too, set RenderSessionAttachOptions.queue_lock.

graphics_queue_family_index: int
get_instance_proc_addr: int

Your vkGetInstanceProcAddr, or null to use the Vulkan loader's.

get_device_proc_addr: int

Your vkGetDeviceProcAddr, or null to look it up from the instance.

@dataclass(frozen=True, slots=True)
class VulkanDeviceContextResult:
5506@dataclass(frozen=True, slots=True)
5507class VulkanDeviceContextResult:
5508    """A Vulkan device's context, as `VulkanDeviceHandle.get_context()` reports
5509    it.
5510
5511    See `mln_vulkan_device_context_result` in the
5512    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/vulkan_8h.html).
5513    """
5514
5515    context: VulkanContextDescriptor
5516
5517    @classmethod
5518    def _from_native(cls, raw):
5519        return cls(context=VulkanContextDescriptor._from_native(raw["context"]))

A Vulkan device's context, as VulkanDeviceHandle.get_context() reports it.

See mln_vulkan_device_context_result in the C API reference.

VulkanDeviceContextResult( context: VulkanContextDescriptor)
class VulkanDeviceHandle(maplibre_native_ffi._generated_operations._VulkanDeviceHandleOperations, maplibre_native_ffi._lifecycle.ScopedHandleMixin):

A Vulkan instance, device, and queue that the library creates and owns.

See mln_vulkan_device in the C API reference.

@classmethod
def create( cls, options: VulkanDeviceOptions | None = None) -> VulkanDeviceHandle:
3384    @classmethod
3385    def create(cls, options: VulkanDeviceOptions | None = None) -> VulkanDeviceHandle:
3386        """Creates a Vulkan instance, device, and graphics queue for render
3387        sessions.
3388
3389        Attach sessions with the context from
3390        `VulkanDeviceHandle.get_context()`, in place of a device of your own.
3391        Without `device_uuid` or `device_luid`, it prefers a discrete GPU.
3392        The device enables the external memory and semaphore extensions that
3393        the GPU offers.
3394
3395        See `mln_vulkan_device_create` in the
3396        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/vulkan_8h.html).
3397
3398        Errors:
3399
3400        - `Status.UNSUPPORTED` when `supported_render_backend_mask()` lacks
3401          `RenderBackendFlag.VULKAN`, or when `presentation` is true and the
3402          Vulkan loader or the GPU can't present.
3403        - `Status.NOT_FOUND` when no GPU matches `device_uuid` and
3404          `device_luid`.
3405        - `Status.NATIVE_ERROR` when there is no Vulkan loader, no GPU has a
3406          graphics queue, or Vulkan can't create the instance or the device.
3407        """
3408        return _adopt_value(
3409            _native._VulkanDeviceHandle.create(options), "VulkanDeviceHandle", None
3410        )

Creates a Vulkan instance, device, and graphics queue for render sessions.

Attach sessions with the context from VulkanDeviceHandle.get_context(), in place of a device of your own. Without device_uuid or device_luid, it prefers a discrete GPU. The device enables the external memory and semaphore extensions that the GPU offers.

See mln_vulkan_device_create in the C API reference.

Errors:

def get_context(self) -> VulkanDeviceContextResult:
3412    def get_context(self) -> VulkanDeviceContextResult:
3413        """Gets the context to attach render sessions to the device with.
3414
3415        Pass it as the context of `MapHandle.attach_vulkan_surface()` or
3416        `MapHandle.attach_vulkan_borrowed_texture()`. The sessions on the
3417        device share its graphics queue. To submit to the queue yourself, set
3418        `RenderSessionAttachOptions.queue_lock` on each session.
3419
3420        See `mln_vulkan_device_get_context` in the
3421        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/vulkan_8h.html).
3422        """
3423        return VulkanDeviceContextResult._from_native(self._native.get_context())

Gets the context to attach render sessions to the device with.

Pass it as the context of MapHandle.attach_vulkan_surface() or MapHandle.attach_vulkan_borrowed_texture(). The sessions on the device share its graphics queue. To submit to the queue yourself, set RenderSessionAttachOptions.queue_lock on each session.

See mln_vulkan_device_get_context in the C API reference.

def release(self) -> None:
3425    def release(self) -> None:
3426        """Releases a Vulkan device.
3427
3428        Render sessions that attached with the device's context keep using it
3429        until they detach or their release finishes.
3430
3431        See `mln_vulkan_device_release` in the
3432        [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/vulkan_8h.html).
3433        """
3434        return self._native.release()

Releases a Vulkan device.

Render sessions that attached with the device's context keep using it until they detach or their release finishes.

See mln_vulkan_device_release in the C API reference.

id: int
367    @property
368    def id(self) -> int:
369        """The native handle value. It stays readable after release."""
370        return int(self._native.id)

The native handle value. It stays readable after release.

@dataclass(frozen=True, slots=True)
class VulkanDeviceOptions:
5522@dataclass(frozen=True, slots=True)
5523class VulkanDeviceOptions:
5524    """Options for `VulkanDeviceHandle.create()`.
5525
5526    See `mln_vulkan_device_options` in the
5527    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/vulkan_8h.html).
5528    """
5529
5530    presentation: bool | None = None
5531    """Whether the device can present to a window. The instance then enables
5532    VK_KHR_surface and the platform's surface extensions, and the device
5533    enables VK_KHR_swapchain. Defaults to false.
5534    """
5535
5536    device_uuid: Buffer | None = None
5537    """The 16-byte `deviceUUID` of the GPU to use, as
5538    `VkPhysicalDeviceIDProperties` reports it.
5539    """
5540
5541    device_luid: Buffer | None = None
5542    """The 8-byte `deviceLUID` of the GPU to use, as
5543    `VkPhysicalDeviceIDProperties` reports it. On Windows, this is the GPU's
5544    DXGI adapter LUID.
5545    """
5546
5547    def __post_init__(self):
5548        object.__setattr__(self, "device_uuid", _bytes(self.device_uuid))
5549        object.__setattr__(self, "device_luid", _bytes(self.device_luid))
5550
5551    @classmethod
5552    def _from_native(cls, raw):
5553        return cls(
5554            presentation=raw["presentation"],
5555            device_uuid=raw["device_uuid"],
5556            device_luid=raw["device_luid"],
5557        )

Options for VulkanDeviceHandle.create().

See mln_vulkan_device_options in the C API reference.

VulkanDeviceOptions( presentation: bool | None = None, device_uuid: Buffer | None = None, device_luid: Buffer | None = None)
presentation: bool | None

Whether the device can present to a window. The instance then enables VK_KHR_surface and the platform's surface extensions, and the device enables VK_KHR_swapchain. Defaults to false.

device_uuid: Buffer | None

The 16-byte deviceUUID of the GPU to use, as VkPhysicalDeviceIDProperties reports it.

device_luid: Buffer | None

The 8-byte deviceLUID of the GPU to use, as VkPhysicalDeviceIDProperties reports it. On Windows, this is the GPU's DXGI adapter LUID.

class VulkanImageOwner(maplibre_native_ffi._enum.UnknownIntEnum):
1067class VulkanImageOwner(UnknownIntEnum):
1068    """The queue family that a borrowed image goes to after each frame.
1069
1070    With `VulkanImageOwner.EXTERNAL` or `VulkanImageOwner.FOREIGN`, acquire
1071    the image on your side before you read it. You don't need to release it
1072    back.
1073
1074    See `mln_vulkan_image_owner` in the
1075    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
1076    """
1077
1078    GRAPHICS_QUEUE = 0
1079    EXTERNAL = 1
1080    FOREIGN = 2

The queue family that a borrowed image goes to after each frame.

With VulkanImageOwner.EXTERNAL or VulkanImageOwner.FOREIGN, acquire the image on your side before you read it. You don't need to release it back.

See mln_vulkan_image_owner in the C API reference.

GRAPHICS_QUEUE = <VulkanImageOwner.GRAPHICS_QUEUE: 0>
EXTERNAL = <VulkanImageOwner.EXTERNAL: 1>
FOREIGN = <VulkanImageOwner.FOREIGN: 2>
@dataclass(frozen=True, slots=True)
class VulkanSurfaceDescriptor:
5560@dataclass(frozen=True, slots=True)
5561class VulkanSurfaceDescriptor:
5562    """A Vulkan surface to present to, for `MapHandle.attach_vulkan_surface()`.
5563
5564    The device must have VK_KHR_swapchain enabled, and the queue family of
5565    `graphics_queue_family_index` must support presenting to the surface. The
5566    session creates the swapchain. It uses the surface until a replacement or
5567    release of the target completes, a detach or release of the session
5568    completes, or an abandon of it returns.
5569
5570    See `mln_vulkan_surface_descriptor` in the
5571    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html).
5572    """
5573
5574    logical_size: LogicalSize
5575
5576    context: VulkanContextDescriptor
5577
5578    surface: int
5579    """Your VkSurfaceKHR."""
5580
5581    @classmethod
5582    def _from_native(cls, raw):
5583        return cls(
5584            logical_size=LogicalSize._from_native(raw["logical_size"]),
5585            context=VulkanContextDescriptor._from_native(raw["context"]),
5586            surface=raw["surface"],
5587        )

A Vulkan surface to present to, for MapHandle.attach_vulkan_surface().

The device must have VK_KHR_swapchain enabled, and the queue family of graphics_queue_family_index must support presenting to the surface. The session creates the swapchain. It uses the surface until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.

See mln_vulkan_surface_descriptor in the C API reference.

VulkanSurfaceDescriptor( logical_size: LogicalSize, context: VulkanContextDescriptor, surface: int)
logical_size: LogicalSize
surface: int

Your VkSurfaceKHR.

@dataclass(frozen=True, slots=True)
class VulkanSurfaceReplacement:
5590@dataclass(frozen=True, slots=True)
5591class VulkanSurfaceReplacement:
5592    """A new Vulkan surface for
5593    `RenderSessionHandle.set_vulkan_surface_target()`.
5594
5595    The session presents to it with the context that it attached with, so the
5596    queue family of that context's `graphics_queue_family_index` must support
5597    presenting to the surface. It uses the surface until a replacement or
5598    release of the target completes, a detach or release of the session
5599    completes, or an abandon of it returns.
5600
5601    See `mln_vulkan_surface_replacement` in the
5602    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/surface_8h.html).
5603    """
5604
5605    logical_size: LogicalSize
5606
5607    surface: int
5608    """Your VkSurfaceKHR."""
5609
5610    @classmethod
5611    def _from_native(cls, raw):
5612        return cls(
5613            logical_size=LogicalSize._from_native(raw["logical_size"]),
5614            surface=raw["surface"],
5615        )

A new Vulkan surface for RenderSessionHandle.set_vulkan_surface_target().

The session presents to it with the context that it attached with, so the queue family of that context's graphics_queue_family_index must support presenting to the surface. It uses the surface until a replacement or release of the target completes, a detach or release of the session completes, or an abandon of it returns.

See mln_vulkan_surface_replacement in the C API reference.

VulkanSurfaceReplacement( logical_size: LogicalSize, surface: int)
logical_size: LogicalSize
surface: int

Your VkSurfaceKHR.

@dataclass(frozen=True, slots=True)
class VulkanTextureFrame:
5618@dataclass(frozen=True, slots=True)
5619class VulkanTextureFrame:
5620    """The Vulkan image of an acquired frame.
5621
5622    See `mln_vulkan_texture_frame` in the
5623    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/texture_8h.html).
5624    """
5625
5626    width: int
5627
5628    height: int
5629
5630    scale_factor: float
5631
5632    slot: int
5633    """The image's index in the descriptor's `textures`."""
5634
5635    image: int
5636    """The VkImage."""
5637
5638    image_view: int
5639    """The VkImageView."""
5640
5641    device: int
5642    """The image's VkDevice."""
5643
5644    format: int
5645    """The image's VkFormat."""
5646
5647    layout: int
5648    """The VkImageLayout that the frame left the image in."""
5649
5650    @classmethod
5651    def _from_native(cls, raw):
5652        return cls(
5653            width=raw["width"],
5654            height=raw["height"],
5655            scale_factor=raw["scale_factor"],
5656            slot=raw["slot"],
5657            image=raw["image"],
5658            image_view=raw["image_view"],
5659            device=raw["device"],
5660            format=raw["format"],
5661            layout=raw["layout"],
5662        )

The Vulkan image of an acquired frame.

See mln_vulkan_texture_frame in the C API reference.

VulkanTextureFrame( width: int, height: int, scale_factor: float, slot: int, image: int, image_view: int, device: int, format: int, layout: int)
width: int
height: int
scale_factor: float
slot: int

The image's index in the descriptor's textures.

image: int

The VkImage.

image_view: int

The VkImageView.

device: int

The image's VkDevice.

format: int

The image's VkFormat.

layout: int

The VkImageLayout that the frame left the image in.

@dataclass(frozen=True, slots=True)
class Wake:
5665@dataclass(frozen=True, slots=True)
5666class Wake:
5667    """A callback that tells the caller when work is ready.
5668
5669    The callback runs on the binding's dispatcher thread, after native queues
5670    the call.
5671
5672    See `mln_wake` in the
5673    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/wake_8h.html).
5674    """
5675
5676    callback: WakeCallback | None = None
5677
5678    def _invoke_callback(self):
5679        callback = self.callback
5680        assert callback is not None
5681        return callback()
5682
5683    @classmethod
5684    def native(
5685        cls, callback: int, user_data: int = 0, release_user_data: int = 0
5686    ) -> NativeWake:
5687        """A native registration, whose function pointers, context, and release
5688        the host's native code supplies as addresses. Zero is null. The
5689        binding copies each address unchanged, and native code validates
5690        them.
5691        """
5692        from . import _native
5693
5694        return NativeWake._from_registration(
5695            _native._NativeRegistration(
5696                "mln_wake", (callback,), user_data, release_user_data
5697            )
5698        )

A callback that tells the caller when work is ready.

The callback runs on the binding's dispatcher thread, after native queues the call.

See mln_wake in the C API reference.

Wake( callback: WakeCallback | None = None)
callback: WakeCallback | None
@classmethod
def native( cls, callback: int, user_data: int = 0, release_user_data: int = 0) -> NativeWake:
5683    @classmethod
5684    def native(
5685        cls, callback: int, user_data: int = 0, release_user_data: int = 0
5686    ) -> NativeWake:
5687        """A native registration, whose function pointers, context, and release
5688        the host's native code supplies as addresses. Zero is null. The
5689        binding copies each address unchanged, and native code validates
5690        them.
5691        """
5692        from . import _native
5693
5694        return NativeWake._from_registration(
5695            _native._NativeRegistration(
5696                "mln_wake", (callback,), user_data, release_user_data
5697            )
5698        )

A native registration, whose function pointers, context, and release the host's native code supplies as addresses. Zero is null. The binding copies each address unchanged, and native code validates them.

class WakeCallback(typing.Protocol):
5979class WakeCallback(Protocol):
5980    """Tells the caller that work is ready for it.
5981
5982    One call can stand for several pieces of ready work, so take all of it
5983    each time.
5984
5985    The callback runs on the binding's dispatcher thread, after native queues
5986    the call.
5987
5988    See `mln_wake_callback` in the
5989    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/wake_8h.html).
5990    """
5991
5992    def __call__(self, /) -> None: ...

Tells the caller that work is ready for it.

One call can stand for several pieces of ready work, so take all of it each time.

The callback runs on the binding's dispatcher thread, after native queues the call.

See mln_wake_callback in the C API reference.

WakeCallback(*args, **kwargs)
1903def _no_init_or_replace_init(self, *args, **kwargs):
1904    cls = type(self)
1905
1906    if cls._is_protocol:
1907        raise TypeError('Protocols cannot be instantiated')
1908
1909    # Already using a custom `__init__`. No need to calculate correct
1910    # `__init__` to call. This can lead to RecursionError. See bpo-45121.
1911    if cls.__init__ is not _no_init_or_replace_init:
1912        return
1913
1914    # Initially, `__init__` of a protocol subclass is set to `_no_init_or_replace_init`.
1915    # The first instantiation of the subclass will call `_no_init_or_replace_init` which
1916    # searches for a proper new `__init__` in the MRO. The new `__init__`
1917    # replaces the subclass' old `__init__` (ie `_no_init_or_replace_init`). Subsequent
1918    # instantiation of the protocol subclass will thus use the new
1919    # `__init__` and no longer call `_no_init_or_replace_init`.
1920    for base in cls.__mro__:
1921        init = base.__dict__.get('__init__', _no_init_or_replace_init)
1922        if init is not _no_init_or_replace_init:
1923            cls.__init__ = init
1924            break
1925    else:
1926        # should not happen
1927        cls.__init__ = object.__init__
1928
1929    cls.__init__(self, *args, **kwargs)
@dataclass(frozen=True, slots=True)
class WaylandSurfaceDescriptor:
5722@dataclass(frozen=True, slots=True)
5723class WaylandSurfaceDescriptor:
5724    """A Wayland surface to present to, for
5725    `MapHandle.attach_wayland_surface()`.
5726
5727    See `mln_wayland_surface_descriptor` in the
5728    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/wayland_8h.html).
5729    """
5730
5731    logical_size: LogicalSize
5732
5733    display: int
5734    """Your `wl_display*`."""
5735
5736    surface: int
5737    """Your `wl_surface*`, on `display`."""
5738
5739    @classmethod
5740    def _from_native(cls, raw):
5741        return cls(
5742            logical_size=LogicalSize._from_native(raw["logical_size"]),
5743            display=raw["display"],
5744            surface=raw["surface"],
5745        )

A Wayland surface to present to, for MapHandle.attach_wayland_surface().

See mln_wayland_surface_descriptor in the C API reference.

WaylandSurfaceDescriptor( logical_size: LogicalSize, display: int, surface: int)
logical_size: LogicalSize
display: int

Your wl_display*.

surface: int

Your wl_surface*, on display.

@dataclass(frozen=True, slots=True)
class WaylandSurfaceReplacement:
5748@dataclass(frozen=True, slots=True)
5749class WaylandSurfaceReplacement:
5750    """A new Wayland surface for
5751    `RenderSessionHandle.set_wayland_surface_target()`.
5752
5753    See `mln_wayland_surface_replacement` in the
5754    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/wayland_8h.html).
5755    """
5756
5757    logical_size: LogicalSize
5758
5759    surface: int
5760    """Your `wl_surface*`, on the display that the session attached with."""
5761
5762    @classmethod
5763    def _from_native(cls, raw):
5764        return cls(
5765            logical_size=LogicalSize._from_native(raw["logical_size"]),
5766            surface=raw["surface"],
5767        )

A new Wayland surface for RenderSessionHandle.set_wayland_surface_target().

See mln_wayland_surface_replacement in the C API reference.

WaylandSurfaceReplacement( logical_size: LogicalSize, surface: int)
logical_size: LogicalSize
surface: int

Your wl_surface*, on the display that the session attached with.

@dataclass(frozen=True, slots=True)
class WebGlContextDescriptor:
5770@dataclass(frozen=True, slots=True)
5771class WebGlContextDescriptor:
5772    """The WebGL context or canvas that a render session uses.
5773
5774    See `mln_web_gl_context_descriptor` in the
5775    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html).
5776    """
5777
5778    kind: WebGlContextKind = WebGlContextKind.EXISTING
5779
5780    context: int = 0
5781    """Your `EMSCRIPTEN_WEBGL_CONTEXT_HANDLE`, for an existing context."""
5782
5783    canvas_selector: str = ""
5784    """The canvas's CSS selector, for a transferred canvas."""
5785
5786    @classmethod
5787    def _from_native(cls, raw):
5788        return cls(
5789            kind=WebGlContextKind(raw["kind"]),
5790            context=raw["context"],
5791            canvas_selector=raw["canvas_selector"],
5792        )

The WebGL context or canvas that a render session uses.

See mln_web_gl_context_descriptor in the C API reference.

WebGlContextDescriptor( kind: WebGlContextKind = <WebGlContextKind.EXISTING: 0>, context: int = 0, canvas_selector: str = '')
context: int

Your EMSCRIPTEN_WEBGL_CONTEXT_HANDLE, for an existing context.

canvas_selector: str

The canvas's CSS selector, for a transferred canvas.

class WebGlContextKind(maplibre_native_ffi._enum.UnknownIntEnum):
1083class WebGlContextKind(UnknownIntEnum):
1084    """How a render session gets its WebGL context.
1085
1086    See `mln_web_gl_context_kind` in the
1087    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html).
1088    """
1089
1090    EXISTING = 0
1091    TRANSFERRED_CANVAS = 1

How a render session gets its WebGL context.

See mln_web_gl_context_kind in the C API reference.

EXISTING = <WebGlContextKind.EXISTING: 0>
TRANSFERRED_CANVAS = <WebGlContextKind.TRANSFERRED_CANVAS: 1>
@dataclass(frozen=True, slots=True)
class WglContextDescriptor:
5795@dataclass(frozen=True, slots=True)
5796class WglContextDescriptor:
5797    """The WGL objects that a render session makes its OpenGL context from.
5798
5799    See `mln_wgl_context_descriptor` in the
5800    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html).
5801    """
5802
5803    device_context: int
5804    """An `HDC`."""
5805
5806    share_context: int = 0
5807    """Your `HGLRC`, for a shared context."""
5808
5809    get_proc_address: int = 0
5810    """Your `wglGetProcAddress`, or null to use the system's."""
5811
5812    @classmethod
5813    def _from_native(cls, raw):
5814        return cls(
5815            device_context=raw["device_context"],
5816            share_context=raw["share_context"],
5817            get_proc_address=raw["get_proc_address"],
5818        )

The WGL objects that a render session makes its OpenGL context from.

See mln_wgl_context_descriptor in the C API reference.

WglContextDescriptor( device_context: int, share_context: int = 0, get_proc_address: int = 0)
device_context: int

An HDC.

share_context: int

Your HGLRC, for a shared context.

get_proc_address: int

Your wglGetProcAddress, or null to use the system's.

@dataclass(frozen=True, slots=True)
class Win32WindowDescriptor:
5821@dataclass(frozen=True, slots=True)
5822class Win32WindowDescriptor:
5823    """A Win32 window to present to, for `MapHandle.attach_win32_window()`.
5824
5825    See `mln_win32_window_descriptor` in the
5826    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/win32_8h.html).
5827    """
5828
5829    logical_size: LogicalSize
5830
5831    window: int
5832    """Your `HWND`."""
5833
5834    @classmethod
5835    def _from_native(cls, raw):
5836        return cls(
5837            logical_size=LogicalSize._from_native(raw["logical_size"]),
5838            window=raw["window"],
5839        )

A Win32 window to present to, for MapHandle.attach_win32_window().

See mln_win32_window_descriptor in the C API reference.

Win32WindowDescriptor( logical_size: LogicalSize, window: int)
logical_size: LogicalSize
window: int

Your HWND.

@dataclass(frozen=True, slots=True)
class Win32WindowReplacement:
5842@dataclass(frozen=True, slots=True)
5843class Win32WindowReplacement:
5844    """A new Win32 window for `RenderSessionHandle.set_win32_window_target()`.
5845
5846    See `mln_win32_window_replacement` in the
5847    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/win32_8h.html).
5848    """
5849
5850    logical_size: LogicalSize
5851
5852    window: int
5853    """Your `HWND`."""
5854
5855    @classmethod
5856    def _from_native(cls, raw):
5857        return cls(
5858            logical_size=LogicalSize._from_native(raw["logical_size"]),
5859            window=raw["window"],
5860        )

A new Win32 window for RenderSessionHandle.set_win32_window_target().

See mln_win32_window_replacement in the C API reference.

Win32WindowReplacement( logical_size: LogicalSize, window: int)
logical_size: LogicalSize
window: int

Your HWND.

def android_frame_pacer_create( options: FramePacerOptions | None = None) -> FramePacerHandle:
3437def android_frame_pacer_create(
3438    options: FramePacerOptions | None = None,
3439) -> FramePacerHandle:
3440    """Creates a frame pacer that follows the display through the calling
3441    thread's `AChoreographer`.
3442
3443    Call it on a thread with an `ALooper`, such as the app's main thread,
3444    and keep that thread running its looper while sessions use the pacer.
3445
3446    See `mln_android_frame_pacer_create` in the
3447    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/android_8h.html).
3448
3449    Errors:
3450
3451    - `Status.INVALID_STATE` when the calling thread has no `ALooper`.
3452    """
3453    return _adopt_value(
3454        _native.android_frame_pacer_create(options), "FramePacerHandle", None
3455    )

Creates a frame pacer that follows the display through the calling thread's AChoreographer.

Call it on a thread with an ALooper, such as the app's main thread, and keep that thread running its looper while sessions use the pacer.

See mln_android_frame_pacer_create in the C API reference.

Errors:

def apple_frame_pacer_create( options: FramePacerOptions | None = None) -> FramePacerHandle:
3472def apple_frame_pacer_create(
3473    options: FramePacerOptions | None = None,
3474) -> FramePacerHandle:
3475    """Creates a frame pacer that follows the display through a
3476    `CADisplayLink`.
3477
3478    You can call it on any thread. The pacer needs no run loop of yours.
3479    On macOS, it follows the main display, the one with the menu bar.
3480
3481    With `FramePacerOptions.maximum_frames_per_second`, the pacer also
3482    asks the system for that refresh rate. On iPhone, a rate above 60
3483    needs `CADisableMinimumFrameDurationOnPhone` in the app's
3484    `Info.plist`.
3485
3486    See `mln_apple_frame_pacer_create` in the
3487    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/apple_8h.html).
3488
3489    Errors:
3490
3491    - `Status.NATIVE_ERROR` when the system has no display to follow.
3492    """
3493    return _adopt_value(
3494        _native.apple_frame_pacer_create(options), "FramePacerHandle", None
3495    )

Creates a frame pacer that follows the display through a CADisplayLink.

You can call it on any thread. The pacer needs no run loop of yours. On macOS, it follows the main display, the one with the menu bar.

With FramePacerOptions.maximum_frames_per_second, the pacer also asks the system for that refresh rate. On iPhone, a rate above 60 needs CADisableMinimumFrameDurationOnPhone in the app's Info.plist.

See mln_apple_frame_pacer_create in the C API reference.

Errors:

def c_version() -> int:
3498def c_version() -> int:
3499    """Returns the API epoch of the library.
3500
3501    Headers and a library with different epochs aren't compatible.
3502
3503    See `mln_c_version` in the
3504    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/base_8h.html).
3505    """
3506    return _native.c_version()

Returns the API epoch of the library.

Headers and a library with different epochs aren't compatible.

See mln_c_version in the C API reference.

def camera_for_tile( tile: CanonicalTileId, logical_size: LogicalSize) -> CameraOptions:
3509def camera_for_tile(tile: CanonicalTileId, logical_size: LogicalSize) -> CameraOptions:
3510    """Computes the camera that shows exactly one tile on a square map.
3511
3512    Jump a map in `MapMode.TILE` to the camera to render `tile`, where
3513    `logical_size` is the map's size. The camera centers the tile, zooms
3514    until the tile fills the map, and looks straight down with north up
3515    and no padding. The map keeps its camera within its zoom limits, so
3516    for a deep tile, raise the maximum zoom past the camera's with
3517    `MapHandle.set_bounds()`.
3518
3519    See `mln_camera_for_tile` in the
3520    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/camera_8h.html).
3521
3522    Errors:
3523
3524    - `Status.INVALID_ARGUMENT` when `logical_size` isn't square, or is
3525      wider than 512 pixels. For denser tiles, raise the map's scale
3526      factor instead.
3527    - `Status.INVALID_ARGUMENT` when `tile.x` or `tile.y` isn't less than
3528      2 to the power `tile.z`, or when the tile can't fill the map at a
3529      zoom from 0 to 25.5, as for tile 0/0/0 on a 256-pixel map.
3530    """
3531    return CameraOptions._from_native(_native.camera_for_tile(tile, logical_size))

Computes the camera that shows exactly one tile on a square map.

Jump a map in MapMode.TILE to the camera to render tile, where logical_size is the map's size. The camera centers the tile, zooms until the tile fills the map, and looks straight down with north up and no padding. The map keeps its camera within its zoom limits, so for a deep tile, raise the maximum zoom past the camera's with MapHandle.set_bounds().

See mln_camera_for_tile in the C API reference.

Errors:

  • Status.INVALID_ARGUMENT when logical_size isn't square, or is wider than 512 pixels. For denser tiles, raise the map's scale factor instead.
  • Status.INVALID_ARGUMENT when tile.x or tile.y isn't less than 2 to the power tile.z, or when the tile can't fill the map at a zoom from 0 to 25.5, as for tile 0/0/0 on a 256-pixel map.
def clear_log_callback() -> None:
3543def clear_log_callback() -> None:
3544    """Sends log messages to the platform's log again, instead of a
3545    callback.
3546
3547    See `mln_log_clear_callback` in the
3548    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/logging_8h.html).
3549    """
3550    return _native.clear_log_callback()

Sends log messages to the platform's log again, instead of a callback.

See mln_log_clear_callback in the C API reference.

def get_network_status() -> NetworkStatus:
3592def get_network_status() -> NetworkStatus:
3593    """Reads whether the library may use the network.
3594
3595    See `mln_network_get_status` in the
3596    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
3597    """
3598    return NetworkStatus(_native.get_network_status())

Reads whether the library may use the network.

See mln_network_get_status in the C API reference.

def get_plugin_register_function_v1() -> int:
3625def get_plugin_register_function_v1() -> int:
3626    """Returns the function that registers a plugin's style layer types.
3627
3628    Pass the function to the plugin's registration entry point before
3629    loading a style that uses the plugin's layer types. Plugin callbacks
3630    run on library threads and can keep running while the process exits,
3631    so they must not use state that the process destroys at exit.
3632
3633    See `mln_plugin_get_register_function_v1` in the
3634    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/plugin_8h.html).
3635    """
3636    return _native.get_plugin_register_function_v1()

Returns the function that registers a plugin's style layer types.

Pass the function to the plugin's registration entry point before loading a style that uses the plugin's layer types. Plugin callbacks run on library threads and can keep running while the process exits, so they must not use state that the process destroys at exit.

See mln_plugin_get_register_function_v1 in the C API reference.

def init_android(jni_env: int, context: int) -> None:
3458def init_android(jni_env: int, context: int) -> None:
3459    """Gives the library the Java VM and the app context that it needs on
3460    Android.
3461
3462    Call it before creating a runtime. `jni_env` is the calling thread's
3463    `JNIEnv*`, and `context` is an Android `Context`, such as the
3464    application.
3465
3466    See `mln_android_init` in the
3467    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/android_8h.html).
3468    """
3469    return _native.init_android(jni_env, context)

Gives the library the Java VM and the app context that it needs on Android.

Call it before creating a runtime. jni_env is the calling thread's JNIEnv*, and context is an Android Context, such as the application.

See mln_android_init in the C API reference.

def lat_lng_for_projected_meters( meters: ProjectedMeters) -> LatLng:
3534def lat_lng_for_projected_meters(meters: ProjectedMeters) -> LatLng:
3535    """Converts meters in the Web Mercator projection to a coordinate.
3536
3537    See `mln_lat_lng_for_projected_meters` in the
3538    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html).
3539    """
3540    return LatLng._from_native(_native.lat_lng_for_projected_meters(meters))

Converts meters in the Web Mercator projection to a coordinate.

See mln_lat_lng_for_projected_meters in the C API reference.

def logical_extent_physical_size( extent: LogicalExtent) -> maplibre_native_ffi._generated_operations.LogicalExtentPhysicalSizeResult:
3579def logical_extent_physical_size(
3580    extent: LogicalExtent,
3581) -> LogicalExtentPhysicalSizeResult:
3582    """Computes the size in pixels of a target with a logical size and scale
3583    factor.
3584
3585    See `mln_logical_extent_physical_size` in the
3586    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html).
3587    """
3588    raw = _native.logical_extent_physical_size(extent)
3589    return LogicalExtentPhysicalSizeResult(raw["width"], raw["height"])

Computes the size in pixels of a target with a logical size and scale factor.

See mln_logical_extent_physical_size in the C API reference.

def open_gl_supported_context_provider_mask() -> OpenGlContextProviderFlag:
3615def open_gl_supported_context_provider_mask() -> OpenGlContextProviderFlag:
3616    """Reports the OpenGL context platforms that this build of the library
3617    has.
3618
3619    See `mln_open_gl_supported_context_provider_mask` in the
3620    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/render__target_8h.html).
3621    """
3622    return OpenGlContextProviderFlag(_native.open_gl_supported_context_provider_mask())

Reports the OpenGL context platforms that this build of the library has.

See mln_open_gl_supported_context_provider_mask in the C API reference.

def projected_meters_for_lat_lng( coordinate: LatLng) -> ProjectedMeters:
3639def projected_meters_for_lat_lng(coordinate: LatLng) -> ProjectedMeters:
3640    """Converts a coordinate to meters in the Web Mercator projection.
3641
3642    See `mln_projected_meters_for_lat_lng` in the
3643    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/projection_8h.html).
3644    """
3645    return ProjectedMeters._from_native(
3646        _native.projected_meters_for_lat_lng(coordinate)
3647    )

Converts a coordinate to meters in the Web Mercator projection.

See mln_projected_meters_for_lat_lng in the C API reference.

def set_log_async_severity_mask(mask: LogSeverityFlag) -> None:
3553def set_log_async_severity_mask(mask: LogSeverityFlag) -> None:
3554    """Selects the severities that the library logs on a background thread.
3555
3556    The library logs other severities on the thread that logged them.
3557    `mask` applies to every runtime in the process.
3558
3559    See `mln_log_set_async_severity_mask` in the
3560    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/logging_8h.html).
3561    """
3562    return _native.set_log_async_severity_mask(mask)

Selects the severities that the library logs on a background thread.

The library logs other severities on the thread that logged them. mask applies to every runtime in the process.

See mln_log_set_async_severity_mask in the C API reference.

def set_log_callback(handler: LogHandler) -> None:
3565def set_log_callback(handler: LogHandler) -> None:
3566    """Sends the log messages of every runtime in the process to a callback.
3567
3568    The callback replaces the one set before.
3569
3570    The callback runs on the binding's dispatcher thread, after native
3571    queues the call.
3572
3573    See `mln_log_set_callback` in the
3574    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/logging_8h.html).
3575    """
3576    return _native.set_log_callback(handler)

Sends the log messages of every runtime in the process to a callback.

The callback replaces the one set before.

The callback runs on the binding's dispatcher thread, after native queues the call.

See mln_log_set_callback in the C API reference.

def set_network_status(status: NetworkStatus) -> None:
3601def set_network_status(status: NetworkStatus) -> None:
3602    """Tells the library whether it may use the network.
3603
3604    While the status is `NetworkStatus.OFFLINE`, the library starts no
3605    network requests. The requests that wait start when the status
3606    returns to `NetworkStatus.ONLINE`. The status starts as online and
3607    applies to every runtime in the process.
3608
3609    See `mln_network_set_status` in the
3610    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/runtime_8h.html).
3611    """
3612    return _native.set_network_status(status)

Tells the library whether it may use the network.

While the status is NetworkStatus.OFFLINE, the library starts no network requests. The requests that wait start when the status returns to NetworkStatus.ONLINE. The status starts as online and applies to every runtime in the process.

See mln_network_set_status in the C API reference.

def supported_render_backend_mask() -> RenderBackendFlag:
3650def supported_render_backend_mask() -> RenderBackendFlag:
3651    """Returns the render backends that this build of the library draws
3652    with.
3653
3654    See `mln_supported_render_backend_mask` in the
3655    [C API reference](https://maplibre.org/maplibre-native-ffi/reference/c/base_8h.html).
3656    """
3657    return RenderBackendFlag(_native.supported_render_backend_mask())

Returns the render backends that this build of the library draws with.

See mln_supported_render_backend_mask in the C API reference.