Thanks a lot Johannes, very appreciated, diving directly into your links. Best, Andrea
On Wed, Apr 12, 2023 at 10:13 AM Johannes Kröger (WhereGroup) < [email protected]> wrote: > Hey Andrea, > > you can do it *if* your data source (or rather the provider that QGIS uses > for your data source) supports spatial queries for the provider feature > filtering. > > Our "Räumlicher Filter" plugin does exactly that using setSubsetString :)) > > - https://github.com/WhereGroup/spatial_filter > - https://plugins.qgis.org/plugins/spatial_filter/ > > Try it and look at the resulting filter queries or check how we construct > the filter strings: > > - > > https://github.com/WhereGroup/spatial_filter/blob/e77abb9830f5d46073239b8e7376c52a69046223/filters.py#L14 > - > > https://github.com/WhereGroup/spatial_filter/blob/e77abb9830f5d46073239b8e7376c52a69046223/filters.py#L45 > > As of now, the plugin supports it for PostGIS, GPKG and Spatialite layers > . It probably is easy to adapt for other geospatial databases too. > > Cheers, Hannes > Am 12.04.23 um 09:35 schrieb andrea antonello via QGIS-User: > > Hello, > I was wondering if in pyqgis there is a way to load a layer to show only > features that intersect a certain geometry. I see the setSubsetString for > sql like queries, but no way to do this with geometries. > > Similar to this (but only applied to iterations using getFeatures), I was > wondering if with QgsFeatureRequest and expressions there is a way to > create a geometry intersection filter (I saw the setFilterRect). > > Thanks a lot for any hint, > Andrea > > _______________________________________________ > QGIS-User mailing [email protected] > List info: https://lists.osgeo.org/mailman/listinfo/qgis-user > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user > > -- > Johannes Kröger / GIS-Entwickler/-Berater > > --------------------------------------------- > Aufwind durch Wissen! > Web-Seminare und Online-Schulungen > bei der www.foss-academy.com > --------------------------------------------- > > WhereGroup GmbH > c/o KK03 GmbH > Lange Reihe 29 > 20099 Hamburg > Germany > > Tel: +49 (0)228 / 90 90 38 - 36 > Fax: +49 (0)228 / 90 90 38 - 11 > [email protected] > Geschäftsführer: > Olaf Knopp, Peter Stamm > Amtsgericht Bonn, HRB 9885 > ------------------------------- > >
_______________________________________________ QGIS-User mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
