You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"Map#queryRenderedFeatures" fails on features whose size is determined by a property function #3604
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:
write a way to calculate the maximum possible value of a data driven function at the current zoom
or, hardcode it to the maximum spec values (which might have perf implications, but might be ok?)
For the second part, all the the paint[prop] accesses need to be replaced with getPaintValue to calculate the value for that individual feature.
write a way to calculate the maximum possible value of a data driven function at the current zoom
@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.
changed the title [-]queryRenderedFeatures fails on data-driven circle-radius[/-][+]"Map#queryRenderedFeatures" fails on features whose size is determined by a property function[/+]on Jan 26, 2017
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.
@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 buffers.programConfugration.layerData[id]). I had originally dismissed this idea as too cumbersome/complicated, but it actually doesn't seem too bad.
@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.
Activity
Add test case for mapbox/mapbox-gl-js#3604
ansis commentedon Nov 22, 2016
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
paint[prop]accesses need to be replaced withgetPaintValueto calculate the value for that individual feature.jfirebaugh commentedon Nov 23, 2016
A similar issue exists for data-driven
line-width,line-gap-width, andline-offset.anandthakker commentedon Jan 19, 2017
@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?
jfirebaugh commentedon Jan 19, 2017
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.
[-]queryRenderedFeatures fails on data-driven circle-radius[/-][+]"Map#queryRenderedFeatures" fails on features whose size is determined by a property function[/+]stevage commentedon Feb 2, 2017
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.
anandthakker commentedon Feb 8, 2017
@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
buffers.programConfugration.layerData[id]). I had originally dismissed this idea as too cumbersome/complicated, but it actually doesn't seem too bad.jfirebaugh commentedon Feb 8, 2017
@anandthakker How about tracking the maximum while populating the buffers, and transferring it as auxiliary data to the buffer itself?
anandthakker commentedon Feb 8, 2017
@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.