The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
2
votes
3answers
15k views

Using if/elif/else statements in ArcGIS Field Calculator?

I have no experience with Field Calculator in ArcGIS 10. I have a very simple calculation I would like to perform that I could do easily via pure SQL but just can't seem to get my head around it in ...
1
vote
2answers
2k views

ArcPy Field Calculation with special characters

I'm trying to calculate a string field, using "µSv/h". Running this in the manual field calculator works just fine, but I've tried this in the Python window in ArcMap as well as the IDLE, but both ...
26
votes
3answers
10k 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, ...
13
votes
1answer
23k views

Calculate area within Python script in ArcMap

I am trying to calculate the area of a polygon within my Python script. I create a new polygon from merging two together, and I'd like to add the area of the resulting polygon to a field in the output ...
9
votes
6answers
8k views

Creating label formatted like “ 1,000' ” from numeric field?

This question builds on a previous question I came across at gis.stackexchange: How to easily edit attribute data using Regular Expressions? Perhaps someone can point me in the right direction? I ...
11
votes
3answers
19k views

How to use the replace string function in Field Calculator?

Within an attribute table I'm trying to replace one string with another using the 'replace' function . As an example, there are a number of features whose field 'NAME' contain the string '(B)' and I'...
8
votes
2answers
4k views

How to add a sequence to the attribute table?

Is there a way to use the field calculator in QGIS to create a range of values in a count sequence with a specified input range? For example, if I wanted to have the values 1 to 5 repeated within my ...
8
votes
1answer
1k views

How to add attributes in proportion to intersecting area from another layer

I am new to using QGIS. I have two polygon layers: Voronoi of Access Points Census block maps with population I want to get number of people covered by each Access Point (Assuming uniform ...
5
votes
4answers
20k views

How to replace null values in attribute table ArcGIS 10.2

I have a string field 'Oneway' with three values '+' '-' and Null showing a street accessibility, I would like to replace them with values 'F' 'T' and null as the script for Network dataset expect ...
5
votes
2answers
6k views

If/then VBScript/Python code equivalent to SQL IN ('x','y',z') expression in ArcGIS Field Calculator?

we need just like the following, only with multiple records selected... have tried the "xyz" in (1,2,3,4,5) SQL code but of course VB Script wants something else. dim f2 if [field1] = "foo" then f2 ...
3
votes
1answer
2k views

Calculating angle between polyline segments and assign this value to point?

I have a polyline feature with many segments (polyline split at vertices). I plan to record angle values to attribute table per each polyline segment and assign it to point features. I need to ...
8
votes
1answer
8k views

How to measure areas of features in OpenLayers plugin background maps correctly?

I can't figure out how to make areal calculations (eg. in km2). I have tried the 'field calculator', I have tried the 'measure area' function on the "attributes" toolbar, and i have tried fTools in ...
7
votes
1answer
5k views

How to use QGIS field calculator in python?

I would like to use QGIS Field Calculator in Python to update the existing column based on certain conditions? How can I do this?
5
votes
2answers
6k views

Calculating the average / MEAN of an attribute field in a QGIS model

I need to know how to calculate the average / mean of an attribute field in my point shape file. Is this possible to do with the field calculator? I just found the options min or max but not mean. The ...
2
votes
1answer
5k views

Concatenate multiple string / text fields some of which may have NULL values ArcGIS

I am trying to repeat the behavior of this code from the ESRI website. I want to replicate the output example in ALL_Type field, so that it concatenates a field but it deals (ignores) any that have ...
2
votes
1answer
2k views

Using Python if/then/else to return value from either of two fields based on value of third using ArcGIS Field Calculator?

I'm trying to avoid manually inputting Begin and End engineering station values already inputted into a seperate field. I'm dealing with(4) fields: Begin_Sta End_Sta Beg_End and Station. The ...
2
votes
2answers
413 views

Syntax error in parameter formula of field calculator funtion

I'm using a QGIS 2.8.1 in windows. Have some doubts with syntax when use string in python console. I want to use the field calculator funtion like: processing.runalg('qgis:fieldcalculator', input, ...
7
votes
3answers
13k views

How to count occurrences of one field grouped by values of another?

Is there a way of calculating the number of unique text strings in a field in ArcGIS 10.1? I have a number of repeated strings in this field, but would like to calculate the number of unique strings ...
6
votes
5answers
19k views

How do you test for a NULL string field in the Field Calculator with Python?

I am trying to perform an operation on a string field with a condition that it contains data. Referencing None with Python does not appear to work when the field is nullable and contains <Null> ...
6
votes
2answers
19k views

Splitting string in Python parser of ArcGIS Field Calculator?

I am trying to use Python to split a string field into three new fields at the separator " - ". The field is in the format "a - b - c". So I initially had this in the field calculator for newFieldA: !...
5
votes
3answers
2k views

Calculating file name with field calculator

Is it possible to calculate the file name in an attribute table? My shapefile has a name like "cities.shp". In this shapefile I want to have a attribute "cities").
5
votes
1answer
1k views

Converting 12-hour time to 24-hour time using Field Calculator

Does anyone know how to convert string time formats in ArcMap v10.2 from 12-hour to 24-hour using a simple query in the Field Calculator? i.e. NO Python, NO editing in Excel, NO changing my Windows PC ...
4
votes
1answer
227 views

Referencing other points(rows) in field calculator

I'm trying to calculate an angle between points using a field calculator. Is it possible to reference the previous or next FID with reference to the current one using the field calc? Eventually I'd ...
3
votes
2answers
4k views

Field calculator if and elseif statement with <Null> values in ArcGis 10.1

Trying to figure out how to get this "Headwater" column to indicate "Yes" (or 1) if the value of "NextDown_Copy" is "" and "No" (or 0) if it has any other value (eg. 7100381010). I attempted to try ...
2
votes
2answers
7k views

How to use DateDiff() Function across day transition in ArcGIS Field Calculator?

I am trying to calculate the time difference between two fields using the DateDiff() function in minutes. I have successfully calculated the times that fall within the same day but I am having trouble ...
2
votes
1answer
4k views

Converting field to string with leading zeroes using Python Parser of ArcGIS Field Calculator?

I would like to create an expression using the field calculator in ArcMap to be able to convert an Int field to a string and add leading zeroes. I am able to do it in a python window with an example ...
2
votes
1answer
1k views

ArcGIS Calculate Fields gives Warning 000405 No records within table?

Situation: I have feature layer sitting outside processing extent in Environment settings. If I open layer's table and use field calculator - Calculate Geometry on some numeric field: it works fine. ...
2
votes
1answer
2k views

Finding distance between consecutive points using ArcGIS Desktop?

I am wondering how I can get the distance between consecutive GPS locations in ArcMap 10 (i.e. the distance between consecutive GPS locations sent in during a wildlife telemetry study).
1
vote
1answer
285 views

How to link Number value with Field calculator in QGIS Modeler ?

I want to link 2 number values (RMSE & dosemax) in a field calculator formula. When I run the modeler, I add these values but it doesn't recognize them. I dont want to create a new table. Just use ...
1
vote
1answer
223 views

Filling blanks (missing values) in table with value above using ArcGIS Field Calculator?

I'm using ArcMap to tidy up some field collected point data. The point data is a sequential track from a handheld device. In the attribute table i have a field with differant activities that separate ...
1
vote
1answer
377 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 ...
7
votes
2answers
433 views

How to edit a large shapefile in QGIS?

I need to add an ID field to a shapefile with 16,171,000 points (yes, a lot of points). I try with QGIS' field calculator using $id and $rownumbut this is my fifth day waiting for some results. How ...
6
votes
1answer
6k views

Unit of $length in QGIS Field Calculator

I'm calculating field of various features in my shapefile using QGIS. I'm getting some sample length as 0.134914579766986. I want to know in what unit (eg: meters, km etc) is the above value ?
6
votes
1answer
926 views

How do you speed up creating new field in attribute table for huge amount of data in QGIS?

In my attribute table for a shapefile, I am converting one field (Julian day) to another field (date) using the field calculator but I'm working with about 7.7 million rows. QGIS has been running for ...
6
votes
1answer
339 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 ...
5
votes
2answers
5k views

Forcing decimal numbers to use comma in ArcGIS Field Calculator?

Can I add the comma "," to force the decimals to remove from the attribute and replace with the number? For example, I have an Acres field column that says 506320.0750 and I want to replace the ...
5
votes
5answers
25k views

Simple field calculator equation in ArcGIS 10 not working

I'm new to ArcGIS 10 and am trying to do a really simple field calculator equation and it is not working. I'm just trying to find the percentage of a certain demographic trait by doing: [asian]/[...
4
votes
4answers
6k views

Concatenating numbers and adding in leading zeros?

I have three text fields populated as follows: 1, 9, 1 that I need to concatenate into a field that looks like 01.09.01. Getting to 1.9.1 is easy but can anyone help out with how to formulate it so ...
4
votes
2answers
1k views

Controlling label/attributes of grid/fishnet index using ArcGIS for Desktop and ArcPy?

I have used the Grid index feature tool to create an index grid. The label/attribution of the page names are populated in a "row" orientated manner. eg lef to right a1,a2,a3,a4,a5,a6 b1,b2,b3,b4,b5,b6 ...
4
votes
2answers
16k 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 ...
4
votes
1answer
2k 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 Entering date with arcpy.GetParameterAsText()? I have written the test code below that I am running against a test feature class ...
4
votes
1answer
79 views

Recalculate a Field with data from another field, ignoring NULL values

I have a Feature Class in a Geodatabase with an field for pipe diameter. I also have a shapefile with a field for diameter. The shapefile is from field verification work that verified a variety of ...
4
votes
1answer
915 views

Iterative position within Field Calculator/Python

I'm not great with Python or programming in general, so I'm not even sure how to ask this question. Basically what I've got is in the left column, and what I want is in the right column. UniqueID ...
3
votes
1answer
171 views

Help in field calculator expression editor hidden

I don´t have in field calculator "selected function help".
3
votes
3answers
640 views

QGIS Field Calculator Results Removed When Saving Edits

Mac OSX 10.6.8 QGIS 1.8.0 : Using the field calculator from the attribute table, the $area of each feature is shown nicely in the table until I try to save it, then all the values are replaced by NULL ...
3
votes
2answers
1k views

Creating indexed vector grid in QGIS?

at the moment I am trying to create an indexed vector grid via "vector -> research tools -> vector grid...", in the following format: A1 A2 A3 ... B1 B2 B3 ... C1 C2 C3 ... .. .. .. The creation of ...
3
votes
1answer
566 views

Conditional Statement in QGIS Field Calculator

I'm using QGIS to calculate total loss in an earthquack attack. I wrote this expression in Field Calculator. CASE WHEN "build_type" = 1 AND "MMI" < 5 THEN "perc_loss" = 0 WHEN "build_type"...
2
votes
3answers
537 views

Use field calculator to change values from a,b,c etc. to 1,2,3 etc.?

I have a vector shapefile with a column with string values. How can I convert this to a column of integer values in another column but keep the categorization. e.g. from: col1,newcol2 A, A, B, A, C, ...
2
votes
1answer
2k views

Splitting field with comma as separator into two fields in QGIS

How to split a "Field" into "Field 1" and "Field 2" when the comma is a separator in the field? I am using Field Calculator in QGIS.
2
votes
1answer
941 views

Concatenating string with space

I am adding a number of strings together to create a linestring but as such I need spaces between the initial XY values and the end XY values, plus a comma in between the two halves. Should result in ...