-
-
Notifications
You must be signed in to change notification settings - Fork 977
Description
User Story
I'm developing MapLibre ArcGIS, the official Esri plugin for Maplibre that allows for loading of ArcGIS data layers.
Our FeatureLayer class loads data as a GeoJSONSource, but it requires a custom data loading algorithm to support our use case. Because of this, we're not using the built-in GeoJSON worker to its full capabilities, and all of the data processing is single-threaded. It's slow.
For our solution, we'd like to write our own custom source type (esriFeatureLayer), that extends GeoJSONSource and uses a custom worker to load data. The existing GeoJSONWorkerOptions of the GeoJSON worker are great, but unfortunately they are not sufficient for our use case. We need to extend the worker class and overwrite the loadData function with a fully custom implementation.
We are currently blocked from development because none of the relevant classes are exported from this package. Please export these classes publicly so that we can continue enhancing our plugin!
We also need a way to register message handlers for our custom worker script. It'd be great if there was a method on the Worker class to register custom messages programmatically:
maplibre-gl-js/src/source/worker.ts
Line 180 in 59227af
| this.actor.registerMessageHandler(MessageType.updateGlobalState, async (mapId: string, params: Record<string, any>) => { |
Alternatives considered
I also looked into the importScriptInWorkers method; it might be possible to implement our custom worker using this method instead. However I'm fully lost on how to do this. It seems like best practice to simply extend the GeoJSONWorkerSource, since that's the essence of what we want to do anyways.
Impact
- This will greatly improve the performance of the Maplibre ArcGIS plugin, which help MapLibre become more popular with ArcGIS customers.