Questions tagged [field-calculator]

Use for questions about Field Calculators of QGIS, ArcGIS Desktop, etc and their Calculate Field tools

Filter by
Sorted by
Tagged with
-1
votes
1answer
18 views

Creating a new field based on ranges in a field using Field Calculator in QGIS

I have a field (Tot_Score) that has scores from 2,3,4,5,6,7,8. I would like to create 4 classes out of these scores whereby the classes will be created in another field (Vul_Class) so 1st class = 2 ...
2
votes
1answer
30 views

Arcade expression to find minimum value that is not zero

I am trying to create an Arcade expression to calculate a field in ArcGIS Pro. In my streets feature there are 4 number fields to evaluate. I can easily use the Min() function to do this. The problem ...
3
votes
1answer
36 views

QGIS: Accessing layer's CRS from expresison and/or PyQGIS

How can I access the current feature's/layer's CRS from an QGIS expression, or from a custom expression in PyQGIS? In my expression, I use the following to buffer a (currently lat-long-specified) ...
1
vote
2answers
51 views

Difficulty with select by attributes using list fields in for loop

I am trying to add fields to a table and then populate the fields with text values (Yes/No). The text values are based on whether or not a species was found in a specific block. If the species was ...
3
votes
0answers
30 views

Calculating spatially weighted average value of vector layer in QGIS 3

I have a vector layer across an area with several different polygons of varying size. Each polygon has a rate of fertilizer as an attribute. I would like to calculate the average rate of fertilizer ...
4
votes
1answer
63 views

Getting value from another feature depending on value of field using QGIS Field Calculator

I'm a total newbie at coding. I'm working with water catchments in QGIS. Runoff of some catchments feeds other catchments. I'm trying to get the cumulative run-off. Each feature in the table has the ...
-1
votes
0answers
13 views

Comparing two text fields in one Table in ArcPro [closed]

In ArcMap I was able to use the isSame steps in https://support.esri.com/en/technical-article/000011200 to field calculate and return a "Yes" or "No" but when I try to run this in ArcPro I get an ...
1
vote
1answer
27 views

Is there a way to create a new, pre-populated field within a view (Feature Layer), in Arcpy?

In SQL, users can write a SELECT statement that 'invents' a new field with a default value already populated in it, for all records returned. In the example below, the field Type doesn't actually ...
1
vote
1answer
30 views

Error calculating field with script exported from ModelBuilder

I am attempting to add a new field called "TimeYrCode" to a list of shape files, and then add values to this field based on the value of the "gridcode" attribute, which represents different days of ...
0
votes
0answers
19 views

Polsby-Popper measure in field calculator of ArcGIS Pro

I'm trying to assess the compactness of Virginia's congressional districts using the Polsby-Popper measure (4π (Area/Perimeter^2)), with this being my input into the code block: import math def ...
1
vote
1answer
35 views

ERROR 000539: NameError: name 'prevX' is not defined

I'm trying to use the field calculator to input data into a field that I previously created, but it keeps saying that prevX is not defined in line 9. I'm very new to python and I don't really ...
0
votes
1answer
27 views

select which is having specific double value

Title: Trying to Select which is having double space I have data like below: field name - Address: Winding Springs Dr Winding Hollow Dr Windsong Ln in above data i have to select double space ...
2
votes
1answer
21 views

ArcPy .replace Field Calculator - replace only standalone 0's with 111, not all instances of 0

I've searched on google intensively, must be missing something here: I only want to replace (in a string field) standalone zeros (len is 1 character), but the .replace function replaces all instances ...
0
votes
1answer
32 views

Update path of attributes to a new path

I have a layer with photos that are linked/displayed through the path attribute. Now I need to move this path and need to update it. I could of course create a whole new file but I wonder if it could ...
0
votes
0answers
27 views

Using ModelBuilder to Select by Attributes and Calculate Field in ArcGIS Pro

I have a layer that has two column attributes which have information in numerical order, that is one is 1,2,3,4 and the other is 1,2,3. I have created a 3rd column that I want to be able to "select by ...
0
votes
1answer
24 views

Extracting number values from atribute with mixed data

Sorry for my bad English. In my attribute table I have column "Name" which contains data about type number and name of streets. For example: “SR 18 DI FIUGGI”. What I need is to create another column ...
1
vote
2answers
30 views

Combining two simple scripts into single script in Python Parser of Field Calculator

I have two separate scripts used in Field Calculator for an "ID" attribute field. Script 1 is to create sequential numbers for the field. Script 2 is to add leading zeros to the sequential numbers. ...
0
votes
1answer
18 views

Adding Thirty years to date field using ArcGIS Pro Field Calculator

I have 2 fields one is Creation Date the other is Maintenance Date. The Maintenance Date should be 30 years after the Creation date. I have been trying to use the field calculator for this. But I ...
1
vote
0answers
23 views

Reset $fid value of data table

Is there any way to reset fid value of data table? I'd to remove all data from table and I'd like to got '1' in fid column in first row for new entry.
1
vote
1answer
36 views

Batch field-calculator with a decimal result

Is it possible to carry out a batch field calculator process in QGIS across multiple layers resulting in a decimal number? I have manage to do it and get an integer but not a decimal. There are only ...
3
votes
1answer
37 views

Field calculate sequential values, but assign same number to duplicates

I work at a company where I have to constantly update parcel maps and generate tables representing landowner parcels. I have figured out how to sort the landowner name field in the table ...
-3
votes
1answer
49 views

if condition depends on first column and the result show at second column in QGIS 3 [closed]

I want to write a condition which depends on first column if found at first column word called long then write red in second column ,if found at the first column also word short then as result ...
3
votes
2answers
75 views

Adding unique id automatically by field calculator as counter in QGIS 3

I tried a lot by field calculator but it gives me null as you show in table and another try it gives me value 1 in all rows. Most of examples, on internet they are exlaining old version and I have ...
2
votes
1answer
86 views

Calculating percentage with comparing two string fields

i have data like below i need output like below
0
votes
1answer
31 views

Calculating median in grouped data using ArcMap [closed]

I got stuck when calculating the median age in grouped data (age ranges) for each feature (each feature is a single administrative unit). I have about 18,000 features. Field names indicate age ranges:...
-1
votes
2answers
50 views

How to sum values across fields, but ignore values greater or equal to 99 [closed]

I have a very large table where I need the sum of values across each field for each record. However, I need to skip or ignore values greater than or equal to 99.
2
votes
1answer
47 views

Saving calculated fields to reuse in other QGIS projects

I am using QGIS 3.4. I want to make attribute tables with many calculated fields that link to styles, and reuse the same structure for many projects. For example, when I draw a pipe (line vector), ...
2
votes
1answer
60 views

Automating Attribute Table with Field Calculator

I'm using QGIS 3.10.0 A Coruna. I'm using the field Calculator for an equation which requires a variable (which I Type in manually) and a (fixed) value within the same attribute table. This variable ...
1
vote
0answers
33 views

Scripting a conditional formula in field calculator QGIS

I'm trying to write down a script in the field calculator but I'm getting to nowhere. In one field I have runoff data, and in two other ones I have the first quartile of the runoff data (Q1) and the ...
1
vote
1answer
28 views

Conditional statement using Long and Text fields with Python Parser of Calculate Field in ArcGIS Pro

I have 3 fields: "ISL_Numero" - Long (values are '1', '2', '3', '4' etc.) "Subtipo_IS" - Text (values are 'A', 'B', 'C' etc.) "Ambiente_C" - Text (values I want to calculate) An example of what I ...
2
votes
1answer
51 views

Using Python script inside QGIS Graphic Modeler and iterating over all features

I created a graphic model which simply creates multiple vector attributes. All attributes are empty to be filled manually. Only one attribute column (let's call it KEYS), needs a different process and ...
1
vote
0answers
50 views

Select characters using regular expression in QGIS

I'm trying to seperate characters from database to seperate fields. Database is like: 999-10-1-1 999-10-11-111 999-10-111-1111 999-10-22-1 999-10-1111-2221 and I want something like in seperate ...
4
votes
0answers
153 views

Is it possible to rename a table column with an expression in the field calcultor of QGIS?

I want to be able to rename a few column names with an expression in the field calculator in order to be able reproduce this action with the QGIS graphical modeler. I tried to do this with the ...
1
vote
1answer
40 views

Calculate attribute table field using a near function (or a similar function)

I'm having an attribute table with a field called 'name' which represents the streetnames of an area. The streetnames are derived from OSM, but unfortunately not all street (or parts of streets) have ...
1
vote
1answer
29 views

Why does Arcpy CalculateField alter string being written to string field?

I have a "Model_Version" field in my feature class that is being used for record keeping. I do not intend to ever do any numeric operations with it, so I am storing it as a string field. Right now ...
2
votes
0answers
53 views

Using QGIS field calculator expression on Execute SQL

The following expression copy only minimum value from group/subset to a new column field in QGIS. Case when "FID_Net"=minimum("class", "FID_Net") Then "FID_Net" Else 0 End But this expression on ...
0
votes
1answer
57 views

Error in Conditional Statement in QGIS Field Calculator

I have a layer with multiple columns as shown in the picture below. If I want to make another column giving 'match' when column 'layer' and 'left(dista' are same value. How can I apply this in field ...
1
vote
2answers
54 views

QGIS - look up Table to feature Layer where Table answers questions to Multiple Columns in Feature Layer

In the image example below: Feature Line Layer = Transport - District Lookup Table = TRAFFIC_IMPACTOR_CODE What is the most efficient way to "connect" (join/relation/query/field calculator) both ...
1
vote
2answers
123 views

Calculate sequential numbers along line

I am looking for a way to calculate sequential numbers in points feature along line. I've got polygon 1 feature intersected with other layer of polygons. Then I extract points from the intersection, ...
1
vote
0answers
41 views

Calculate field with a value in a list based on field

I didn't want to write an if statement for every field. I wanted to know if there was another way to field calculate each field with the values related to it in this example table. Fields (X,Y,...
0
votes
0answers
24 views

Calculating difference between value of each row using ArcMap Field Calculator

Logic: Compute the difference between the angle for each subsequent geometry in the attribute table def GetAngleDif(angle): dif = angle.a - angle.b return dif ERROR 000539: Error running ...
2
votes
1answer
57 views

If two columns match, return only closest absolute value from other two columns

I have a shapefile with points that are joined to the closest twenty points from another shapefile. The joined shapefile has columns from the original shapefile: name (ID), elevation (Z), name from ...
1
vote
0answers
53 views

Use QGIS field calculator raster_value() function inside Graphical Modeler

I need to use the raster_value() function (from field calculator) inside a graphical modeler workflow. The function works if the raster is already loaded on QGIS, and then calling the raster name on ...
0
votes
1answer
18 views

String field being populated with a 0 when field calculating

I am trying to field calculate a text value into a string field and when the process is completed, a 0 is being placed in the field as opposed to my text value. Is there something that I am ...
7
votes
4answers
306 views

Applying field calculator for multiple layers at once

Is there a way to apply field calculator for multiple layers at once? For instance, I have 80 layers as the picture shown below. If I want to apply $area for all the layers, is there a quicker way ...
1
vote
2answers
42 views

Writing if/then Statements for Python Parser of ArcGIS Field Calculator

For some reason I cannot get this code to work in the Field Calculator of ArcGIS Desktop 10.6.1. I'm trying to use the Python parser to populate the field "SHAP_CLAS" with multiple conditional ...
2
votes
2answers
47 views

Conditional label expression gives error in ArcGIS

I have a polygon dataset and I would like to label the area of all polygons which have "kamer" in the column "type". I tried some expressions but I get different Errors. Two examples of what I tried ...
0
votes
1answer
42 views

ArcMap calculate field based on conditional statements for other fields

I have a large dataset of species occurrence records. One field, (call it "Status_Full") contains a string of abbreviations of each designated statutory status for each record. Another field (call it "...
0
votes
1answer
37 views

Calculate Field - Why does the field populate with the same number, but prints correclty?

Why does the field populate with the same number, but prints correclty? import arcpy import rivers arcpy.env.overwriteOutput = True arcpy.env.workspace = r"C:\Data" import math def sinuosity(shape): ...
0
votes
0answers
32 views

Debugging VB script in ArcGIS Field Calcultor?

I work in ArcMap and I would like to use Field Calcultor (VB script) but my script is not working. The message is: there was a failure during processing check the geoprocessing results window for ...

1 2 3 4 5 35