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
3answers
70 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
votes
0answers
16 views

how to use any tools in Calculator for GIS [on hold]

I want to learn how to use any tools in Calculator for GIS. I know use to +/*- but i cant use to such as ( Sin, Tan ) and alle tools.. Can you hellp me?
1
vote
1answer
247 views

How to create sequential field based on sorted data? (or extract pop-up data?)

I downloaded a kmz field and converted it to a GDB fc on arcmap. However, the field I need to label the layer by is stored in the pop-up html field... It looks like this: <html ...
1
vote
0answers
31 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 ...
1
vote
1answer
34 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
29 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?
0
votes
2answers
64 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. ...
2
votes
3answers
2k views

Use Feature Class “Name” from Iterate Feature Classes to Calculate Field with Model Builder 10.1

My goal is to create shapefile that contains merged feature classes from a geodatabase. I would like for there to be a new field in the resulting shapefile that contains the name of the original ...
1
vote
1answer
52 views

Trying to export stacked text to CAD using ArcGIS 10.2

I've been experiencing some unwanted results when trying to export stacked text to CAD using ArcGIS 10.2 for desktop. With the Export to CAD tool I can easily export polygons. However, I'm also trying ...
1
vote
1answer
13 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 ...
-1
votes
1answer
85 views

Field calculator (using ATAN)

How do I input the arc tan in the field calculator given the values of the fields to get the desired answer, I compare the answer of the manually computed arc tan value and the Atan Spatial Analyst ...
1
vote
1answer
43 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
1answer
30 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 ...
0
votes
0answers
29 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 ...
2
votes
0answers
33 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 ...
0
votes
1answer
24 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
34 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 ...
8
votes
2answers
296 views

How to refer to another layer in the field calculator?

Is there a way to select an attribute from a polygon layer and insert the value into a virtual field of a point layer using "within" in the field calculator? CASE WHEN within($geometry, ...
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 ...
4
votes
1answer
87 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 ...
5
votes
2answers
106 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
65 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 ...
1
vote
2answers
1k views

Debugging ERROR 000539 from CalculateField in ArcPy?

I previously successfully used the sample code here: How to calculate Field using part of filename in ModelBuilder? # Import standard library modules import arcpy, os, sys from arcpy import env # ...
2
votes
4answers
243 views

Field Calculator Python Expression Issues

I'm pretty new to Python and this is my first post on this forum so I could use some help. I am currently attempting to run some code in the Field Calculator in a model in order to replace string ...
0
votes
2answers
44 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
77 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
73 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 ...
8
votes
3answers
1k views

python script error- with GetParameterAsText [duplicate]

I have a seemingly simple code which iterates through a list of feature classes and calculates an ID field in the attribute table that is equal to the first 5 characters of feature class name. The ...
9
votes
8answers
11k views

How to Remove return/newline (\n) character from Field using Python and Field Calculator?

I have a geodatabase table with a field that I'm trying to remove return characters (new line). I found this post (How can I remove (chomp) a newline in Python?) of how to do it, however it is not ...
6
votes
1answer
130 views

How to remove comma from combined fields which should be null?

I have Drivers License as one field and State as the other and there are to be combined and formatted as Drivers License, State. How do I handle records that do not have either a Drivers License or ...
3
votes
1answer
889 views

Calculate attributes to table based on other attributes

I am going through thousands and thousands of road lines and giving them a value based on QC with imagery. So for instance for the add_data field I give it one of these five numbers: 0 = not ...
0
votes
1answer
54 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.
0
votes
1answer
47 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 ...
1
vote
1answer
46 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
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):", ...
2
votes
1answer
41 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
35 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 ...
1
vote
3answers
3k views

Replacing NULL values in geodatabase table?

How do you update NULL values within a geodatabase table using the ArcGIS Field Calculator (service pack 4) without changing other values to NULL? I've tried the suggestions on this previous ...
1
vote
1answer
53 views

If/then python for classifying existing field values to a new field

I'd like to have a tool or quick python script to classify an existing number field to a new text field. For example I have a roads layer that has a type identifier as a coded number and I would like ...
0
votes
0answers
17 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 ...
0
votes
2answers
68 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 = ...
0
votes
2answers
50 views
1
vote
1answer
29 views

VB Script case statment syntax for the field calculator in ArcGIS 10.2?

Can anybody help me with this VB Script code for the field calculator in ArcGIS 10.2? Why in the final result are all the values 10? a= 10 Select Case UCase( [PRIORITY] ) Case "AUX 1": a = 22.5 ...
6
votes
1answer
203 views

Calculating a Unique ID on a Subgroup of Polygons

I would like to assign a unique ID to polygons in a dataset. The catch to my issue is that I would like polygons that fall within a polygon to have the same unique ID. My example is related to ...
2
votes
1answer
27 views

Alphabetical Sort within a Record

I am performing a union on a polygon feature class with multiple overlapping polygons. Each of the records in the resulting feature class can be thought of as "unique area" polygons made up of the ...
2
votes
3answers
138 views

Using .len() in IF THEN statement in ArcMap field calculator

I have a string field with values of varying lengths (1-4). I need each value to have a length of 5 characters by adding zeros to the value until the length equals 5. For example: 123 needs to ...
3
votes
1answer
47 views

add text value to attributes

this is a novice question I have an attribute field that's missing a piece of information, i'd like to amend the attribute field like below: This is the current attribute field: "V:\Building & ...
1
vote
0answers
42 views

If then statement in model builder

I have a model that adds several fields, two which are manual inputs (County Name and User). I am manipulating several parcel layers (approx 90 counties). In my model, one field takes the state and ...
1
vote
0answers
25 views

Forcing area calculation into miles in QGIS (without changing the PCS) [duplicate]

I'm working on an assignment that requires me to create an area column in miles without changing the projected coordinate system. ArcGIS has a tool that can do this ('Calculate Geometry')-- does QGIS ...
4
votes
4answers
2k views

Calculating X and Y of line start and line end using ArcPy?

I have a series of polyline shapefiles and I am trying to automate the process of calculating the X and Y coordinates of the line start and line end using Python. I have added the 4 fields (startx, ...