Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ID collisions in geometry returned from queryRenderedFeatures and querySourceFeatures result in inconsistent rendering after calling setFeatureState #8707

Closed
sansumbrella opened this issue Aug 29, 2019 · 2 comments

Comments

@sansumbrella
Copy link
Contributor

sansumbrella commented Aug 29, 2019

mapbox-gl-js version: 1.3

browser: Chrome, Firefox (latest)

Steps to Trigger Behavior

  1. Create a tileset in studio with linestrings that cross tile boundaries
  2. Use querySourceFeatures or queryRenderedFeatures to find the ids of those linestrings
  3. Use setFeatureState to change a render property of the linestrings

I remember some discussion about providing an API for generating unique ids from properties of input geoJSON data. I expect tiled data to already be handled correctly and for the ids to be unique.

Link to Demonstration

I created a dataset with a unique source_id property on each linestring. That dataset was tiled and added to my style in studio, and is loaded in the map linked below:
https://jsbin.com/sanuyut/edit?html,output

Expected Behavior

Mapbox tiling and queries to the source and rendered geometry produce unique ids for each piece of geometry. SetFeatureState is able to uniquely and consistently change properties for a given linestring.

Actual Behavior

Ids are reused across tiles, which makes it impossible to uniquely identify features. This causes style collisions where features with unique properties are assigned the same featurestate because they share an id generated by Mapbox.

lines crossing tile boundaries have inconsistent styling
lines crossing tile boundaries have inconsistent styling

Render duplicate ids:
Multiple features share map id 1 and have (properties.source_id) values: 2, 1004
Multiple features share map id 2 and have (properties.source_id) values: 1, 1005
runner-4.1.7.min.js:1 Source duplicate ids:
Multiple features share map id 1 and have (properties.source_id) values: 1004, 2
Multiple features share map id 2 and have (properties.source_id) values: 1005, 1
@sansumbrella
Copy link
Contributor Author

This id collision in the tilesets will be fixable in client code once #8448 is complete, since I have known unique ids in my geometry properties.

@arindam1993 arindam1993 added needs investigation 🔍 Issues that require further research (e.g. it's not clear whether it's GL JS or something else) needs discussion 💬 and removed needs investigation 🔍 Issues that require further research (e.g. it's not clear whether it's GL JS or something else) labels Sep 3, 2019
@mourner
Copy link
Member

mourner commented Nov 29, 2019

The solution will be provided in #8987. Closing as a duplicate of #6019.

@mourner mourner closed this as completed Nov 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants