Questions tagged [field-calculator]
allows you to perform calculations on the basis of existing attribute values or defined functions in QGIS, ArcGIS, etc.
2,435
questions
0
votes
1
answer
25
views
Field Calculator If Statement
I am new to python and was trying to populate a decade field based on an if else statement on another field that contains parcel years.
The code block is below:
def ifBlock(Parcel_Year_Built, ...
1
vote
0
answers
33
views
Numbering H3 Polygon Elements Sequentially for Easy Map Identification
I've a high quantity of H3 hexagons that I would like to make them easily identifiable on a map by assigning sequential numbers starting from 0 based on their location.
I'm using the field calculator ...
2
votes
1
answer
61
views
Calculate the ratio of intersection to union in using the field calculator in QGIS
I have two separate polygon layers, A and B, of which I want to calculate the intersection to union ratio and store it as an attribute to polygon A. To do this, one needs to divide the area of the ...
1
vote
3
answers
37
views
Script field calculation Python parser
I am trying to use the field calculator to create an alphanumeric sequence, I tried to write a statement but I don't know what is wrong.
So my sequence would be in a field called "Field_number&...
1
vote
1
answer
43
views
QGIS Overlay analysis in field calculator
I have a polygon layer in QGIS 3.32.2 which I want to clean for later analysis. There should be no polygons that share any area at all, but they would touch quite frequently. However, the polygon ...
4
votes
1
answer
55
views
Converting text date to numbers date using QGIS Field Calculator
I have a shapefile with polygons. Each polygon contains a date (fully written in text, for example: '2 june 2018') in the attribute table. This field is format 'text'. Now, I would like to convert ...
1
vote
1
answer
47
views
How to replace multiple independent values using QGIS field calculator
I have a vector with different land use classes for which I want to add labels that correspond to their number. I am trying to use to QGIS field calculator, I have the code to replace one value into a ...
4
votes
1
answer
121
views
Rounding down value
I made a layer in which I have a column with a function, that calculates volume. For Example:
a * b * c * indicator
2.5 * 1.2 * 2.3 * 0.62
In this example, the answer is 4,278 but I need to round it ...
3
votes
1
answer
101
views
Field calculator won't let me add numbers from an integer field into a text field
I'm trying to field calculate a text field & add digits to it from a 32 bit integer field, by using the expression "ID"+"Fiber Capa" in QGIS 3.28. But the error message
An ...
3
votes
1
answer
81
views
Calculating new id with suffix for another id field that has duplicates in QGIS
I have a linear dataset that has a unique "ID" for every row, but many of the linear features needed to be segmented. After segmenting, there are some rows that were split into two, three, ...
0
votes
1
answer
56
views
Remove all spaces in attribute fields using field calculator
I've been trying to join two layers (one shapefile point-layer and one table without geometry) using one attribute column with mutual attributes. Normally this works perfectly.
However, only one fifth ...
-1
votes
1
answer
25
views
Join attribute table - 2 different layers - 2 different classifications (QGIS)
I have 2 vector layers, one containing cells on a municipality level and one containing a more detailed classification on a district level. Some municipality contain multiple districts, whereas other ...
3
votes
1
answer
43
views
ModelBuilder to automatically calculate area of feature for use in field calculator
A common task I have is to take a site area that encompasses several different properties and make a map showing how much of each property is within the site boundary. Then I calculate the proportion ...
0
votes
1
answer
29
views
Populating values from two or more fields into one field using field calculator in ArcGIS Pro
I am using ArcGIS Pro.
I have state-county-specific data. In my attribute table, I have a unique county number for each county in the state. The problem is each of them is in separate fields like ...
1
vote
0
answers
65
views
Calculating the surface area of the ocean at each latitude
I am trying to get the surface area of the ocean at each 1° latitude slice. However, for some unknown reason, region -61 which is at latitude -61 has a negative number, and am not sure why that is the ...
1
vote
1
answer
21
views
Using ArcGIS Pro field calculator: check values one column and enter specific data in a second column
I have two fields and I want to use field calculator to check the column Datierun_1 (alias is Datierung) for certain words (in this case "Achaemenid"). In case it finds a match it should ...
1
vote
1
answer
38
views
Populating attribute table string field with the features JSON geometry string (but excluding CRS) in ArcGIS Pro
Wondering if anyone can assist. I have a need to have the JSON geometry string of my features written into a text field of the features attribute table. Currently I use Calculate Field and then with ...
0
votes
1
answer
32
views
Assigning new values based on the field calculator and "case when then" in QGIS
I would like to do conditioning in the attribute table consisting of the following action:
CASE WHEN "network" = icn_ref THEN '001|' ELSE '' END
|| CASE WHEN "network" = ncn THEN ...
0
votes
1
answer
42
views
Display "Time"-type response in 12h instead of 24h format Survey123 Connect
I have a Survey123 Connect form where inspectors describe the position of damage to a pipe via a "Time" field. The issue is that if they click up on the hour entry and loop back to 1 from ...
0
votes
0
answers
26
views
QGIS3 - length3D strange results
I am using QGIS 3.32. My project and data are in EPSG:4236-WGS84.
I used drape (set Z value from raster) the line layer onto an elevation grid, resulting in a Line (MultiLineStringZ). On this layer, I ...
2
votes
1
answer
70
views
Using random value generator within if/else statement in Field Calculator in ArcGIS Pro
My task is to populate empty cells of the field "NUMBER" with random values (interval 1-50) in all feature classes while iterating through Geodatabase in the Modelbuilder.
Here is the code:
...
1
vote
1
answer
38
views
Getting selected attributes from line layer to polygon layer in QGIS
I am trying to get specific attributes from a line layer to a polygon layer. The line layer contains a number of pipes that run through a polygon (parcel). They both have the parcel number in common:
...
1
vote
0
answers
26
views
QGIS: Distance to nearest polygon in another filtered layer
I have two layers, one that collects data and is made up of some hundreds polygons and another that has polygons for cities/towns/villages and includes the number of inhabitants. In the data ...
0
votes
0
answers
14
views
Recalculating chainage values from a parallel line
I am currently trying to recalculate the chainage value of one line in contrast with another parallel line.
I have two polylines layers and their corresponding chainage (two layers in point geometric ...
0
votes
1
answer
47
views
Calculate a field in a parent table when a child record is created or modified using QGIS
In QGIS, I have a feature class named "Water_Crossing" that has a field named "Modified".
I have a relation set up from "Water_Crossing" to 3 child tables "...
1
vote
0
answers
12
views
Extract subgroups w/ max time difference between points < 2.5h in QGIS
I have several point layers can be grouped by "date" and "new_id", such as:
datetime_lcl date new_id
05/06/2023 09:30:01 05/06/2023 1
05/06/2023 10:...
0
votes
1
answer
36
views
Editing 'expression' used in creating Field with 'field calculator'
I have created a new field 'COROAD' using field calculator and now I want to edit the expression. I cannot find a way to view the expression and edit it.
0
votes
1
answer
29
views
Populating field based on value of another field using Boolean OR [closed]
I am trying to enter values for a new column, FloodZone, based on another column's (NEW_ZONE) values. I am doing this in ArcGIS Pro 3.1 using the Calculate Field Tool via Python. However, I am getting ...
0
votes
0
answers
28
views
Add new point to feature class but keep numbering scheme
I am using ArcGIS Pro.
I need to add a point to a feature class. The objects are named based on spatial attributes, ie one point is named 1364, the next one down is 1365 etc. I need to add a point ...
0
votes
1
answer
27
views
DateAdd function syntax error
I have a date field named LAST, a short integer field named FRQ, and a date field named NEXT that I need to calculate. FRQ field is populated with frequency in months, with values that look like 6, 12,...
-1
votes
1
answer
85
views
Converting string variable to number format without creating new variable using Field Calculator in QGIS
I have many variables which are of type string but contain in fact numbers.
In QGIS you can convert those strings to numbers by creating a new variable with the wanted numeric type (e.g. integer or ...
0
votes
1
answer
51
views
Import error with using QGIS Native functions in Jupyter Notebook environment
I want to calculate area of all polygon features using Field Geometry function of QGIS 3.22 version. But somehow it always gives an import QGIS error, but when I tried to do a simple buffer of a ...
0
votes
0
answers
29
views
Extract municipalities on position of point layer (geom within)
I am looking for an expression to extract/import the municipality of the position from different points. I have about 400 points and I would like to add a row with the municipalities to these points.
...
0
votes
0
answers
41
views
Calculating the area of a shapefile with multiple features using the field calculator, gives "nan"
I've created a shapefile with multiple features, and want to calculate the area in acres of 3 polygons. The shapefile is in the right CRS, when I open the attribute table and start an edit mode, open ...
6
votes
2
answers
193
views
Segment attribute according to percentage of overlapping area
My project have a layer of GRID polygons with the value of Population ("POBTOTAL"). On the other hand, there is a SECC polygon layer with the neighborhoods division.
Here is the data: https:/...
3
votes
3
answers
239
views
Performing the same mathematical operation on many attributes at once with QGIS
How to perform the same mathematical operation on many attributes at once? I have multiple numeric attributes and I would like to divide the value of each by the polygon area which is stored in a ...
0
votes
1
answer
41
views
QGIS field calcuator expression distance between centroid and point feature of another layer
I look for an expression in QGIS field calculator, that calculates the distance between the centroid (red dot) of polygones (red polygones) of layer 1 and the nearest (point-) feature of layer 2 (...
4
votes
2
answers
161
views
Calculating mean with group by based on another column in QGIS Field Calculator
I have daily temperature data for several cities from January to December.
I'd like to calculate the average temperature per month for each city in a new column.
I have a column "city", &...
2
votes
1
answer
24
views
Populating new field with data from old field such that new field at fid was equal to old field at fid -1 in QGIS
In QGIS there is a layer 'Layer' with its attribute table:
fid Oldfield Newfield
1 cat -----
2 horse cat
3 dog horse
4 swan dog
I tried ...
1
vote
1
answer
62
views
Finding length and percent of line across polygon in QGIS
I have a layer with several line features and a polygon layer which has land ownership information (so thousands of parcels).
I want to append several columns to the line layer attribute table ("...
2
votes
1
answer
44
views
Calculate field based on other field but row below using ArcGIS Pro
I've got a point feature class with X and Y coordinates and would like to calculate two new columns for X_end and Y_end, where X_end equals X from the next point (so from the row one down). This is to ...
3
votes
2
answers
116
views
Combination of maximum values in QGIS
I'm making classification by rules to create a map with different colors;
I have 4 values (A,B,C,D) assigned to some areas and I want to find the maximum values between the four in each area. Thus, I ...
0
votes
1
answer
57
views
Add/summarize range of columns using the Calculate Field tool [closed]
Let's say I have a dataset with multiple columns that I would like to add and the sum value will be stored in the Total column. These columns range from Field3 to Field141 in sequential order. Now I ...
3
votes
2
answers
95
views
QGIS - how to add up line length for lines that pass through polygon
I have three lines as per the below picture. The layer us called line. A is 60m, B is 30m and C is 90m. I have a polygon layer consisting of 1 square. The layer is called polygon. I want to make ...
5
votes
1
answer
227
views
Calculating the day of the year with QGIS expressions
At QGIS 3.28.6 I have an attribute table containing a datetime field from which I need to populate an integer field that will contain the day of year (for example, 2/1/2018 would output to 32).
Using ...
5
votes
2
answers
158
views
Converting column with category names to numeric codes in QGIS Field Calculator
I use the Field Calculator in QGIS to transform an attribute column with category names to numeric codes. I use the following expression:
CASE
WHEN "category" = 'Foo' THEN 1
WHEN &...
1
vote
1
answer
36
views
ArcMap field calculator expression failing with ERROR 000539 [closed]
I am using ArcMap 10.7.
I have an attribute table with 6 different columns of short integer data. These columns store the birth day, birth month, and birth year, as well as the death day, death month,...
2
votes
1
answer
44
views
Calculating time difference between rows of the same field separated by cluster ID in QGIS
I have just formed point clusters using ST-DBSCAN, which gave me a single output with all points categorised by the new column "CLUSTER_ID".
My next step is to acquire the centroids of each ...
2
votes
1
answer
63
views
Field name not working in QGIS Modeler expression?
Why does the Field Calculator expression using field name work in the Attribute table but not in the QGIS Modeler?
5
votes
2
answers
215
views
QGIS automatic fill of the attribute table by expression
I have a line layer and in the attribute list the "Name" column, which can be, for example, 'V1','V2',....'V1-2','V1-2-3',... in I'm trying to put an expression in the next column that is ...