Questions tagged [field-calculator]

allows you to perform calculations on the basis of existing attribute values or defined functions in QGIS, ArcGIS, etc.

Filter by
Sorted by
Tagged with
6 votes
3 answers
405 views

Calculating point density as attribute in point layer in QGIS

For each point in my layer, I would like to calculate the number of other points within x distance, and for that information to be in the attribute table. I have a method but it is a few steps. As it ...
AdSad's user avatar
  • 163
1 vote
1 answer
50 views

Filling column with consecutive and static numbers in QGIS

I've created a new field and used @rownumber to have a numbered index starting from 1. However, when I delete a feature of the layer, the numbered index is assigned once again to all the features so ...
JoanB's user avatar
  • 143
0 votes
1 answer
67 views

Use ArcPy or Calculate Field to create a range of numbers 1:130 and repeat each number 129 times

I need to perform a task that is quite simple, however I am having trouble getting my result into a feature class' attribute table. I have a feature class with 27,606 rows and an empty column that ...
Rnoob's user avatar
  • 3
2 votes
0 answers
66 views

Availability of clustering function in QGIS development core for Field Calculator tool [closed]

I would like to use Field Calc to calculate the points CLUSTER_ID and update an existing field table. Apart from the Processing Toolbox 'DBSCAN clustering' and 'K-means clustering' applications that ...
emblematica's user avatar
1 vote
0 answers
25 views

Calculating length of OS Terrain50 contours for filtering prior to laser cutting - getting NaN $length

I am trying to generate an SVG per height based on the contour data from https://osdatahub.os.uk/downloads/open/Terrain50 (for laser cutting). It's an island group where I want to build up a physical ...
Chris Searle's user avatar
0 votes
0 answers
30 views

Field Calculator to generate a hyperlink

I am trying to create a hyperlink using the field calculator the problem is the field I am pulling from has numbers and letters and I only need to pull the numbers. I am currently using this field ...
Anisha Thomas's user avatar
0 votes
1 answer
54 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, ...
Androoo's user avatar
1 vote
0 answers
71 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 ...
Fabio Castellini's user avatar
2 votes
1 answer
114 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 ...
saQuist's user avatar
  • 716
1 vote
3 answers
50 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&...
Jmerryline's user avatar
2 votes
1 answer
103 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 ...
Homerun_'s user avatar
  • 125
4 votes
1 answer
114 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 ...
BramV's user avatar
  • 107
1 vote
1 answer
85 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 ...
Hartje's user avatar
  • 133
4 votes
1 answer
180 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 ...
Grahamek's user avatar
3 votes
1 answer
125 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 ...
C. Scholze's user avatar
3 votes
1 answer
110 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, ...
MidPiedmont's user avatar
0 votes
1 answer
121 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 ...
BramV's user avatar
  • 107
-1 votes
1 answer
31 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 ...
Ann's user avatar
  • 1
3 votes
1 answer
88 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 ...
David's user avatar
  • 55
0 votes
1 answer
47 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 ...
Muhammed Khan's user avatar
1 vote
0 answers
86 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 ...
Lilnet Cloud's user avatar
1 vote
1 answer
56 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 ...
ArcheoHorst's user avatar
1 vote
1 answer
71 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 ...
Alan's user avatar
  • 23
1 vote
1 answer
99 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 ...
machollka's user avatar
0 votes
1 answer
172 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 ...
Modest Frog's user avatar
0 votes
0 answers
41 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 ...
Rob Irwin's user avatar
  • 111
2 votes
1 answer
89 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: ...
Vadim's user avatar
  • 115
1 vote
1 answer
50 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: ...
ibdmn's user avatar
  • 191
1 vote
0 answers
32 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 ...
Homerun_'s user avatar
  • 125
0 votes
0 answers
28 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 ...
David Vacca's user avatar
0 votes
1 answer
75 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 "...
Tom Roussell's user avatar
0 votes
1 answer
48 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.
ujjwal basnet's user avatar
0 votes
1 answer
65 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 ...
Arthur_Morgan's user avatar
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 ...
NeedsSpatialAttention's user avatar
0 votes
1 answer
50 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,...
Roney's user avatar
  • 31
-1 votes
1 answer
209 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 ...
i.i.k.'s user avatar
  • 1,343
0 votes
1 answer
97 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 ...
soumik chakraborty's user avatar
0 votes
0 answers
39 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. ...
lesto's user avatar
  • 317
0 votes
0 answers
58 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 ...
Marc Bordelon's user avatar
6 votes
2 answers
238 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:/...
Ingrid Ingravida's user avatar
4 votes
3 answers
260 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 ...
Shinobido's user avatar
  • 217
1 vote
2 answers
66 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 (...
Mat Thias's user avatar
5 votes
2 answers
323 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", &...
GisUser's user avatar
  • 633
2 votes
1 answer
36 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 ...
ujjwal basnet's user avatar
1 vote
1 answer
86 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 ("...
curiousarchaeologist's user avatar
2 votes
1 answer
92 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 ...
BeBre's user avatar
  • 61
3 votes
2 answers
204 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 ...
Mark's user avatar
  • 33
0 votes
1 answer
85 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 ...
Arthur_Morgan's user avatar
4 votes
2 answers
141 views

Adding up line length for lines that pass through polygon in QGIS

I have three lines as per the below picture. The layer is 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 a ...
spreaderman's user avatar
5 votes
1 answer
265 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 ...
Stu Smith's user avatar
  • 8,192

1
2
3 4 5
50