mapbox / mapbox/mapbox-gl-js

Make "queryRenderedFeatures" respect "icon-translate"

Open
#2,653 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

(Moving from [stackexchange](http://stackoverflow.com/questions/37581950/mapboxgl-when-using-icon-translate-queryrenderedfeatures-result-unaffected), because it's seeming more like a bug.)

When “icon-translate” is set for an icon feature, queryRenderedFeatures returns the icon feature only when querying the original location.

Example: open console to see you get query results below marker.
http://jsfiddle.net/k5y3n1yf/16/
[updated for clarity: http://jsfiddle.net/k5y3n1yf/19/ ]

(My workaround for now is to translate the query point for specific layers with translated icons, but this seems hackish.)

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 at the queryRenderedFeatures entry point and reproduce the behavior with the updated jsfiddle example, focusing on an icon using icon-translate. Trace how the query location is compared with rendered icon placement; done means querying the translated icon location returns the icon feature rather than only the original location.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.