Questions tagged [qgsexpression]

class for parsing and evaluation of expressions in QGIS API

Filter by
Sorted by
Tagged with
1
vote
0answers
23 views

Reading @map_id expression variable using PyQGIS

When I try to read the expression variable @map_id using a Python expression function (see code below) inside a label text, it always returns "canvas" as result. When I use @map_id directly, ...
1
vote
1answer
83 views

In QGIS Atlas how to get the index and the number of features grouped/filtered by an Attribute with expression?

Using a QGIS Expression in the Layout Editor, how can one return the count of features matching a particular attribute value for an atlas feature, for example, "AREAS_Area". In this ...
10
votes
1answer
130 views

Select By Expression, NULL or date

How can I select by expression from a date field in a shapefile, dates that are NULL or >= 2020-01-01? This doesn't work, it only selects those with dates >= 2020-01-01, not the NULLs "...
4
votes
2answers
116 views

QGIS expression on layer that refers to intersects on same layer

Let's say I have the scenario where Polygons A and B intersect polygon c There are also polygons X,Y and Z which do not intersect c. Polygon C has an attribute value 'Priority' which I need the value ...
2
votes
1answer
34 views

Print out centroid coordinates of a polygon in layout text box

I wanted to put the coordinates of the centre of a polygon in a text box in the print composer. When I run the expression in the labelling panel on the canvas it works, like below However, when I run ...
1
vote
1answer
42 views

Buffer by field value in the processing modeler in QGIS

I am using the processing modeler in QGIS 3.10. I want to buffer polygons by individual field attributes. This is not a problem when I am not using the processing modeller since one can simply choose ...
3
votes
0answers
36 views

Populating row numbers with Field calculator using PyQGIS

I have the following code, which is creating a new column called "group" without issue, but not populating it with a row number 1-n, as I'm intending it to. pv = layer.dataProvider() pv....
2
votes
1answer
44 views

Filtering features outside features of another layer using QGIS geometry generator

I am trying to filter features in one layer outside features in another layer using geometry generator. I have a buildings layer and an area layer and now I want to only show the buildings outside the ...
0
votes
0answers
16 views

Extract specific geometry type from a QuickOSM query in QGIS graphic modeller

I am trying automate the extraction of various features from OSM using QuickOSM in GQIS graphic modeller. I have the query etc running fine but I want to end up with just the lines and export to a ...
0
votes
0answers
26 views

How to handle NULL values in QgsExpression()?

When I try to add multiple conditions in QgsExpression() eg: QgsExpression(f"input='{abc}' OR value='{def}'") here abc = 1 and def = NULL. Even though abc is having value I am getting NULL ...
0
votes
1answer
31 views

QGIS Fieldcalculator

I have a QGIS layer with points and the column 'name'. This column contains names like "AS 10450 to 1045" or "BAS 1045B100 to AS 1457745". Now I want to create another column with ...
5
votes
3answers
238 views

Creating line from points and counting the number of points on that line

I have a shapefile that contains a number of points, each point represents a tree. I would like to calculate how many trees there are per row. Hence my question (I think this is the best method), how ...
0
votes
0answers
36 views

QGIS: Filtering aggregate returns different results with same value

I have a joined layer that was created from a one-to-many join between a vector layer with three attributes (lat, long, siteid) and a data layer that contains many columns with many entries possessing ...
1
vote
1answer
48 views

Format multiple values in a label with different colors in QGIS

I need to create complex labels for sites that contain multiple values in each. These values are colored depending on their value (ex. in range = green, out of range = red). I need to do this from an ...
1
vote
1answer
154 views

Expression to Transform XY coordinates to LatLong in QGIS

I have a Point Layer referenced in a projected CRS (UTM) with X, Y and Elev fields that represent coordinates of some points I have surveyed. I would like to have in the same layer Lat and Long fields ...
1
vote
0answers
32 views

DB Manager returns NULL for GeoPackage layers

When I try to do some spatial query in the DB Manager (as Virtual Layer Provider) or in the Virtual Layer Window (Layer > Add new Layer > Create Virtual Layer...) it returns a NULL array, as it ...
2
votes
1answer
22 views

Map not changing after filter

I use qgis 3.4.4 and I make a filter on vector layer. Here is my code: layers = QgsProject.instance().mapLayers() for layer_id, layer in layers.items(): if (layer.name() == "csv_points_acc&...
0
votes
0answers
105 views

Apply a date filter to the vector layer

I am new to developement in QGIS. I use a the 3.4.4 version of QGIS. My vector layer is like this: So I want to know how to filter this data by date and apply the changes in the GUI. Here is what I ...
1
vote
0answers
58 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 (...