-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
"Map#queryRenderedFeatures" fails on features whose size is determined by a property function #3604
Comments
Feature querying works in two parts: First it does a grid lookup to get all the features that might intersect with the query. Then it checks all the candidates for whether they actually intersect the query. For the first part you need to know how big to make the box for the grid query. Features are indexed by the source geometry so you need to know how far the drawn representation from the actual geometry. This is calculated here by looping over all the style layers. This doesn't account for data-driven styling. To fix this we either need to:
For the second part, all the the |
A similar issue exists for data-driven |
@ansis @jfirebaugh This is surely a naive question, but: when we're doing this querying, have the tile's buckets/buffers already been populated w/ the calculated DDS values? If so, could we read the max value for the tile directly from the buffer data instead of trying to determine it analytically or using a global max? |
If you had access to the buffer data, yes, you could do that in theory. However, we discard the JS-side buffer data once it's uploaded to the GPU, since we don't otherwise need it and it consumes memory. |
In case anyone needs a live repro case:
In this use case, the end result is not severe - small circles are just a bit too easy to select. |
@jfirebaugh I am looking into a strategy where, when we deserialize bucket data on the main thread, we scan the paint attribute arraybuffers and save the maximum value of each paint attribute (as metadata on |
@anandthakker How about tracking the maximum while populating the buffers, and transferring it as auxiliary data to the buffer itself? |
@jfirebaugh hah yeah, just came back to say almost the same thing. One (implementation detail) difference: it may be cleaner to collate the maximums from each layer(/array) and send them back bundled into the serialized FeatureIndex. |
queryRenderedFeatures fails to return results for circles that use a data-driven
circle-radius
property, due to the use ofpaint['circle-radius']
here.This is a special case of #3044. Possibly a hard one to fix. @ansis did we ever discuss how to solve this?
The text was updated successfully, but these errors were encountered: