# Tagged Questions

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.

80 views

### Using Advanced Python Calculator in QGIS Modeler

I'm trying to create a column with integer values based on a small function that basically uses conditional statements. In short, a reclassification. My attempt below: def getValue(Etat): if Etat ...
470 views

### Easy way to sum up a lot of values?

I've got a shapefile that was made by the mother of all Unions. Because of that, it's got about 400 columns, and I want to sum about 100 of them (specifically, the "Score" from each). Is there an ...
96 views

### Conditional Statements in Arc Map 10 (field Calculator)

I'm attempting to calculate the values of a field based on IF THEN statements in ArcMap 10 (in field calculator) but I haven't succeeded yet on that. What I want to add is the following expression: ...
70 views

### CalculateField with variables

I'm trying to make a python script on arcmap 10.2.2 which will copy values from an old field (selected by the user) and paste them in an new field (named by the user). I wrote that: fc = arcpy....
160 views

### Calculating Sinuosity Using ArcGIS Field Calculator

Trying to calculate sinuosity via Field Calculator (ArcGIS v 10.2.2); VBA Pre-Logic Script Code: Dim dblLe as double Dim dblLf as double Dim dblS as double Dim pCurve as Icurve Dim pFPoint as IPoint ...
129 views

### Counting Features to Calculate Field Value

Generally, I am trying to find the # of features in one shapefile within 1000 feet of EACH feature in a second shapefile - and then populate a field in the first shapefile with that #. More ...
2k views

### Creating Conditional Statement in QGIS Field Calculator

I've looked up some of the other threads on this topic, however, none have addressed what I am seeking to do. Essentially I have a large data set and I would like to search one field for any values ...
56 views

### Field calculator with next() function? [closed]

I want to do calculate with script, field - field.next () with incrementation of 2 rows
88 views

### Replace Expression in Field Calculator to include a Numeric Range

There has to be an easier way to clean up address data, I hope? GeoCoding, I need to remove APT# and any number or letter that follows.
94 views

### delete a space with the field caculator

I would like to delete the space in this number like this 'F00 089' with the field-calculator. Is theres a function in the field-calculator? ! see my screenshot
156 views

### Field Calculation Python acceleration of gravity [closed]

In my problem i have a column DISTANCE and a column TIME and i want to calculate with python in field calculator how much time it needs to make that distance (for example 1000m) if you are moving with ...
147 views

### Split a string between 2 characters

I have the following string in Arcmap: "Node 1_1234.23,Node 2_567.88,Node 3_45.25" I want to return the numbers between the "_" and the "," into three columns e.g "1234.23" in column A "567....
236 views

### Create new attribute ranking polygons by size in QGIS

I'd like to create a new field in the attribute table which gives the rank of the polygon by size. For example, the polygon of the largest size would be rank 1 and the smallest rank N. I was hoping ...
206 views

### How to generate random points from FIDs using ArcPy or ArcGIS Field Calculator?

I'm trying to generate a shapefile of random points using FID from the attribute table. My attribute table has 800,000 features and I only need a sample of 240. Is there a way to do it in arcpy or in ...
105 views

### Add and Calculate Field in Table with ArcPy?

I have written the following script to iterate it as a tool for all my tables with ModelBuilder, but i have a problem wth my codeblock. I want to add a field FID to all my tables and to add the values ...
118 views

### Field Calculator Script

I am looking to check how up-to-date a feature class is by using our latest parcel update. I am wanting to check "owner" field with "Owner_1"...I am using field calculator to grab the last name in "...
938 views

### Area is calculating wrong using \$area in field calculator (QGIS 2.8.1-Wien)

There is a similar question posted, but the solution to it seems to be that polygons were multipart: Wrong \$area from field calculator (QGIS) In my case, all polygons are singlepart. I have several ...
2k views

### VBScript - If/Then Statement - Field Calculator

I am trying to do a simple (or so I thought) if/then statement in the ArcGIS field calculator. I am trying to add the HydroCode field - hydologic soil codes - to an existing data set. I know what the ...
65 views

### Update all cells in column to match value of first row?

I have a point layer; the attribute table includes x and y coordinates of original centroids associated with the points (the points were generated from the perimeters of circle features and still ...
99 views

### How to update a bulk selection of fields using field calculator in QGIS 2.8.1

I have an attribute table showing vegetation communities. The table has three columns ("ID", "Veg Comm" and "Area_ha". Instead of having to copy and paste text after each polygon created into each ...
387 views

### Error msg “Name is not defined” when trying to populate a field with the shape file name

I am trying to populate a field with corresponding file name. For example, if the file name is Route1.shp then the field value will be Route1 as well. However my code is not working. Can you please ...
89 views

### Generate a string based on an integer range

After some initial research, I was unable to find a solution for the following issue. I'm sure there's an answer to this question already floating around here somewhere, but hopefully someone can give ...
536 views

### ArcGIS Python if statements say field not nullable?

I am creating a new field - let's call it A (SHORT INTEGER) in shp file using Modelbuilder and I need to fill it it with the values from two different fields. First step is to fill field A with the ...
142 views

### How to use QGIS field calculator between different points of same layer?

I'm in a course learning about GIS systems, and we have recently recorded a gps track. I've exported this track as .gpx and imported the points into QGIS. Each point has a timestamp. One of the ...
129 views

### Field Calculator convert text to integer then populate new field with sum [closed]

I have a .dbf with about 50 text fields containing numerals, I would like to convert those to integers and then sum them all in a new double field I created, is there an easy field calculation that ...
64 views

### Using field Calculator for time in ArcGIS 10.2

I have a new field in a shapefile with the property "Date". I want to fill it with "9:00:00 AM". I tried several ways of using field calculator, but it gives date instead of time. How could I do that?...
256 views

### How to remove a certain number of digits from the front or end of an attribute field?

Can I use the filed calculator in QGIS somehow to remove the first 4 numbers in all attribute fields in a column? Example 16011234 -> 1234 EDIT: Silly, I can just subtract with 16000000 in this ...
80 views

### Using “calculate field” in python script fails to display Arabic characters correctly

Using “calculate field” in python script fails to display Arabic characters correctly. I have exported the modelbuilder to python script, but unfortunately the Arabic characters cannot by displayed ...
133 views

### Calculate area intersected areas, problem [closed]

(I'm working in QuantamGIS) I intersected two layers creating a new layer. Within the attibute table of this new intersect layer i would like to calculate the new areas. However, it just doesn't ...
105 views

### Combining and extracting attributes from 2 columns to populate a third (Concatenate)

I am working with a FEMA flood zone shapefile which contains a FIELD_ZONE field and a SUBTY field. I created a third field called ZONE_TYPE that needs to be populated by combining or extracting ...
887 views

### Python script for Field Calculator. ArcGis 10.2.2

I have a point shapefile with two columns i want to process. The first column is aspect and the second is aspect_m60, there is only one row with the aspect of my point. I have tried to write a script ...
3k views

### How to summarize a column in QGIS field calculator

I have data with a column containing a number value, and I want to divide the value of each feature by the total sum of all the values in the column (to get a percentage). So I would like to know if ...
80 views

### How can I make attribute table field dependent? [duplicate]

In an attribute table I am making new fields bounded each other by the Field Calculator. Once I have written the formula for the new field in the Field Calculator, ArcGIS make the calculation for the ...
75 views

### If statement problem in Field Calculator - Arcgis

I have a field entitled "Lung_lunc". It contains some "0" values and the rest are values > 0. I want to turn those "0" values, into "0.0001". I have added a new field: "Lung_lunca", and I want to use ...
123 views

### How do I add rows together to populate a new field?

How do I add the values in columns 11_acciden, 12_acciden, 13_acciden, and 14_acciden in order to populate the total_acci column?
1k views

### How to fill the column in attribute table with same values?

I have about 19000 records, I added new column and I would like to fill it with string values (eg. brand)- same value for all rows. I'm not considering copy/paste. I know I could do it with exporting ...
252 views

### How to assign a unique ID to groups of items in the attribute table in ArcMap?

Using arcmap's field calculator I need to programatically loop through all of the entries in the field and for each name it gets its own unique id. So names that are the same would get the same ...
106 views

### ArcGIS Field Calculator nested elif is None not working

I am calculating a field based on two other fields in ArcMap 10.2 using python. My Pre-Logic Script Code is def myfunc(legend,Btype): if(legend == 'Apple'): return 'Banana' elif(legend == '...
244 views

### Performing math in Python parser of ArcGIS field calculator?

I never used python but now I need a code to do this calculation: I'm doing this: math.atan(math.fabs( !Y2! - !Y1!)/math.fabs( !X2! - !X1!) )*(180/math.pi)
504 views

### How can QGIS Field Calculator sum values from a spatially joined table?

Can the Field Calculater be used to sum values from a related table via a Spatial Join? I have two vector polygon layers A and B, each with a numerical column VALUES. I want to update VALUES in ...
175 views

### Combine string and OBJECT ID

I would like to update the Map_Feature_ID field with a String " WP_" and then follow the "WP_" with the OBJECTID field. So I will end up with "WP_1", "WP_2" all the way to the end in the Map Feature ...
211 views

### Rewriting VB codeblock as Python for ArcGIS Field Calculator?

I am looking for assistance to rewrite my VB codeblock into Python. Im on Win7, Arc10.2 and Python 2.7 The code below works fine for me, I am simply looking to port it to Python so i can progress down ...
148 views

### Coordinates for specific points calculated in QGIS Field Calculator?

I have got a layer in QGIS that is comprised of connected points which define regions of a country, thus the attribute table consists of 38 regions while the number of nodes in this layer is about ...
103 views

### Using Python parser of ArcGIS Field Calculator to populate values in one field based on those in another?

I am trying to populate a field with a sorting code that represents the value of another field. Example: EXPCODE|SORT| S4DNN2 |3.5 H2BNN2 5.0 EXPCODE is a field with a value like "S4DNN2." SORT ...
321 views

### Getting and using XY centroids in ArcGIS Field Calculator using Python Code Block

I am writing a script to obtain Grid reference but cannot fathom how to get XY centroids without creating new fields (all examples I have found are based on writing XY centroids to field). Here's ...
89 views

### Using defined function code block with Python in ArcGIS

I am running a Field Calculation within a Python script in ArcGIS. Within this Field Calculation I am calling a defined function within a code block. Here is the dialogue that I ran and works: ...
157 views

### How to add multiple python expressions in field calculator

How would I add multiple python expressions in the ArcMap Field Calculator if possible? I tried separating each expression on a new line and also separating with a semi-colon but neither worked. ...
67 views

### How to add “0” to multiple parts of text value in Field Calculator with Python

I have values in a text column that are as follows: 000_100 100_200 ... 1000_1100 1100_1200 I want it to read: 0000_0100 0100_0200 ... 1000_1100 1100_1200 I want all values to have the ...