I can't make sense of the difference between:
QGIS Select by location tool (Vector->Research tools->Select by Location") which gives the correct result :7 records match the extent:
Creating a custmised pyqgis tool that uses the extent of the canvas to create a QgsRectangle and uses the layer it gives 66 matching records...why? United Arab Emirates is nowhere close!
Grab the extent from the input parameter (canvas extent) and force them to float, then:
vlayer.selectByRect(QgsRectangle(xmin,ymin,xmax,ymax)) features = [f for f in vlayer.getSelectedFeatures()] model_feedback.pushInfo("\nMatched selected features from extent intersection: {}\n".format(len(features)))
The countries layer is in WGS84, the project is in WGS84, the returned extent minx,miny,maxx,maxy is correct for the area I have around Denmark
Any ideas what's wrong or is there a bug at play?