[Qgis-user] How to use spatial filtering in dataprovider filter

Luigi Pirelli luipir at gmail.com
Wed Apr 10 12:26:25 PDT 2019


for not spatial enable layers (e.g. without embedded spatial operators)
AFAIK you should use create a qgis virtual layer or an external gdal vrt.

http://www.sigte.udg.edu/jornadassiglibre2016/wp-content/uploads/2016/01/qgis_vlayers.pdf
https://github.com/mhugo/qgis_vlayers/blob/master/README.md

Luigi Pirelli

**************************************************************************************************
* LinkedIn: https://www.linkedin.com/in/luigipirelli
* Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
* GitHub: https://github.com/luipir
* Mastering QGIS 2nd Edition:
*
https://www.packtpub.com/big-data-and-business-intelligence/mastering-qgis-second-edition
* Hire me: http://goo.gl/BYRQKg
**************************************************************************************************


On Wed, 10 Apr 2019 at 11:01, Bo Victor Thomsen <bo.victor.thomsen at gmail.com>
wrote:

> Hi all -
>
> Im am experimenting with using the dataprovider based *spatial* filtering
> in QGIS
>
> For example: with a Postgres based datasource I can write a filter like
> this:
>
> ST_Intersects( "geometry", ST_GeomFromText(' Polygon ((582084. 6143051.
> ...... lots of coordinates ... 582084. 6143051.))', 25832))
>
> This will show a layer that only contains objects which actually
> intersects with the text defined polygon even if the unfiltered datasource
> contains a large number of objects taht does not intersect withe the text
> polygon
>
> Something similar can be done with SQLserver to:   mygeom.ST_Intersects
> (...) = 1
>
> But what about ogr file based vector sources like tab or shape files ?
>
> You can define a *alfanumerical* filter like this : "myfield"  > 27  to a
> ogr file datasource. Works like a charm.
>
> But what about *spatial filtering* ? Iv'e tried to use the same expression
> like the postgres  one but on a shapefile. I don't get any errors :-).
> However the filter function doesn't work and let all objects through the
> filter :-(
>
> What am I doing wrong with the file based spatial filtering?  Or is it
> simply impossible ?
>
>
> --
> Med venlig hilsen
>
> Bo Victor Thomsen
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20190410/5481d168/attachment.html>


More information about the Qgis-user mailing list