So I'm trying to implement box selection in Leaflet. Currently I'm using
turf's intersects function to detect if the box intersects with any of my GeoJSON polygon features.
However, this is very slow; with 180 polygons (about 500KB for GeoJSON data), it would take 3 seconds to iterate over every polygons.
I see that OpenLayers 3 has a box-selection feature which uses
ol.source.Vector.prototype.forEachFeatureIntersectingExtent which in turns uses
ol.geom.flat.intersectsextent.linearRing and so on.
The example that OpenLayers 3 gives has a GeoJSON source of 250KB, and it takes no time to iterate and highlight selected polygons.
Does anyone what algorithm OpenLayers uses? or is there any fast algorithm out there?