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
votes
1answer
21 views

Python Contour index [closed]

I'm getting my feet wet with python in the field Calculator. I'm working with contour data and I'm looking to see if someone can help me. I basically need to do this, but with python.
2
votes
1answer
42 views

QGIS Calculate Field with Function Editor invalid expression

I have some data which is built like this: a,bbb,ccc where bbb and ccc vary in length. I want to extract the last segment of the string, after the second ",". Using the Function Editor: from qgis....
-1
votes
0answers
319 views

python script to calculate and return values based on several conditions [on hold]

I need to calculate and return the value "continuous" to those records in a polygon feature class with species records aggregated to a UTM grid considering the attributes are species name, grid code, ...
1
vote
3answers
136 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: PHOTO_0001....
0
votes
0answers
21 views

Calculating multiple text fields based on other fields in ArcGIS Pro?

I have an attribute table with two types of text fields (34 of each). One type attributes an "r" or a "d" for each feature. These fields represent the voting results in either presidential or ...
0
votes
1answer
21 views

Python code in ArcGIS field calculator error?

I've tried writing a code block using the Python Parser of the ArcGIS Field Calculator. Here's what I am trying to achieve: There's a field in my attribute table with values for some, but not all of ...
3
votes
1answer
63 views

Why are QGIS field calculator statements (both IF and CASE) giving strange results?

Using the field calculator, I'm trying to update an attribute only if it equals to zero: CASE WHEN "Z" = 0 THEN "Z" = rand(1,100) END This let the 0 values as they are and updates all others to "...
5
votes
1answer
13k views

Elseif Conditional Statement in QGIS Field Calculator

I am trying to write an ELSEIF conditional statement in QGIS Field Calculator (version 1.8.0). I have used an example I found online: CASE WHEN val < 0 THEN 'negative' WHEN val = 0 THEN "neutral'...
7
votes
1answer
2k views

Get shape filename in attribute field using field calculator

I apologize for crossposting against the ESRI geoprocessing forum, but it seems like this one gets answers. I'd like to have a modified append tool (ArcToolbox) that takes multiple shapefiles with ...
0
votes
0answers
1k views

Getting shape filename in attribute field using field calculator with VBScript?

I want to store this shapefile name in an attribute field using the field calculator and visual, but can't find the way to do it. Can anyone help me?
0
votes
1answer
16 views

Making copy of attribute within attribute table in ArcGIS for Desktop?

Using ArcGIS 10.2.2 for Desktop, I simply want to create a copy of one of the columns in my attribute table. I created a new column by choosing 'add field' in the attribute table, however I can't copy ...
1
vote
1answer
17 views

How to rearrange the value of a Date Field in ArcGIS (05/30/2014 -> 2014-05-30)

Can you rearrange the text in date field type in ArcGIS? Eg. Map_Date - 05/30/2014 (I want to reformat this to 2014-05-30) I've been trying to use the field calculator on all my records, but cannot ...
0
votes
0answers
14 views

How to concatenate column attributes into a single column where we don’t know the number of columns or the names via arcpy? [closed]

I have lots shapefiles all with different columns except for a standard ‘name’ columns. Since the other columns are all different, I want to dump them into one large text column. It would be nice to ...
2
votes
1answer
131 views

Scoring fields between 0 and 1 using ArcGIS field calculator?

I am starting to get to know ArcGIS 10.2.1 and I need to the following, but I am not sure how to build the expression into the FIELD CALCULATOR: I need to add first a new field called ...
4
votes
1answer
135 views

Using ArcGIS Field Calculator to populate new field from old field?

I'm trying to assign speed values to street types using TIGER street shapefiles. So I created the new field for the speed, and I was going to use the field calculator to take the MTFCC classifications ...
0
votes
0answers
13 views

Assigning value to features with same attributes in table using ArcGIS Field Calculator? [duplicate]

I have a lot of polygons features with same NAME values - A1, A2.., etc. I want put value into field OBJECTCODE based on Excel table "rules"(A1->10001...) and asign values to complies with value in ...
-1
votes
1answer
315 views

UnboundLocalError: local variable referenced before assignment wthin model builder iterator in ArcGIS [closed]

Within an iterator in Model Builder in ArcGIS I am trying to calculate a field value based on the inline variable substitution. In the picture I have renamed the tools with the corresponding inline ...
0
votes
0answers
15 views

calculate new point given distance, bearing, lat and lon Right lat result but wrong lon

I have been trying to get this program to work right, but somehow, although my formular seems right, my calculation for the longitude is off. I want to make a plugin for qgis with this code, or find ...
1
vote
1answer
20 views

Code Block for Calculate Field Excluding “No Data” Values in a Feature Class in ArcGIS Pro

I am trying to calculate a field (NAT_RE_MI) by simply adding three other fields (FOR_FISH, MINING, FARM_EMP) together. Some of the fields have a no data value of -98 or -99. What code would I ...
2
votes
1answer
52 views

Python if, and, or to compare field values and assign new value

I have 3 fields in a table that i need to evaluate and return a new value based on the results using the field calculator (PYTHON) They are: SETSPAID (long) This field must = 0 TYPEOFSERVICE (string)...
3
votes
2answers
72 views

How to give polygons a classificaton code in ArcGIS?

Does anyone have a trick for assigning polygons a code based on the classification classes? For example, if I symbolize the population of census blocks with 10 classes using Natural Breaks, I would ...
3
votes
2answers
46 views

Describing input field in ArcMap Field Calculator window?

A few days ago I was answering Comparing two fields and printing result as 1 (if number matches) or 0 (if not) using Python Parser of ArcGIS Field Calculator? When describing the process required ...
1
vote
1answer
41 views

Using “right()” and “strpos()” to get rightpart of string for QGIS Field Calculator?

The strpos() function searches from the left side of the string. But instead of always trimming the string, I would like to get the position from the right side. Is there anyway to do this in the ...
1
vote
1answer
28 views

error with python script in field calculator

I am using ArcGIS 10.3 version in desktop. I wanted to assign landuse names (Landuse_04 column) based on the codes those are in my attribute table as the column ID_MAP. once I am done with editing the ...
3
votes
2answers
52 views

How to split string (the last digits) in QGIS?

I´m working with QGIS 2.12. Is it posible to split string "from the right side" (it means I needed the last text from every field)? In one field I have description like: new street 25 old street 2 ...
7
votes
1answer
73 views

How to undo field calculation in ArcGIS Pro

I am using ArcGIS Pro and cannot find a way to undo field calculations. With ArcGIS 10.x for Desktop, field calculations could be undone when an edit session was active, but Pro seems to be in a ...
7
votes
4answers
4k views

Removing numeric characters from alphanumeric value in field calculation?

I have a field containing alphanumeric values in the following format: A-AA00 Sometimes they are also A-AAA0 I need a Python script I can put in the field calculator in ArcMap 10 that will at ...
7
votes
3answers
303 views

Removing multiple characters from string field using Field Calculator Python Parser?

Is it possible to remove more than 1 character from a string in a field using the field calculator? I know !file!.replace(" ","") removes spaces in a string, but is it possible to remove spaces ...
7
votes
3answers
4k views

Calculating Field based on name of shapefile

I have multiple shapefiles to which I have added a field called "gname1". For each shapefile, I want "gname1" to be set to the name of that particular shapefile, for every feature within the shapefile....
9
votes
2answers
6k views

Converting from DMS to DD using Python in Field Calculator?

I need to convert lat/long that is expressed as degrees, minutes, and seconds in the data into decimal degrees. For example, in the data, they are listed as N335042.06 in the Latitude column, and ...
10
votes
8answers
14k views

Removing 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 ...
10
votes
3answers
9k views

Rounding column in attribute table using ArcGIS Field Calculator?

I want to use the Field Calculator in ArcMap to round an existing column to two decimals. Currently I have a column that is 6 decimal places long and would like to simply round it down to 2 decimals. ...
5
votes
1answer
216 views

Extracting partial data from one field to another using Python Parser of ArcGIS Field Calculator?

I am attempting to extract a date stamp that is contained in one field and insert it into another field. The issue is that the date (in bold below) is not in the same location in each line of the ...
2
votes
1answer
37 views

QGIS Field Pyculator Reclass

I'm new to the QGIS Pyculator and need to reclass a field ('AP') based on another field ('Mag'). What I have so far, from the ArcGIS field calculator: def Reclass(Mag,AP): if Mag>= 2000: ...
2
votes
0answers
626 views

Cause of Field Calculator UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 5: ordinal not in range(128)? [closed]

def Befahrung(value1,value2): if value1 is ' ': return ' ' else: return "G:\\Example\\" + str(value1) + "\\File_" + str(value2) + ".pdf" I try to create a field with a hyperlink. It works ...
7
votes
3answers
5k views

How to replace non-English characters in attribute tables using Python?

I have a few shapefiles where some of the attributes contain the non-English characters ÅÄÖ. Since some queries doesn't work with these characters (specifically ChangeDetector), I tried to change them ...
-1
votes
2answers
59 views

Generate random floating value

I need to generate random floating numbers between 0 and 1 in the field of attribute table for ArcGIS 10.3 version.
1
vote
2answers
67 views

Parse multiple field in field calculator using python

I'm trying to fill a blank field depending on the contents of three other fields using python in the field calculator. Sample code is something like: def getClass(Text1,Text2,Text3): if Text1 is ...
1
vote
2answers
497 views

Is it possible to have auto-updating area fields?

I'm using QGIS 2.4.0 and I've noticed some problems with the derived area and the $area field. Firstly, I have a polygon which is a filled ring, inside another polygon. The derived area, and therefore ...
2
votes
1answer
72 views

QGIS graphical modeler calculator

My question is about the calculator in the QGIS graphical modeler. I explain my problem issue first: I want to build a modeler that creates buffers around layers and makes a selection on a second ...
0
votes
3answers
49 views

Volume using VB Script of the field calculator

I am trying to compute the volume of the area given certain condition. i wrote the following VB code however, i am getting error that it has failed to do so. Can anyone look into it and suggest a way ...
2
votes
1answer
40 views

How to auto increment a field based on groups within a feature class

I am needing to auto increment a field based on groups within a feature class. I have 8 plots within a given polygon and I need to assign them an ID from 1-8 for each set of plots within each polygon. ...
0
votes
3answers
59 views

Using if else syntax in field calculator with Python?

I want to calculate a field in the field calculator that are dependent on the values in 4 other columns. My columns are "A", "B", "C" and "D" Now I want to fill the column "X" with: if "A" and "B" ...
0
votes
1answer
41 views

How do I make a field of summarized zip codes, 1 for each, put it into my data table and join the table to shapefile without losing data?

I'm trying to use a field in my shapefile with summarized zip code data. I have a table of hospital admissions data and in this table there is a field of zip codes which are repeated multiple times. ...
2
votes
2answers
5k views

Replacing NULL value with Zero in geodatabase table using Python parser of ArcGIS field calculator?

I am having some difficulties to change "NULL" values to zero in geodatabase. I have tried the following python code in ArcGIS 10.1 ("Field Calculator") to change it but did not work. Pre-Logic ...
3
votes
1answer
74 views

Python to create new fields in many layers / QGIS

I have a number of line layers on which I need to perform the same task: add 4 columns with the start and end points of each line. The expressions that I use to do this are: $xat(0) $xat(-1) $yat(0) ...
3
votes
1answer
42 views

An equivalent for field statistics for records

I know how to obtain various statistics for a field, or "column", in an attribute table in ArcGIS. Is there any way to obtain a Mode figure for records, or the "rows" in a table? For instance, an ...
1
vote
1answer
41 views

ArcGIS Calculate Field, Python Shape Expression

Using ArcGIS 10.1 and Python 2.7- I am trying to write an expression that calculates the mid point of a line. I've tried many different expressions, but I continue to get syntax errors. #An example ...
0
votes
0answers
19 views

How to accommodate hyperlinks that have a changing date?

I have an installation with close to 400 building, when I click the identify tool in ArcMap 10.3 I would like to be able to select a hyperlink that takes me to a floor plan PDF. All the floor plans ...
3
votes
1answer
38 views

Using ArcGIS Field Calulator with VB Script

My code looks like the following: if [LWS50yrp] <136.5 then [DMG_50y] = 0.1 elseif [LWS50yrp] >=136.5<154 then [DMG_50y] = 0.15 elseif [LWS50yrp] >=154<166 then ......