mapbox / mapbox/mapboxgl-jupyter
Replace expressions with `setFeatureState` for choropleth and linestring vector tile visualizations
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 681
- Forks
- 137
- PR merge metrics
- No merged PRs in 30d
Description
# 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 this `id` in them in order to use setFeatureState().
* `id` values only support integers, so there would need to be an intermediate `mapping` table to join data between string values and integer `id` values.
* The difference between expressions and setFeatureState() data-join techniques should be hidden from the end user of the visualization library.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the current expression-based data-join implementation and reviewing the linked setFeatureState example. Work out how vector-tile integer ids and string-to-integer mapping would be handled for choropleth and linestring visualizations while hiding the implementation choice from users. Done means both visualization types use the state-based join without changing their public behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, jupyter, python
- Domain
- data-visualization, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100