Questions tagged [expression]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
43 views

Calculating the sum of a column based on another column in another table in the field calculator of QGIS

I have a records table with site numbers and abundances of different species at that site (e.g. site 1 has 6 common bats and 13 pipistrellus bats). I would like to sum total number (i.e. 6+13=19) at ...
5
votes
2answers
46 views

Assign values to points according to a pattern

I'm making a map of trees in QGIS (3.10). Each point represents a tree and the attribute table has a column that should contain the tree species. For now this column is empty, but I would like to fill ...
3
votes
1answer
39 views

Get Attributes from 1:n relation in QGIS as Expression to use in Atlas

I need to set up way signs for something like a "hiking-GIS". In the first step I made a network analysis (using QNEAT3) to find the distance from the signs ("Way Signs") to the available destinations ...
3
votes
0answers
28 views

Label only the maximum value when I zoomed out or print in smaller scale using QGIS

I would like to prioritise the maximum values to be shown on the map. In other words, when the label collides it should drop out the minimum values. In the shown examples, I would like to have ...
1
vote
0answers
9 views

Sorting Relation_Aggregation Expression Results in QGIS3

I am using a relation aggregation expression to grab a list of inflows from other sewersheds. Some sewersheds take on flows from more sewersheds than others so I approached it through a relation so ...
4
votes
1answer
40 views

exp function not recognized in Raster Calculator?

I am trying to preform a calculation for the exponential increase in cost of a slope, using the "exp" function, but get an "error parsing formula" message. The expression as I've written it is: 1000*(...
2
votes
1answer
37 views

Nesting filename in composer without file extension

I just want to supress the file extension (.qgs) on my file name: srv1245_d005.qgs. [% substr(@project_filename ,1,12)%] works although sometimes our filename will be 13 characters long or more so ...
2
votes
1answer
42 views

Replace Part of String with a different String in QGIS using Python [closed]

I am trying to fix a field that has Street Names. Some of the features' Street Names have abbreviation rather than the full name of the type of street like for example 'PRESTON LAKE DR' when it should ...
5
votes
1answer
82 views

Rule-based labeling with optional second field

I need to label some polygons with 2 fields using only one label: The first being a field in the attribute table named "Bio-Code" the second one being optional if a cell in the field "BBT-Code" is ...
1
vote
0answers
29 views

Decimal places in SQLite

I'm working with a locally stored SQLite database and have an area field that auto populates via a virtual field using $area. Works fine but there seems to be no way to set the precision in a decimal ...
3
votes
1answer
50 views

Overlining text label in ArcGIS Desktop

I would like to know is there anyway to overline a text label like this in ArcGIS10.3.
3
votes
1answer
57 views

Auto populate qgis file name with no file extension?

I'm looking to be able to auto populate an attribute field with the project file name either by a virtual field or default option in the properties. The "@project_filename" expression always produces ...
7
votes
2answers
134 views

QGIS 3.4 calculate date, add month

I want to add a number of months to a date to get a new date. I have a date-field "date", an integer-field "months" and a date-field "new_date". I want to calculate the "new_date" by adding the "...
4
votes
0answers
39 views

Displaying images as part of multiattribute labels using QGIS

I would like to display images referenced in an attribute column as part of a multiattribute label, so that I can eventually print them with the map. I do not want to display geotagged images, since ...
2
votes
2answers
84 views

Selecting latest date by expression

I am trying to select the latest date by expression in QGIS. I tried to use this code "Date"= maximum("Date"). But nothing was selected. I wonder what is the right expression code to select the ...
1
vote
0answers
42 views

Define color for label-buffer with data-defined override/expression

In QGIS 3.8 (Win 10) I have a Point-Layer with labels in a certain distance and leader lines, created with geometry-generator. The leader lines in some cases cross below the label and are masked by a ...
1
vote
0answers
49 views

Multiple labels [closed]

I have followed tutorial for labelling from multiple columns, e.g. name and also grade. Looks correct in expression but nothing shows in output preview. Any idea where I am going wrong?
4
votes
1answer
40 views

Checking if value from one column is in multiple other columns

How do you write an expression for a style rule that will check if the value from column A exists in columns B, C, D & E? I have a polygon layer that I would like to flag with a style depending ...
1
vote
1answer
84 views

Calculate date difference (days) with expressions (QGIS)

I would like to calculate the number of days between two dates. The first date is written in attribute table [YYYY-MM-DD] (creation date) and the second is today [now()]. The goal is, to get the age ...
2
votes
1answer
120 views

Layout expression for getting all features of layer within the current map view in QGIS 3?

In a map layout template, I want to insert an expression which gets all feature's names of a certain layer, which are contained in the current layout's view/extent. Is there a way to get an aggregate ...
1
vote
0answers
32 views

ArcGIS Pro calculate field using arcade not working?

Im trying to calculate a field called "bark t/ha" using the following expression: if ($feature.Barkfuelhaz =="Low"){ return"0"} else if($feature.Barkfuelhaz =="Moderate"){ return"1"} else if($...
3
votes
1answer
71 views

Calculating the number of days between two dates as number

For some expression in QGIS I need to get the number of days between two dates as numeric value. If I substract two dates I get an interval back: to_date('2019-12-31') - to_date('2019-01-01') gives ...
3
votes
1answer
43 views

Coalesce field “X” if field “Y” is a duplicate

(QGIS 3.4) The image below will help explain my goal: I'm working out how to coalesce the attributes of the field "ID" if the field "X, Y" is a duplicate. I have highlighted some duplicate ...
4
votes
2answers
74 views

Adjusting condition in field calculator in QGIS [duplicate]

I need to calculate a score based on an area field using these ranges: if >= 30000 (square meters) then 4 (score) if < 30000 AND >= 10000 then 3 if < 10000 AND >= 5000 then 1 if &...
1
vote
2answers
67 views

Creating array of z-values from line vertices in QGIS field calculator?

I would like to create an array of a line's z-values to use as part of another expression. The z-values should be in the same order as the vertices, I would like to be able to use it as an input for ...
0
votes
2answers
52 views

Downloading files with file paths informed by attribute information

I am looking to download files that are saved in a server location with a file path that is informed by attribute information created in the graphical modeler. The information that I would like to ...
0
votes
1answer
55 views

Calculating length of field using Arcade?

I have data with this format: 4024-457 and I need to separate the left and right portions from the '-'. The data is not always in that proportion (4 numbers left and 3 to the right) so I need to ...
2
votes
1answer
31 views

Expression that selects all objects that share the same value in field 1, among them selects the object with the highest value in field 2

I have a table with thousands of objects but created an example Image for this question. I need an expression that does the following. Select all objects that share the same values in field 1. ...
2
votes
1answer
28 views

Expression that selects all objects with same value in field one and among the choosen ones figures out the highes value in field two

I have an Attribute table similar to the one in my example Picture, just with thousdands of objects. Some of the objects have the same value in "field 1" but different values in field 2. I want to ...
4
votes
2answers
120 views

Cleaning up layer by deleting features with only one overlapping vertex in QGIS

After applying r.thin and then r.to.vect to a raster image the resulting vector layer contains hundreds of small "branches" that are not supposed to be there: I've tried selecting and deleting these ...
2
votes
0answers
57 views

Converting lat/long to EPSG:27700 in geometry generator expression

I have incorporated a geometry generator into a style in QGIS 3.4 which creates a callout line from a feature to its relevant spatial position. For reasons out of my control our projects use CRS: ...
2
votes
2answers
70 views

QGIS expression using Aggregate and start_point to select a vector within a buffer

I am trying to put a default value of a field so that the value always updates once any change is make item. Either the expression builder or function editor are fine. I'm more familiar with the ...
1
vote
0answers
52 views

Layer Styling by Geometry Generator in QGIS 3.6

I am trying to create custom styling by using Geometry Generator in QGIS 3.6 but I got an error expression. segments_to_lines ( $geometry) ramp_color('Viridis', scale_linear( length( ...
2
votes
3answers
152 views

QGIS Select by expression - buffer selection

I want to select points 2 and 3 with a 'selection with expression' in QGIS 3.4. I want to do this by using the buffer function in the expression builder. I already managed to create a separate ...
2
votes
2answers
70 views

How to get directory from filepath in QGIS action

I have in QGIS layer that contains filepath (e.g. D:/file/28238/pic/D4D3-06_1.png) and I would like to get directory path only like D:/file/new/28238/pic. Is it possible to do by expression in field ...
2
votes
1answer
51 views

Why is my default value stil NULL even when i have made an expression for the Default Value?

I seem to have a problem with the default value in one of my colums by the calculator expression. I have two specific columns that have widget input one being tekst value and the other being numbers ...
3
votes
1answer
72 views

Using expressions to relate column to layer style in QGIS?

I have a QGIS project with N layers, each pointing to the same CSV file with columns "1_1, 2_1, ..., N_1". I would like each layer to refer to its respective column (Layer 1 -> column 1_1, and so on) ...
2
votes
4answers
356 views

Count touching and near points for every polygon (QGIS)

I have a polygon and a point layer. The polygons contains buildings, the points should be the edges of the buildings. A building is "good" as much as points are touching or in the near (buffer 0.2 ...
4
votes
1answer
114 views

QGIS: Select point(s) in other layer with similar datetime value from selection

For the interpretation of bird observations, I need to identify the position on a GPS-track (gpx-files), from which the position of a bird observation (other gpx-waypoint layer) was recorded. The ...
0
votes
0answers
76 views

QGIS Value Relation filter

Let's say I have 3 layers: point layer (columns: id, group), table layer named materials (columns: point_id, mat_id), table layer named mat_list (columns group, mat_id). There is relation between ...
3
votes
1answer
106 views

QGIS 2.18 label by expression concatenate field strings

For a building layer I have an attribute table with several fields for the building type where data was entered with a manually created form using checkboxes. Example: Production: 1 = (yes), 0 = (no) ...
3
votes
1answer
85 views

Buffer with unknown distance by adding numerical values of a column until a maximum

In my QGIS project, I have a vector of polygons representing slope zones around an archaeological site and I want to calculate the area which is necessary to supply the ancient population with a ...
1
vote
1answer
64 views

Showing some feature in text label in Print Composer from Print Layout itself in QGIS 3.4.5

I was wondering if there is some expression that I can insert in a text label QGIS print layout that will allow me to print for example coordinates of the map inserted in the print layout itself. ...
1
vote
2answers
55 views

Retrieving specific value from CSV layer to use in QGIS Expressions when conditions match current Atlas feature

I have configured an Atlas which is tied to a "ref_pln" column in a coverage layer. I also have a CSV layer with the columns "ref_pln", "attribute" and "value". I'd like to pull the value of "value" ...
3
votes
1answer
44 views

Getting value set in binding input widget in QGIS expression?

I would like to set dynamic line width and it should be scaled by the value "Stroke width". When I set the value to 0.15, it will be less than 0.15 if $length is too small. I need a function to get ...
1
vote
1answer
76 views

Default expression won't write to database

Made this expression and put it in the defaults value box.: CASE ---cardinal WHEN ("CATCAM" = '1')THEN'2,6' WHEN ("CATCAM" = '2')THEN'2,6,2' WHEN ("CATCAM" = '3')THEN'6,2' WHEN ("CATCAM" = '4')THEN'...
1
vote
0answers
77 views

QGIS 3, Expression to address ranges in the symbology [closed]

I noticed many new entries in the list of expressions in the QGIS3-Version. Is there an expression that I can use to address the symbology of a Layer? It would be of particular interest to get the ...
2
votes
0answers
35 views

Can I symbolize based on the syntax in a description attribute colum?

I got a kmz-file from an organization and the attribute table has a colum 'description' with a synthax that holds import information (such as date built, water source, village etc.) instead of a ...
0
votes
1answer
52 views

Style a feature in one layer based on an attribute in another layer in Print Composer Atlas

I have two layers; one is the foreground and the other a background. Both layers have fields containing similar values (field values in the foreground layer (mun_code) is also present in the ...
1
vote
1answer
207 views

How to use attribute table field name as the Output filename expression in Print composer?

I have several features I want exported as individual images. I am using Print composer and the export process was successful, but the output shows generic filenames like output_1.png: It obviously ...