4

QGIS offers the option to use layer filters: Layer Properties > Source > Provider Feature Filter, see documentation: Query Builder.

As far as I can see, this filter is only able to filter based on attributes, but does not have the option to define spatial queries. So what is possible using e.g. a virtual layer or a PostGIS query (filtering let's say all polygons from layer 1 that are disjoint from layer 2), is not possible with this Provider Feature Filter.

Is this correct?

I'm just asking if I miss something or not, so the answer I'm looking for is just a confirmation or falsification of my assumption that there is no possibility for spatial queries (like disjoint) there. I know how to do it in PostGIS or with Virtual Layer, so this is not part of the question.

1 Answer 1

3

You can do spatial queries with it, but not depending on another layer. But you can do filters like ST_Intersects(ST_Transform(geom,4326),ST_SetSRID(ST_MakePoint(33,22),4326)) assuming you are working with a PostGIS layer. So you need to create the geometry inside the the query builder. In this example, geom is the name of the geometry column of the filtered layer.

Its exactly as the docs state:

The filter is made at the data provider (OGR, PostgreSQL, MSSQL…) level. So the syntax depends on the data provider (DateTime is for instance not supported for the ESRI Shapefile format).

1
  • Is there a definitive and easy to scan table of the providers and their capabilities in terms of filtering? Jul 4, 2022 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.