Questions tagged [expression]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
34 views

How do I offset a point created at the midpoint of a line in QGIS?

I am trying to accomplish something similar to this question, but in QGIS. I am trying to create line segments from a polygon, while preserving on which side of the line, the polygon 'interior' is. My ...
5
votes
2answers
122 views

Add new field in a point layer with an attribute from another layer in QGIS

I'm working with QGIS 3.16 Hannover under MacOS 10.13 environment. I've got a point and a polygon shapefile layers. I want to add a new field to my point layer with the id of the polygon that contains ...
0
votes
1answer
9 views

Export Data From Merged File to Individual

I Have a merged shape file with 'n' number of cities in it. Exporting them by selecting their names individually is a difficult thing and wasting my time. Is their any query in QGIS to export Data ...
3
votes
2answers
102 views

How to select a range of rows with Select by Expression?

I can't find any similar questions as this. Suppose I have a layer with 20 features, and I only want the first ten. so something like "col1" = 1:10 and then columns 1:10 are selected only. ...
2
votes
1answer
96 views

Saving expressions in QGIS?

Is it possible to save expression, so one doesn't have to retype?
3
votes
1answer
80 views

Test if a feature is visible in QGIS expression?

I'd like to test whether a given feature is displayed, i.e. visible on the map canvas, inside a QGIS expression. Any way to do this? I'm essentially looking for an analog to the is_selected() function,...
1
vote
1answer
47 views

Get the attribute value of another layer with geometry condition

With QGIS 3.14 and the field calculator : I have two layers, one with stream network and one with watersheds. I would like to attribute the name of the watershed to the streams contained inside it ...
1
vote
1answer
29 views

Apply transformation to layer on the fly when using tools like Buffer

I know that you can have an on-the-fly transformation on a layer when rendering on the canvas, but is there a way to run a tool like Buffer where the layer should be re-projected on-the-fly just ...
0
votes
1answer
26 views

PyQGIS: Add user input as parameter/expression in Raster Calculator

I want to use Raster Calculator in my Python script in QGIS. The expression is easy - I create new raster with two values (0,1) where I get 1 if pixel value is higher than certain threshold ("A &...
2
votes
0answers
36 views

Creating several new fields at once with QGIS field calculator in batch mode in the same layer/file

How is it possible to create several new fields at once in the same layer, using QGIS field calculator in batch mode? There is a similar question, but using Python - I'm interested in a solution ...
1
vote
0answers
39 views

Selecting layers in QGIS autofilling batch Processing: reproducecable bug?

Can someone reproduce the strange behavior I encounter in QGIS? See below ("My workflow") for project settings and workflow. Basically, I want to use GDAL Build virtual raster in batch mode, ...
3
votes
1answer
63 views

Automatically create an array of all visible layer names in QGIS

How can I get an array of all visible layer names automatically using QGIS expressions? In principle it should work with the variable @map_layers. Using the following expression works fine for what I ...
2
votes
1answer
47 views

Adding metadata from JSON file as text to QGIS print layout

I have a have a static URL pointing to a json file on the web that I load to QGIS. It is updated regularly. In the source, before listing the features, it contains metadata, between else a line "...
1
vote
1answer
47 views

Assigning incrementing id for each feature group in attributes with QGIS expressions [duplicate]

I have a layer with a repeating field name, thus different groups of features (I also have a numerical group field). How can I add a field group_id, using QGIS expressions? What I want is kind of a ...
1
vote
1answer
61 views

Highlight duplicates at nearest distance

I have a point shapefile with several names and there are a lot of duplicate names in the data. I want to highlight the nearest duplicates in the data. How can I solve that in QGIS?
3
votes
1answer
85 views

QGIS expression on legend for duplicated values

Having a building table, grouped by an id and its respective amount of apartments. I want to label every symbol id on map composer legend with the amount of apartments. For a simple expression '...
4
votes
1answer
98 views

Convert geometry to feature with QGIS expressions

With QGIS expressions, if I have a feature, I can get the corresponding geometry with geometry (feature). How is it possible the other way round: if I have a geometry to get the feature (or feature id)...
2
votes
1answer
48 views

Add an expression to calculate an attribute in the print composer with PyQGIS

In the print composer, it's possible to add an expression in the window "select attributes", in order to display an attribute that wasn't calculated in the attribute table of a layer, see an ...
3
votes
1answer
50 views

Relation aggregate function error in QGIS using Geometry by expression

I have a point layer, consisting of 12 points with fid 1 to 12. I want to render points with fid > median (fid) - thus in this case, point 7 to 12. That works perfectly if using geometry generator ...
5
votes
2answers
58 views

Populate legend items with values from another layer

I'm using QGIS 3.10. I'm trying to label my map with values taken from a different layer (meaning not my atlas coverage layer), which is intersecting the atlas cover layer. This layer named "...
1
vote
2answers
45 views

Follow-up query on “QGIS expression for label text to display vertex coordinates of polygons”

Just a follow-up query about the existing thread QGIS expression for label text to display vertex coordinates of polygons. Is there an expression in QGIS to collect all the coordinates from the ...
2
votes
1answer
22 views

Selecting a feature using expression if attribute field is “NULL” [duplicate]

I am new to QGIS and am having, what I expect to be, an easy issue. I am working with a multi-polygon shapefile of taxable property parcels in QGIS 3.16. All it is I am trying to do is select all ...
3
votes
2answers
220 views

Colouring points in the same colour as their nearest point/polygon from another layer in QGIS

I got two files, a multi-polygon file with polygons and points (File 1) and a file with points only (File 2). Our task is to fill the color of the points from File 2 with the respectively nearest ...
4
votes
2answers
354 views

Distance between GPS travel route and country border

I have no idea how to, or even is possible in some way, but maybe there is an app, software or someone of you have any idea how to! Please note, that I have no skills in coding or programming. I will ...
1
vote
1answer
29 views

Count specific value in label expression by QGIS

I have successfully count total features of Parcel layer by count aggregate function, next challenge with me is how to count all "5" or "4" values from "lut_zone" field ...
1
vote
1answer
75 views

Accessing Python dictionary by field value in QgsExpression

I'm writing a QGIS processing plugin. In this plugin, I use the processing algorithm pointsalonglines, and for the distance parameter, I'd like to use an expression which gives back the value of a ...
1
vote
2answers
35 views

Substracting attributes of different layers [closed]

Can I subtract two attributes belonging  to two different layers? In this case these would be two polygons holding DEPTH attribute (Depth1 - Depth2).   Is this possible and if so how?
2
votes
1answer
57 views

Detecting automatically where rivers flow, directly into the sea or into another river

I am using this dataset of rivers in France. I'd like to automatically distinguish between rivers flowing directly into the sea versus rivers that flow into another river and draw a map of only those ...
4
votes
3answers
122 views

Eliminating duplicates only if data is the same according to attributes

Having duplications in the data is quite natural and removing them is quite hard if we didn't have the same attributes. In QGIS there are tools to eliminate the duplications but only if the data is ...
2
votes
1answer
99 views

Antipodes map in QGIS

Does anybody know a trick to create an antipodes map with QGIS? That is a map of the world on one layer, and a map of the world on another layer, showing the antipodes of each point (practically a ...
3
votes
0answers
36 views

Change default of QGIS field calculator: turn off “Only update selected features” (always update all features)

Is there a setting to change the default so that the checkbox Only update %1 selected features in QGIS field calclulator is not checked? As a default behavior, I would like the expression to be ...
2
votes
1answer
53 views

Group neighbouring features based on sum of attribute

Each polygon (building) contains "x" number of flats (eg "flat_num"=10 in one polygon/building). I would like to group multiple polygons if: the grouped polygons are neighbors ...
4
votes
1answer
49 views

Selecting by attributes on features sharing common value

I have a point vector with features sharing non-unique "ID"s. Each feature also has a "distance" field. I want to select among each set of features sharing the same "ID" ...
3
votes
2answers
120 views

Copy and paste value from a feature sharing the same id

I would like to copy and paste the value from another feature sharing the same id in QGIS. The feature to take the value from is always the only one with a value other than NULL per "id". ...
4
votes
2answers
96 views

Expression with two groups

I have a shapefile that contains building footprints with multiple addresses with different functions (with each an usable area). I would like to calculate the sum of the usable area, per building id, ...
3
votes
1answer
114 views

Error using QGIS expression aggregate

I several times had the same problem using the QGIS expression aggregate: I got the impression that it behaves somehow buggy - or I make a mistake. See this expression I use on a point layer: ...
1
vote
2answers
123 views

Replacing characters using an expression in QGIS

What regular expression can I use to change values in a string field? I need to change the letter B to a symbol - before the digits, and digits with letter F to make positive. Like this:
2
votes
1answer
74 views

Calculating bounding box with padding

I'm working in QGIS and I can't seem to warp my head around this problem. I have bounding box defined as 4 coordinates pair (A, B, C, D in the picture) and a center and I want to calculate a new ...
6
votes
1answer
156 views

QGIS - Expression to aggregate values from an array

In a calculated field in QGIS 3.10.2 I wan't to aggregate values from an array field. For this aggregation I'm using a filter to compare matching id's and return value from another field. I can ...
5
votes
3answers
185 views

Expression to replace characters in Attribute table

I have a string field. Which requests to put the letter F after the number to all positive digits, and the letter B after minus digits and to delete the sign -. Finally, I want a result like this:
2
votes
0answers
42 views

Pie charts in QGIS: attributes generated with Expressions not working when using aggregate function

I have a problem to add values generated by expressions with aggregate functions to pie charts (see the screenshot below for better understanding). This question is a follow up question to this one ...
5
votes
3answers
147 views

Calculating distance of all points to central point using QGIS

I'm using QGIS and the points on this map represent different periods of the day in which coyotes were observed. I am trying to figure out if coyotes are active at different times of the day based on ...
4
votes
0answers
78 views

Performance-limits of QGIS expressions

I use quite often QGIS expressions and I am wondering how performant they are compared with other possibilities. In many cases, the same problem can be resolved using different approaches like using ...
2
votes
1answer
199 views

Finding straight streets going from south to north using QGIS [closed]

How do I find straight streets going from south to north with an inclination of 5° maximum using QGIS. Here is an example The red line indicates the street I am looking for. These streets are very ...
5
votes
2answers
283 views

How to get attribute values of another layer with QGIS expressions

The question: How is it possible to get the value of an attribute in another layer? What is clear: When using QGIS expressions on a layer, it is possible to relate to features of another layer with ...
0
votes
0answers
14 views

Configure pop-ups in ArcGIS Pro extension

A little while ago I configured pop-ups in ArcGIS Pro and used the expression option similar to what is described in Conditional Field display with Arcade in Pop Ups (revisited) and just came back to ...
3
votes
0answers
49 views

Setting transparency color in Expression Builder

Using QGIS 3.16, I am trying to set color through expression builder, using #RRGGBBAA format. The problem, I was using the same color, let's say '#94AFDCff', it should return the same color as '#...
1
vote
0answers
31 views

Adding an incrementor in CalculateField_managment() expression

I am trying to recalculate a value for a field using arcpy.CalculateField_management() using a tricky expression. Currently, I am recalculating one field named REACH_ID, using another field ('CO_FIPS')...
3
votes
1answer
49 views

Stretch label all along line length

I need to know if in QGIS 3.16 there is a method to stretch a label all along line length. My layer has lines with different length and I want to know if is possible to stretch automatically labels ...
5
votes
1answer
79 views

Using QGIS to draw a line tangential to an existing circle and parallel to existing lines

I am trying to draw a line tangential to a circle and parallel to an existing line. I have drawn the rough shape below showing the lines I need to draw as dashed lines. Using the advanced ...

1
2 3 4 5
10