deck.gl
deck.gl copied to clipboard
[Bug] MVTLayer with `binary: false` moves feature ID into `feature.properties.id`
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
- [x] 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.
- 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
- After switching to
binary: false- auto-highlight stops working
- upon clicking a feature, it can be seen that the
idfor the feature has now ended up infeature.properties, which is unexpected - the selection-based styling still doesn't work because the features now don't have a
feature.id
- 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
The change in behavior is actually due to a change in loaders.gl MVT loader - filed an issue here: https://github.com/visgl/loaders.gl/issues/3197