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
Rasterize features to a grid of ids that can be used to enable interaction.
We need to pass an id attribute to the shader.
Shader attributes can't be optional. Either we:
have a second set of shaders for grid rendering
set the a_id pointer to any data during normal rendering
The first option means more shaders to maintain. The second option is potentially slower, but I need to measure this. We could also generate shaders (this might be necessary for bluesky #146).
I'm curious, what would be the advantage of using an rtree?
It seems like it would be way more complex. The rtree will narrow down the features by bounding box, but you'll need to iterate over all of them to find if they actually intersect. The intersection calculations would have to consider styles (sizes, widths, offsets, etc). Since the bounding box may change with zoom level, you need to consider that too. On top of that, you'd need to keep the original geometries. By reusing the renderer we get all of this automatically, and performance seems good.
The idea would be to transfer one pixel on each mousemove. While its a bit scary that readPixels is synchronous, it is (for me at least) < 1ms if you're only reading 1 pixel. Its < 10 ms if continuously repainting.
Tom had a negative reaction to the grid approach too, which probably means I'm missing something here
Activity
kkaefer commentedon Oct 23, 2013
We should use an rtree instead. See #35.
ansis commentedon Oct 23, 2013
I'm curious, what would be the advantage of using an rtree?
It seems like it would be way more complex. The rtree will narrow down the features by bounding box, but you'll need to iterate over all of them to find if they actually intersect. The intersection calculations would have to consider styles (sizes, widths, offsets, etc). Since the bounding box may change with zoom level, you need to consider that too. On top of that, you'd need to keep the original geometries. By reusing the renderer we get all of this automatically, and performance seems good.
ansis commentedon Oct 23, 2013
The idea would be to transfer one pixel on each mousemove. While its a bit scary that readPixels is synchronous, it is (for me at least) < 1ms if you're only reading 1 pixel. Its < 10 ms if continuously repainting.
Tom had a negative reaction to the grid approach too, which probably means I'm missing something here
Merge pull request mapbox#147 from mapbox/common-interface