Questions tagged [qgsfeaturerequest]

QGIS API class to request for features to a vector layer.

Filter by
Sorted by
Tagged with
0 votes
1 answer
31 views

Requests Python module in QGIS return nontype or empty CSV

I am using the Requests Python module to query a 3rd party API that returns a polygon of an address, the returned CSV returning only part of the header, while it is working fine when using the code ...
user avatar
1 vote
3 answers
129 views

Adding and filtering layer with map canvas extent using PyQGIS

I'm creating a small QGIS3.16 plugin with PyQGIS. I'd want to add a vector (PostGIS) layer to QGIS, and immediately filter it with the QGIS canvas extent. I found the QgsFeatureRequest(rectangle:...
user avatar
  • 369
1 vote
0 answers
105 views

How can I made requests (QgsFeatureRequest) or selections (selectByExpression) from a list of QgsFeature?

I've got a processing algorithm that does a request to select some features that correspond to the incorrect filling of the attributes. It reads a JSON file containing a description of expression (...
user avatar
3 votes
1 answer
99 views

How to select specific fields using getFeatures() without getting all of them in QGIS-3.10

So I'm trying to convert code from ArcGIS to QGIS. The part I am at right now is converting: lst_fields = ["full_id", "osm_id", "osm_type", "boundary", "is_in", "leisure", "name", "type", "landuse"] ...
user avatar
1 vote
1 answer
131 views

Printing how many features satisfy a QgsFeatureRequest (QGIS 3)

I have a QgsFeatureRequest() that filter all the features by an attribute. Is there any python function that could tell me how many features were filtered? I know I could create a list with this ...
user avatar
2 votes
1 answer
215 views

How to use the ExactIntersect flag for QgsFeatureRequest() object

I have two layers, a polygon_lyr and a line_lyr. I want to use a QgsFeatureRequest() for the line_lyr.getFeatures() but instead of returning the lines which intersect the bounding box of a polygon, I ...
user avatar
  • 537
1 vote
0 answers
172 views

QgsFeatureRequest() with a string search within QGIS3 Processing Script [closed]

I'm trying to select features using a string comparison within my script using a QgsFeatureRequest() and getFeatures() roadsRequest = QgsFeatureRequest() roadsExpression = str(roadsIDField[0]) + ' ...
user avatar
  • 111
1 vote
1 answer
171 views

QGIS 2.18: Filter line-layer by QgsExpression

I have a line layer on which I want to run a filter within a python script. I am trying to achieve this via QgsExpression and QgsFeatureRequest. Below you see the same filter that I want to apply in ...
user avatar
3 votes
1 answer
239 views

QGIS 2.18: Speed up QgsFeatureRequest in Python Script

I have two input layers. The first one is a line-layer named "graph" and the second one is a point-layer named "nodes". The "graph"-layer: The graph layer holds 177350 line features which are ...
user avatar
1 vote
1 answer
66 views

QgsfeatureRequest - Store result indexes

I recently posted a question. My original goal was to find a way to determine on which side of a line points are located. @xulnik answered this question with two codes. One returns a binary [0;1] ...
user avatar
2 votes
1 answer
317 views

How to refresh a layer after filter features in pyqgis

When I queried some features using QgsFeatureRequest().setFilterExpression() in pyqgis,I want to make the current layer just only show what I queried without creating a new memory layer. Just like you ...
user avatar
  • 65
1 vote
0 answers
64 views

How to set flags when re-use QgsFeatureRequest object

I have a standalone PyQGis application that is working fine. When I query a vector layer via QgsFeatureRequest class, I would like to instantiate one object and reuse it. But I am not sure how to set- ...
user avatar
  • 1,077