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
> [email protected]
> 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:*[email protected] | *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

_______________________________________________
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

Reply via email to