Replace expressions with `setFeatureState` for choropleth and linestring vector tile visualizations
ryanbaumann opened this issue · 0 comments
ryanbaumann commented
Motivation
The data-join technique can be used in choropleth and linestring visualizations to join metadata to geometry in vector tiles over a unique identifier (or primary key). The data-join technique currently uses expressions to do the join, which is slow to execute when joining more than 10k or so features.
New feature
Use map.setFeatureState() released in GL JS v0.46 to perform the data-join technique. map.setFeatureState() requires a unique integer id
value to be included with the vector tile source. Here's an example - https://bl.ocks.org/ryanbaumann/733ba99c5ca1d9d15259081b395e4b00
Issues
- Since setFeatureState supports
id
values only, vector tiles must be created with thisid
in them in order to use setFeatureState(). id
values only support integers, so there would need to be an intermediatemapping
table to join data between string values and integerid
values.- The difference between expressions and setFeatureState() data-join techniques should be hidden from the end user of the visualization library.