ComputedSource throws UnsupportedOperationException on the browser. MapLibre GL JS parses tiles in a web worker, so the per-tile getFeatures callback cannot run on the main thread where the app supplies it.
The path to take is addProtocol behind a vector source, with the handler encoding each computed tile as MVT. That needs an MVT encoder in Kotlin, which belongs in maplibre/spatial-k rather than here.
The alternative is addSourceType paired with a worker source registered through importScriptInWorkers and self.registerWorkerSource, which MapLibre documents as experimental, and which would put the callback in a worker, not practical for Kotlin JS/Wasm today.
Until then, GeoJsonSource with setData covers the common case.
ComputedSourcethrowsUnsupportedOperationExceptionon the browser. MapLibre GL JS parses tiles in a web worker, so the per-tilegetFeaturescallback cannot run on the main thread where the app supplies it.The path to take is
addProtocolbehind a vector source, with the handler encoding each computed tile as MVT. That needs an MVT encoder in Kotlin, which belongs in maplibre/spatial-k rather than here.The alternative is
addSourceTypepaired with a worker source registered throughimportScriptInWorkersandself.registerWorkerSource, which MapLibre documents as experimental, and which would put the callback in a worker, not practical for Kotlin JS/Wasm today.Until then,
GeoJsonSourcewithsetDatacovers the common case.