@placemarkio/fast-source

1.0.0 • Public • Published

fast-source

An experimental fast source for Mapbox GL. This trades off smoothness for latency and allows for faster incremental updates to data.

Changes:

The default geojson layer uses geojson-vt, which does a top-down tiling strategy: it generates the 0/0/0 tile then slices it down. This instead uses RBush and generates all tiles by themselves.

The default geojson layer uses webworkers for tiling, which incurs stringification and message passing lag. This generates tiles on the main thread, which creates the potential for blocking jank on the page, but improves latency.

The default geojson layer includes an unnecessary round-trip from a JSON layer representation to protocol buffers and back to another JSON layer representation. This saves the trip back from protocol buffers to JSON, though it still, currently, generates Pbf because of Mapbox GL limitations.

Limitations:

This does not work with a default build of Mapbox GL. To lessen the sprawling requirements for an external source, this relies on the WorkerTile and StyleIndex classes, which are not exposed by Mapbox GL. This relies on a build of Mapbox GL that adds those classes to the main export.

Improvements:

This participates in the same queryRenderedFeatures flow as the rest of GL, which requires the protobuf generation, which is a minor contributor to the performance envelope. It would be nice for it not to.

Notes:

  • Reintroducing the webworker may be viable now that other parts of this are optimized. Hooking into the Mapbox GL webworker system is very difficult for third-party plugins, so it may have to be a different implementation.

Readme

Keywords

none

Package Sidebar

Install

npm i @placemarkio/fast-source

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

2.05 MB

Total Files

20

Last publish

Collaborators

  • tmcw