Mapbox-gl-js: Convert queryRenderedSymbols to run entirely in viewport coordinates

Created on 17 Oct 2017  路  5Comments  路  Source: mapbox/mapbox-gl-js

Follow up to PR #5150.

queryRenderedFeatures converts a viewport-geometry query into tile coordinates and then queries the FeatureIndex of each tile for results. That used to include a query to a tile-specific CollisionTile for symbol results, but it now forwards symbol queries to the global/viewport-aligned CollisionIndex, where the tile unit query geometry is converted back to viewport coordinates.

The current approach works fine and I don't think the round-trip coordinate transformation is a performance bottleneck, but we can probably refactor this to be simpler by moving queryRenderedSymbols out of the tile-based FeatureIndex.

bug refactoring

All 5 comments

/cc @ansis @anandthakker

This doesn't matter that much, but while doing the native port of #5150 it occurred to me that even with the current tile-based query architecture, it's unnecessary to re-project the collision boxes, since the projected box coordinates are already stored in the GridIndex and it's easy to modify GridIndex to return them as part of a query.

Marking this as a bug because the current tile based implementation of queryRenderedFeatures won't include tiles with symbols that "bleed over" into adjacent tiles (if the query only intersects the adjacent tile). Doing the query entirely against the global collision index would solve this problem.

Adding this test case as a good example of where this is failing:
https://jsfiddle.net/x1fLbnzg/1/

Zooming in to markers labeled F and 1 demonstrate how the markers that are not clickable when spanning over into adjacent tiles:

ohnoes

cc @ChrisLoer @malwoodsantoro

Fixed in #6497.

Was this page helpful?
0 / 5 - 0 ratings