Search code examples
openlayersopenlayers-5

Openlayers - How to get rendered symbol list with declutter option?


I added the vector layer with "declutter" option in OpenLayers v5.
Source feature was 500 (five hundred) and rendered result is almost 50 (fifty).
After render, I wanna get only fifty rendered list from layer instance.
I know that "forEachFeatureAtPixel" API, but it can capture only a single pixel point.

Any way to get this list?


Solution

  • You can use getFeaturesInExtent on Source to get features placed in specific area. But there's no way to get only visible features with declutter option for now. You may need to request the new method to the OpenLayers team.