I'd like to select all features in the current map extent that also satisfy some other condition via
"Select by Expression".
For instance I'd like to do something like this:
intersects($map_extent, $geometry) and "name" ilike 'Jay%'
$map_extent is a geometry that represents the current extent of the map.
I'm using QGIS 3.4.
I've written the following custom expression function which has the desired result but I'm wondering if there is an easier way?
from qgis.core import * from qgis.gui import * from qgis.utils import iface @qgsfunction(args='auto', group='Custom') def map_extent(feature, parent): return QgsGeometry.fromRect(iface.mapCanvas().extent())