mapbox / mapbox/mapbox-gl-js

Map.queryRenderedFeatures uses stale tile padding

Open
#6,536 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug :lady_beetle:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

Carried forward from [here(comment)](https://github.com/mapbox/mapbox-gl-js/pull/6263#pullrequestreview-110201228)

The feature states API allows changing a feature's paint properties, but does not reflect these changes in the tile's `queryPadding`. Calls to `Map#queryRenderedFeatures` will not include results for features affected by `feature-state` expressions, and return incorreclt results.

~The `Tile#queryPadding` value is not updated after a call to `Map#setPaintProperty()`~
`Map#setPaintProperty` invalidates a style layer and triggers a refresh of the tile's query padding though an asynchonous `updateLayers` operation. Similar to symbol placement after a frame, the query results may be out of sync when the async operation to update the feature index (and query padding) are not complete.

One approach is to dynamically compute `Tile.queryPadding` to ensure that the padding reflects current tile state.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Map#queryRenderedFeatures, Tile#queryPadding, feature-state expressions, and the asynchronous updateLayers operation described in the issue. Trace how current tile state reaches query results and determine how stale padding causes affected features to be omitted or returned incorrectly. Done means query results reflect current feature-state and paint changes without depending on an incomplete asynchronous refresh.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.