Field calculators (available in QGIS, ArcGIS Desktop, etc) can recalculate the values of a single field on all, or selected, records within a table using an expression.

learn more… | top users | synonyms (1)

1
vote
2answers
98 views

If/else statement in arcgis

I try to fill the fields with the condition if / else but it does not work. I do not know where is my mistake in the code. def TextValue ( !Classe! ): if !Classe! == "Steppe arbustive" or !Classe! ...
2
votes
0answers
21 views

type mismatch: 'esri_8' when using field calculator

I am trying to run the VBScript 'round' function using the field calculator on a column for a numeric field that contains a large number of rows (> 500k). When I run the code on a subset of the field ...
0
votes
1answer
69 views

Using Python for Field calculator?

I have problem with Field Calculator, using ArcGIS 10.2. I tried to write a statement but I don't know what is wrong. I have two columns: The first contains a number code. Every code represents ...
2
votes
2answers
39 views

Calculate Field using Fieldnames(variables?!)

the Question I have is kind of asked before. But I couldn't figure out the solution. ArcGIS 10.2.2 Python 2.7.5 I`m adding fields to a table using user input for the fieldnames. Then I populate ...
2
votes
1answer
105 views

Copy first row of attributes and paste for each feature

In a newly digitised polyline vector layer, there are 7 columns attributes value that are choosen inside a value map combo-box that MUST be exactly the same for every newly digitised line (I choose ...
0
votes
1answer
38 views

Changing Date Format via Field Calculator of ArcMap?

I'm trying to find a function in the Field Calculator (preferably in VB Script) that can add numbers into a field that already has data. I have year data ranging from the 1960s to 2014 in string ...
0
votes
0answers
12 views

Linking Statistics Type with Calculate Field after Table Join using ModelBuilder?

I am attempting to build a model using ModelBuilder in which there is a zone statistics tool being run iteratively for a set of rasters. The input is a blank template table that contains the number ...
1
vote
1answer
48 views

Adding a sequential number using ArcGIS field calculator to string file and keeping the 0 in front of the number? [duplicate]

I want to know if anyone has a code to count +1 starting at a certain number for Field Calc. ArcGIS. (I.e. 04312, 04313) It also must keep the 0 in front. rec=0 def autoIncrement(): global rec ...
0
votes
0answers
40 views

Field calculator and looping for different rows

I have an attribute table as attached and need to use python script code that can hold values as a loop in field calculator model builder and at the end added up all numbers as sum by entering it back ...
2
votes
2answers
46 views

Script (ArcPy) vs field calculator (Python Parser) behaviour of getPart in ArcGIS for Desktop?

From time to time I have to access geometry field and shuffle through points in it. Process is simple: Get shape Get it's part Iterate through part's points This is how it looks like in a script ...
0
votes
1answer
41 views

Using Field Calculator with Python Parser and if/elif statements in ArcGIS for Desktop? [duplicate]

I have tried all of below snippets to use Python Parser in Field Calculator and update the values of a field called type based on a filed called MamerMN but in all of them I am getting Syntax error in ...
1
vote
2answers
65 views

IF THEN statements in ArcGIS Field Calculator

I'm not sure if this would be best handled in vbscript or python, and unfortunately I'm less than novice at both so I'll take any help I can get from the exchange. I'm trying to take my streets layer ...
0
votes
1answer
33 views

CalculateField_management: Different results than in the field calculator

I`m using ArcMap 10.2.2 and Python 2.7.5 I´m tryig to calculate values with the CalculateField_management tool. my script: def mthree(mthre, mtwo): if mthre >= 1: return -3 if ...
0
votes
0answers
21 views

Added Field not showing in calculate field tool in modelbuilder

I am attempting to create a model that adds a field of the same name to multiple output feature classes, then calculates unique values for this field for each feature class. See the model below: ...
1
vote
0answers
25 views

Calculating full text string between two joined tables in ArcMap? [closed]

Using ArcMap 10.2.2, I performed a basic table join between a few of our electric feature classes to update the "Line and Pole" field with the attributes in the "Fuse Size" and "Fuse Type" fields. ...
0
votes
0answers
50 views

How do I calculate the travel time between patients and hospital by helicopter and make a map out of it?

I have a layer(.shp) with hospital location and a layer(also .shp) with pick up positions of patients by helicopter. The table with the position of patients has two columns, one with departure time of ...
0
votes
2answers
48 views

Finding and copying text with Field Calculator in ArcGIS for Desktop?

I'm trying to find every instances of an "Avenue #" in the Name field and have Field Calculator copy that over the single letter written in the Subname field so that both fields look exactly the same, ...
0
votes
1answer
24 views

Populate Integer Field based on Text Field

Using ArcGIS 10.2.2 In the picture below, I want to populate the Spd_Class field (short integer). The value of the Spd_Class attribute will be based on the TYPE field - residential = 30 secondary = ...
0
votes
1answer
48 views

Auto increment field that begins with text in ArcGIS

I am searching for a way to auto increment an ArcGIS field which begins with text and followed by numbers. Ex. SWCL0000. I have tried the auto increment code in the field calculator but once I added ...
1
vote
2answers
56 views

using field calculator on string field that has some empty values?

I have a CityState field that has the city and states of landowners. Bellingham WA, for example. I am making two new fields, OwnerCity and OwnerState in which I strip the last two characters of ...
1
vote
1answer
30 views

Field Calculator Mass Change Freezing issue, Any other options?

I have a list of ~2300 points, that i need to change a whole field's ("JointUse") attributes from null to "N" (for No). I've tried doing the basic field calculator change but I'm assuming since I'm ...
0
votes
1answer
35 views

Extract acres from legal description

I need to extract the acres from the legal description. I have tried "(!Legal!.split(" AC")[-1])" but it gave an error. I am using ArcGIS 10.2 using python in the field calculator. I realized why ...
5
votes
5answers
228 views

How to combine text and integers in a string field?

I have field with numbers in it (field type: double, number format: numeric) and I need to create a new field and put text in front of the numbers. I know that I need to add a new string field, but ...
1
vote
3answers
90 views

Lists in field calculator in ArcMap?

Would anyone please indicate to me why this is not working. I am trying to convert all instances of '02ND' to '2ND' for example where some of the input fields (f1) are already converted and some are ...
1
vote
1answer
46 views

How to calculate azimuth in QGIS field calculator?

Is there any way to calculate the azimuth of two points in the QGIS field calculator? The coordinates are stored in an attribute table. x1 | y1 | x2 | y2
1
vote
1answer
35 views

How do I move the last two characters of a column within the attribute table to another column?

I have data in a column that looks like the below example: El Monte CA I need to move the last 2 characters to a separate column. Which function in the field calculator will deliver those results?
1
vote
1answer
16 views

How to add the values of a common field to a field during union

If I have say 3 overlay features; A,B,C each has a field called FIELD_ID If I do a union, I will get 3 new fields in the output: FIELD_ID_1, FIELD_ID_2, FIELD_ID_3 But how do I get just one ...
0
votes
2answers
117 views

Using Python to field calculate Lat/Long with decimal degrees rather than meters

The below is a snippet of a python script that I am writing that basically adds two fields - Latitude and Longitude, then calculates them. I could use the Add XY Tool which gets me to the same point. ...
1
vote
0answers
35 views

Using ModelBuilder or Python parser of Field Calculator to check values between two datasets?

I have a *.dbf that I need to check values against for a shapefile. I need to report whether the values match the dbf in the shapefile and, if not, what the value should have been (in two new ...
0
votes
1answer
35 views

Calculate field value based on lat long. Have longitude values which are negative?

Very new to python, fairly experienced with ArcMap. I am trying to create an alphanumeric index based on point locations My code string for the numeric part is here: def calc(!LONG_x!): if ...
1
vote
1answer
51 views

Calculating a z value in python

I have some contours where the z value is stored in the geometry and I want to display it as an attribute. I want to include this in a python script. I have an expression which does this in python ...
0
votes
0answers
33 views

How can I convert Decimal to DMS for QGIS reprojection?

I have the following Lat/Long which I converted to DMS using the following calculator: Decimal DMS -96.2 96 12 0 -95.13 95 7 47.9994 29.3 29 18 0 29.98 29 58 55.1994 ...
0
votes
1answer
25 views

different data types in ArcMap field calculator?

I would like to run the following pre logic code in the Arcmap field calculator: def calc(f, fn, f1, f1n) f= str(f) f1 = str(f1) f = f.replace(" ", "") fn = fn.replace(" ", "") f1 = f1.replace(" ...
0
votes
0answers
46 views

simple if statement in ArcMap field calculator

I have two fields containing string variables. The first one is f and the second one is f1. I would like to create a new field and populate it with the following: if f1 is equal to f, return f1 if ...
2
votes
0answers
34 views

Creating a weighted rating model/script for vector data

I'm using ArcMap and trying to create a model or script that can rate routes based on a weighted calculation of attributes. Right now the individual attributes don't have rating values which I could ...
1
vote
1answer
43 views

How to search for a specific field and then use it in Field Calculator

I have a piece of code where the goal is to search through the field names within a feature, select any field based on a specific character (in this case "z") and then use that selected field within a ...
5
votes
2answers
129 views

How to calculate with time values in QGIS?

I have two string fields in a vector layer, "From" and "To", with values in the format of 10:16:30 and 10:18:00 e.g. I would like to calculate the difference in minutes as a decimal value, in this ...
3
votes
2answers
84 views

Which python function should I use to populate a string field based on a numeric value from a numeric field in ArcGIS Field Calculator

I am new to Python and I'm trying to write a simple if then statement in Field Calculator in ArcGIS 10.2.2 that will take the values from a numeric field and add them to a string field. I can't ...
4
votes
1answer
100 views

Replacing multiples words using field calculator in attribute table python

I need to replace multiple words with one word in a field at one time in one script. Example in my LettersField I need to replace all the "Aa" and all the "Bb" and all the "Cc" with "Rr". I am ...
0
votes
2answers
56 views

Using python string wild cards within the field calculator ArcGIS 10.3.1

I have two fields. One field has an ID. The other field has a list of ID's. Using the Field Calculator I with to calculate 1 or 0 if either field contain the same ID number. I was successful at ...
1
vote
3answers
81 views

Autopopulating text field with string and number combination

I have an attribute table with a text field which indicates a unique identifier for each row. The identifier includes a combination of text and numbers, sequentially increasing, as follows: ...
2
votes
1answer
100 views

Why is arcpy.CalculateField_management() writing 1899-12-30 00:00:00 instead of expected date?

I'm using ArcGIS 10.3.1 for Desktop to test before writing an answer to How to enter date with arcpy.GetParameterAsText with arcpy? I have written the test code below that I am running against a test ...
0
votes
1answer
53 views

Using If Statements in ArcGIS Calculate Field?

I've never used Python scripting before and can't seem to figure out how to use an If statement in the Field Calculator tool. I have a field called 'MAX_GRIDCODE' which returns the highest force a ...
0
votes
1answer
58 views

Create a Loop for Arcpy

I am looking for help to write a loop a arcpy.CalculateField_maagement process where the User is asked with the 'raw_input', prior to the tool running "Do you need to change a field value(yes/no):", ...
0
votes
1answer
61 views

Unique ID script field calculator

I need to generate a unique id using field calculator in ArcMap. I am a student and I am having problems finding the script or getting auto increment to work or anything else.
2
votes
1answer
47 views

How can I copy non-blank values to a new column from different columns in the same layer in QGIS?

My data: n1 n2 n3 NEW_COLUMN 11 null null null 33 null null null 55 My desired result: n1 n2 n3 NEW_COLUMN 11 null null 11 null 33 null 33 null null 55 ...
0
votes
1answer
39 views

find all the null records for all fields in a shape file

I figured out that I can use field calculator on a single column in arcgis 10.3 attribute window as follows: def RemoveNULL(x): if x is None: return '' elif x == '': return ...
0
votes
0answers
18 views

How to create new field using the values of one attribute column multiplied by a constant number in Qgis or ArcGIS [duplicate]

I have point data that has a small length attribute - I want to times this length attribute by a constant number (I need to trial a few different constants) to find the diameter of a protection zone ...
1
vote
1answer
50 views

How do I Calculate Grouped Percentiles or Batch percentiles in ArcMap?

My question is similar to this one which was answered successfully: Calculating Percentiles in ArcMap? My addition is how do I batch this solution for multiple files or apply a group-by feature to ...
0
votes
2answers
71 views

Remove first seven characters from field string using Field Calculator

I wrote an expression/codeblock that removes the words "Nearby:" from the field value string if it has it. Codeblock: import string def splitme(s): if s[:7] == "Nearby:": aList = ...