Repository navigation
Respect property functions in queryRenderedFeatures - #4243
Conversation
The test was passing despite the bug, because the query point was dead center on the circle. Now, the test fails, but changing the property function to a literal 20 makes the test pass.
FeatureIndex#query will use the _max_ paint property value for its first pass (querying the grid), but should use the _actual_ property value for its second pass (filtering the rendered features that actually intersect the query). Verifying by a second feature that passes the first test but fails the second.
|
The core strategy is working here, but note that both query benchmarks took a hit. Gonna do some profiling to see if we can recover a bit. |
|
Ran benchmarks again after 2352e12:
Given the change from the previous benchmark run (query-point: +19% => +36%, query-box: +41% => +10%), it's hard to say what the true perf hit is here. Based on profiling, I think we can attribute about 10% increase in queryRenderedFeatures time to the overhead of using cc: @jfirebaugh @mourner |
jfirebaugh
left a comment
There was a problem hiding this comment.
Can you also add query tests for data-driven line-gap-width and data-driven line-offset?
| if (ElementArrayType2) this.elementArray2 = new ElementArrayType2(); | ||
|
|
||
| this.layerData = {}; | ||
| this.paintPropertyStatistics = {}; |
There was a problem hiding this comment.
Rather that creating another layer-id-keyed map, can we store the statistics as a property on this.layerData[layer.id]?
There was a problem hiding this comment.
@jfirebaugh yeah, sure -- I actually started down that route, and then bailed because doing so would bifurcate the contents of ArrayGroup#layerData and the corresponding BufferGroup#layerData, and thought that might be (slightly) worse. I don't have a strong opinion on this though, so deferring to you.
| } | ||
|
|
||
| getPaintPropertyStatistics() { | ||
| return util.extend({}, this.arrays.icon.paintPropertyStatistics, this.arrays.glyph.paintPropertyStatistics); |
There was a problem hiding this comment.
Both of these are keyed by layer ID, so doesn't this overwrite icon statistics with glyph statistics?
There was a problem hiding this comment.
Whoops -- good catch, thanks.
| 16 | ||
| ], | ||
| "ignored": { | ||
| "native": "https://github.com/mapbox/mapbox-gl-native/issues/6518" |
There was a problem hiding this comment.
mapbox/mapbox-gl-native#6518 is "Add support for identity function type" and is closed. Can you open a new parity issue and update this URL (and in the other test too)?
|
@jfirebaugh back to you |
| if (attribute.dimensions !== 1) continue; | ||
| paintPropertyStatistics[attribute.property] = { | ||
| max: -Infinity | ||
| }; |
There was a problem hiding this comment.
Do we anticipate adding other statistics in the near term?
Approach:
paintPropertyStatisticsfor data-driven paint properties while populating paint vertex arrays on the Worker side. (Specifically, store themaxvalue for each such property.)FeatureIndex#query, use these max values when calculating how much additional padding to use when querying the grid index. As features are indexed by their source geometries (rather than their rendered geometries), this ensures that our grid query yields all potential hits for the user's query.layer.getPaintValue()to obtain the actual paint property values for each feature.Closes #3604
Launch Checklist
Benchmark