Questions tagged [expression]

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

Filter by
Sorted by
Tagged with
4
votes
1answer
37 views

Getting 2 point features with max/min ID from each group with same value in two fields

I'm working in QGIS for a Digital Terrain Model. I've got a table with point features, arguably vertices extracted from multipart iso-curves because the features are provided with a "vertex_par" ...
1
vote
1answer
47 views

Getting attributes from features in list of another table using expressions in QGIS

The goal seems simple, the explanation not, but I try to: On the one hand, I have a table with several objects ("objects_layer"). On the other hand is a table with a list-field ("list_layer"). I wan'...
1
vote
1answer
51 views

Expression in QGIS not working

When i try to get an automatic fieldname with the following expression: coalesce("Borserie",NULL,'Skriv inn ledig nummerserie') it doesn't get the value/string from the table? The weird thing is that ...
2
votes
0answers
44 views

Doing expression for project relation in PyQGIS

I've build an relation between two vectorlayers. Now i want to write an expression for the relation. The standard expression which is given, is to filter features from the first field. Did anybody ...
2
votes
1answer
34 views

Categorizing data by partial attribute

In QGIS 3.4 I'm trying to categorize a column in my attribute table which contains a code, of which I only need the (highest) number (which implies a gradation). This probably means I need an ...
1
vote
1answer
49 views

Calculating azimuth between 2 points

I have been trying to use the azimuth expression function editor between 2 points. However, I am not getting it to work. I am obviously misunderstanding how to create the expression itself. This is ...
1
vote
5answers
4k views

String variable substitution in selection expression

I'm trying to put a variable into a string used to do a selection. At the moment it's like this: expression = "'No_Props' > 5 AND %s < 200 AND 'ST_Ori' >60" % metres_field arcpy....
6
votes
2answers
58 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
71 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 ...
3
votes
1answer
52 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
32 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
2answers
128 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 ...
1
vote
1answer
58 views

Search plot by total area of two adjacent plots

I've got some QGIS data where each plot is described with some attributes e.g. Shape_Area which is the field describing the area of plot in m2. Normally I search for plot using the expression e.g. ...
4
votes
1answer
47 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
44 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
85 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
1answer
393 views

Labeling expressions on AGOL with Arcade for certain features

I am working on a web map in AGOL for the indoor office map. I have some issues writing custom expressions with Arcade in order to label the types of rooms (office rooms) based on another attribute ...
1
vote
1answer
96 views

Using Click locations to determine azimuth in QGIS 3

I am using QGIS 3 64bit. While adding points to a shapefile (layer), what expression captures the insertion point coordinates of a point feature to use as a start point for an azimuth determination ...
3
votes
3answers
732 views

Creating QGIS text label in composer calculating values from attribute table?

I am working with QGIS 2:14, for now, I have a qgs project with a lot of layers and I want to create a label in the print-composer with the result of a calculated expression from one of this layers. ...
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.
2
votes
2answers
92 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 ...
7
votes
2answers
140 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 "...
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 ...
0
votes
1answer
157 views

Setting new value into field created by PyQGIS?

I'd like to create a new field named "vctcn93", loop the features of active layer, if string "metro" in feature name, I'd like to add a value string "get" into the field "vctcn93". But when I check ...
4
votes
0answers
40 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 ...
4
votes
1answer
735 views

Using round function in QGIS expression?

I created a grid of rectangular polygons with the Create Grid function, from the Vector Creation group of the Processing Toolbox in QGIS 3.4.2. The rectangles measure half a degree of longitude by ...
1
vote
0answers
46 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 ...
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
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?
1
vote
1answer
100 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
122 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
33 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
75 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 ...
1
vote
1answer
91 views

Use expression to only keep 1 layer in the legend

When I print my project, that includes different layers, I always end up with all the layers in the legend. What I want when printing is to only show 1 layer, that always has the same name "Werken". ...
0
votes
1answer
69 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 ...
4
votes
1answer
422 views

Summing up the area on a polygon by a certain attribute result

I wish to know if there's a tool on QGIS equivalent to the Excel's "SUMIF". I have a shapefile of a land use and cover that's classified by the attribute with the name of the classes, for example: "...
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 ...
1
vote
2answers
77 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 ...
4
votes
2answers
75 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 &...
0
votes
2answers
53 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 ...
1
vote
1answer
58 views

Rule based styling in Qgis using a combination of attribute(get_feature()) and ILIKE

I Have 2 Layers: I want to Filter Layer 2 by an attribute from Layer1 for some rule based styles. I'm currently using following expression to realize that: "C1" = attribute(get_feature(‘Layer 1', '...
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 ...
2
votes
2answers
79 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 ...
2
votes
0answers
59 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: ...
4
votes
0answers
216 views

Using transform function in QGIS layer geometry generator?

I'm trying to use the following expression in the geometry generator in a QGIS layer to show a 1-mi boundary around points: buffer(transform($geometry, 'EPSG:4326', 'EPSG:2877'), 5280) However, the ...
4
votes
3answers
12k views

If-Then Label Expression

I'm trying to create a VB label expression on streets such that streets with an alternate name (ACS_ALIAS) will be labeled with the LABEL name and the alternate name in parentheses; streets with no ...