Feature ids data loss for values > 2^53
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
Feature ids are being represented by number type in Javascript where the Number.MAX_SAFE_INTEGER value is 2^53 - 1 (MDN)
The vector tile spec defines feature ids to be unsigned 64-bit integers.
https://github.com/mapbox/vector-tile-spec/blob/26b7823b16df1e15f55adb44243a3896acb7b804/2.1/vector_tile.proto#L32
Any feature ids >Number.MAX_SAFE_INTEGER will lose precision when used in mapbox-gl-js
Expected Behavior
mapbox-gl-js fully supports 64-bit unsigned integer values for feature 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
Begin with flow-typed/vector-tile.js at line 18 and compare its feature-id type with the vector tile spec's unsigned 64-bit definition. Trace the feature-id path in mapbox-gl-js and add coverage for values above Number.MAX_SAFE_INTEGER. Done means feature IDs retain their exact unsigned 64-bit values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- 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