mapbox / mapbox/mapbox-gl-js

Feature Mismatch Between Map and Rendered Features Query

Open
#13,297 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs information :pray:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

I have listed this potential bug on [Github](https://stackoverflow.com/questions/79051946/mapbox-feature-mismatch-between-map-and-rendered-features-query) as well, but figured this might be the more appropriate place to ask the question. I am getting strange behavior with Mapbox 3 when I click on the map. It seems like the features arbitrarily correspond (or don't) with the location of the map click. In the example below, I am clicking in empty space and getting back 3 features:

[![Map click event where no features should be captured][1]][1]

In the second image I am displaying the coordinates of the features selected and they are not very close (when compared to the scale at zoom level 16) to the point clicked. The point clicked is the second command shown:

[![Queried features vs Map Click Point @ Zoom Level 16][2]][2]

If I then query the features that are returned in Postgres to see the actual locations being selected, I get even another representation of the data:

[![Representation of mapped data from database][3]][3]

To put it simply, something is not right here, and I am not sure why the click event would return data that is not in the same location, or in some cases even close. While in others it returns the feature displayed on the map correctly. Any guidance or starting steps to break this problem down would be most appreciated.

[1]: https://i.sstatic.net/4KYUR2Lj.png
[2]: https://i.sstatic.net/f5tU2l56.png
[3]: https://i.sstatic.net/MXKBFhpB.png

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

No source file or test is named. Start by reproducing the map click and rendered-features query at zoom level 16, then compare the click coordinates with the returned feature coordinates and the Postgres locations shown in the examples. Done means establishing a reproducible explanation for the mismatch or confirming the behavior as a bug with clear reproduction steps.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, postgresql, typescript
Domain
databases, frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.