[Qgis-user] Query on QgsVectorLayer

Christoph Jung jagodki.cj at gmail.com
Thu Apr 9 06:32:17 PDT 2020


Thank you, Jorge :)

> Am 09.04.2020 um 14:15 schrieb Jorge Gustavo Rocha <jgr at geomaster.pt>:
> 
> 
> 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
> -- 
> 	
> 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
> _______________________________________________
> 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/20200409/474891dc/attachment.html>


More information about the Qgis-user mailing list