visgl / visgl/deck.gl

[Bug] MVTLayer with `binary: false` moves feature ID into `feature.properties.id`

Open
#9,508 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
14.6k
Forks
2.3k
Avg merge
2d 9h
Merged PRs (30d)
42

Description

Description

For an MVTLayer with binary: false, when accessing feature data e.g. in an onClick handler, each feature's id is moved by deck.gl into feature.properties rather than being present as feature.id.

This issue appeared when updating deck.gl from 8.9.28 to 9.1.4.

Flavors
  • Script tag
  • React
  • Python/Jupyter notebook
  • MapboxOverlay
  • GoogleMapsOverlay
  • CARTO
  • ArcGIS
Expected Behavior

When accessing in interaction handlers, accessor functions etc. - MVT features that do have an ID in the original dataset (as contrasted with an id property) should have a feature.id present, rather than a feature.properties.id.

Steps to Reproduce

See https://codesandbox.io/p/devbox/deck-gl-react-map-gl-maplibre-gl-playground-world-capitals-forked-4kls9v

The sandbox shows a sample point dataset. The original MVT features all have IDs.

The MVTLayer has autoHighlight enabled, as well as layer styling that is dependent on the selected feature ID.
The UI shows the stringified last clicked feature.
There's also toggles for binary and uniqueIdProperty props.

  1. With binary: true:
    • auto-highlight works
    • selection-based styling doesn't work (this is expected because the accessors don't have access to the binary feature data)
    • the clicked features do have an id
  2. After switching to binary: false
    • auto-highlight stops working
    • upon clicking a feature, it can be seen that the id for the feature has now ended up in feature.properties, which is unexpected
    • the selection-based styling still doesn't work because the features now don't have a feature.id
  3. Only after setting uniqueIdProperty: 'id' prop as a workaround:
    • auto highlight works again
    • selection-based styling works
Environment
  • Framework version: 9.1.4
  • Browser:
  • OS:
Logs

No response

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 the linked CodeSandbox and reproduce the MVTLayer behavior by toggling binary and uniqueIdProperty. Trace the non-binary feature conversion and ID handling used by the React example. Done means original MVT feature IDs remain available as feature.id with binary: false, while autoHighlight and selection-based styling continue to work without the workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.