[Qgis-user] Query on QgsVectorLayer

Jorge Gustavo Rocha jgr at geomaster.pt
Thu Apr 9 05:14:59 PDT 2020


Hi Christoph,

You can use an QgsExpression [1] to filter features from that layer.

expr = QgsExpression( " ... " )
layer.getFeatures( QgsFeatureRequest( expr ) )

Regards,

Jorge Gustavo 

[1] https://qgis.org/pyqgis/3.2/core/Expression/QgsExpression.html

On 09/04/20 12:37, Christoph Jung wrote:
> Hello everyone,
>
> I have a question concerning PyQGIS. Imagine there is a point layer accessed via QgsVectorLayer, i.e. no matter which data source it is. Is it possible to query this layer to get the point object with the highest/lowest x-value in its geometry (similar to max-/min-aggregate functions in SQL)? Or do  I have to iterate over all objects and compare the values by my own?
>
> Sincerely,
> Christoph
> _______________________________________________
> 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
-- 
Email Signature
Logo <https://www.geomaster.pt> 	
*Geomaster*
*Jorge Gustavo Rocha* | Software Engineer
*e:*jgr at geomaster.pt | *m:*+351 910 333 888
*g:*41.54094,-8.40490 | *v: *510 906 109
*a: * Rua António Cândido Pinto, 67, 4715-400 Braga

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20200409/a588b66a/attachment.html>


More information about the Qgis-user mailing list