Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 99589

Expressions are SQL-like statements that are used to evaluate dynamic properties.

15 votes
4 answers
3k views

Difference between quotation marks ('single' vs "double") in QGIS

For instance, if I type something in the Expression dialogue I will have a different output. "something", it is written as The Output is NULL. …
2 votes

Calculating field using expression taken from DataFrame with PyQGIS

following methods startEditing() and commitChanges() and of the QgsVectorLayer class: layer.startEditing() ... layer.commitChanges() There are also several suggestions regarding your code: check your expressionexpression = QgsExpression(row['calcul']) # checking if expression is valid if expression.isValid(): # looping through …
Taras's user avatar
  • 34k
3 votes
Accepted

Display point with heighest value in group of points

Perhaps, you will find this expression suitable for you: geometry_n( collect( expression:=$geometry, group_by:=substr("NumeroNom", 0, 5), filter:="AmslFt"=maximum("AmslFt", …
Taras's user avatar
  • 34k
3 votes
Accepted

Recreating the shape of curved arrows with QGIS Geometry Generator

Unfortunately, it is not a desirable Geometry Generator, however, I can suggest a PyQGIS approach. It is primarily based on the segmentizeArc() method of the QgsGeometryUtils class. Perhaps this tool …
Taras's user avatar
  • 34k
2 votes

Getting lat/long for centroids using QGIS

A possible solution using PyQGIS. An Extension to the answer provided in this thread Adding x,y coordinates to Attribute table in QGIS. The above solution is primarily based on the QgsCoordinateTransf …
Taras's user avatar
  • 34k
3 votes

QGIS expression: when using overlay_nearest sometimes a feature considers itself its nearest...

Therefore, like in this thread Drawing 10 nearest lines from each point connecting to the centroid of the 5 points nearest to each point with QGIS expression, I am simply suggesting to delete it by its … However, in such a case, the number in limit should be incremented in one more feature. array_remove_at( overlay_nearest( layer:=@layer, expression:=fid, filter:=letter='A' …
Taras's user avatar
  • 34k
5 votes

Filtering maximum and minimum length in QGIS Attribute table

The logical operator should be OR instead of AND. "Length" < 50 OR "Length" > 100 See Logical connective for more details. Another solution will employ NOT BETWEEN operator: "Length" NOT BETWEEN 50 A …
Taras's user avatar
  • 34k
9 votes

Expression to replace characters in QGIS Attribute table

You may also try the following expression: array_to_string( array_foreach( string_to_array("test"), if( to_int(@element)>0, @element||'F', abs(@element …
Taras's user avatar
  • 34k
2 votes

Expression for assigning ID by grouping and ordering polygons in QGIS

Inspired by @GabrielDeLuca's answer: array_find( array_reverse( array_agg( "id", group_by:="Group", order_by:="area" ) ), "id" …
Taras's user avatar
  • 34k
1 vote

Calculating interior angles of polygons or lines in QGIS

Currently working only for Single Part Polygons. There is "LF Tools " Plugin, that possesses the "Calculate polygon angles" tool for that. This algorithm calculates the inner and outer angles of th …
Taras's user avatar
  • 34k
3 votes

Adding new field in point layer with attribute from another layer in QGIS

Currently a bit "old-fashioned" approach using the aggregate() function: aggregate( layer:='polygon_layer', aggregate:='concatenate', concatenator:=',', expression:=to_string("id"), …
Taras's user avatar
  • 34k
3 votes

Identifying neighbouring polygons but field calculator preview and output are different

overlay_intersects(@layer, "id"))) 2. aggregate() As was mentioned by @J.Monticolo in his comment, one can use a small buffer around $geometry. aggregate( layer:=@layer, aggregate:='concatenate', expression
Taras's user avatar
  • 34k
5 votes

Getting integer based on string value in another field using QGIS

Here is another IMHO a bit sophisticated approach: if("CORINE" IS NULL, 0, map_get( map('AG',1,'BG',2,'LW',3,'NW',4,'MW',5,'WW',6,'WA',7,'DK',8,'LN',9,'NV',11,'SU',12,'SV',13,'TM',14), …
Taras's user avatar
  • 34k
5 votes
Accepted

Retrieving attribute field from polygon feature containing point feature in QGIS

So, you can try either this: aggregate( layer:='polygon layer's name', aggregate:='max', expression:="polygon layer's field name", filter:=contains($geometry, geometry(@parent)) ) … or this: aggregate( layer:='polygon layer's name', aggregate:='max', expression:="polygon layer's field name", filter:=within(geometry(@parent), $geometry) ) Alternatively you can …
Taras's user avatar
  • 34k
8 votes
Accepted

Counting touching and near points for every polygon in QGIS

In QGIS there is a possibility using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer.... Let's assume there are three features in 'buildings' and 12 in 'point_layer' accordingly, …
Taras's user avatar
  • 34k

15 30 50 per page