mapbox / mapbox/mapbox-gl-draw
feature id mismatch vs. mapbox-gl
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 612
- Avg merge
- 8d 9h
- Merged PRs (30d)
- 5
Description
mapbox-gl-js version: 0.45.0
mapbox-gl-draw version: 1.0.9
-
mapbox-gl only supports uints for feature ids. If a feature id is not an integer it'll be silently removed from queryRenderedFeatures's results.
-
mapbox-gl-draw is using strings for feature ids, via the
hat()library/function.
This means that features where the ids were generated via draw will have missing ids in mapbox-gl / queryRenderedFeatures.
I believe probably hat() should be changed to some kind of random integer instead.
The other issue is that there are actually two locations for ids in draw.
- root level as
feature.id - inside properties, as
feature.properties.id
It's all internal functions where id is used, but maybe draw should only use a root level, integer id.
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 reproducing the mismatch with mapbox-gl 0.45.0 and mapbox-gl-draw 1.0.9, focusing on queryRenderedFeatures and the hat() ID generation. Inspect how IDs are used at feature.id and feature.properties.id, then establish a consistent ID representation whose generated features retain IDs in mapbox-gl results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100