Skip to content

Support ComputedSource on the browser platform #869

Description

@sargunv

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    webAffects Web in particular, or relates to Web specific code

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions