Filter for actual geometry intersection

This commit is contained in:
Andreas Hocevar
2022-01-06 21:10:26 +01:00
parent a2388756f2
commit c785c2813b

View File

@@ -43,7 +43,9 @@ map.addInteraction(dragBox);
dragBox.on('boxend', function () {
const extent = dragBox.getGeometry().getExtent();
const boxFeatures = vectorSource.getFeaturesInExtent(extent);
const boxFeatures = vectorSource
.getFeaturesInExtent(extent)
.filter((feature) => feature.getGeometry().intersectsExtent(extent));
// features that intersect the box geometry are added to the
// collection of selected features