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
2answers
42 views

Conversion from number field to text field

I have a field "folio" formatted as a number with decimal. I added a new string field "folio_1" and using field calculator to populate it with the value of "folio". The problem is that the new field ...
1
vote
1answer
11 views

ArcMap: Combining County Polygons for 3 separate states into one layer with attributes

I have 3 separate layers with the counties for 3 separate states: WA, OR, & ID. I want to combine them into one layer "Counties" so they all share an attribute table with the same fields. I am ...
2
votes
1answer
39 views

Conditional statement in PyQGIS field calculator

I am trying to perform a if/elif/else routine in the field calculator environment from PyQGIS (i.e. coding in Python). My code is the following, however I keep getting indentation errors. The field ...
1
vote
0answers
35 views

Field calculator returning ERROR 000989? [closed]

I'm trying to split a field of street addresses (field name "PROP_STREE") so that it returns only the house number (so "123 Main St" would become "123"). Following the solution provided Field ...
1
vote
1answer
26 views

How to enter text into attribute tables with QGIS graphical model?

I am using QGIS 2.14 to open NC files for chlorophyll satellite data with the end goal of compiling chlorophyll values for many dates (each its own initial file) in a spreadsheet. I know how to do the ...
3
votes
2answers
186 views

Creating dummy variables between layers based on their geometries in QGIS

I have the following data: administrative boundaries for the United States: https://biogeo.ucdavis.edu/data/gadm3.6/shp/gadm36_USA_shp.zip vector layer containing coastlineshttps://www....
2
votes
1answer
50 views

Why is my default value stil NULL even when i have made an expression for the Default Value?

I seem to have a problem with the default value in one of my colums by the calculator expression. I have two specific columns that have widget input one being tekst value and the other being numbers ...
3
votes
2answers
135 views

Doing COUNTIFS equivalent in ArcGIS Field Calculator?

I have an attribute table with location data for a series of individual animals. They are often found at the same locations, so I have created a column in my attribute table where I list the rock ID. ...
1
vote
1answer
36 views

Accessing fields info from code block using Python Parser of Calculate Field in script?

I need to codify a field with other fields information I have this code running into a script: # Process: Calculate Field (12) arcpy.CalculateField_management(RedHID_Layer, "TIPOcorr", "...
-1
votes
1answer
26 views

Auto incrementing start form the second row and every second row in ArcGIS Desktop? [closed]

Subsequent to Auto incrementing every second row in ArcGIS Desktop? , how can i start the auto increment from the second field (i work with 150 fields) so the result will be:
1
vote
1answer
32 views

Auto incrementing every second row in ArcGIS Desktop?

How do I auto increment every second row (field type is short and I work with 150 fields) in ArcGIS Desktop 10.3.1? I saw this code in https://support.esri.com/en/technical-article/000011137 rec=0 ...
1
vote
2answers
77 views

Expression not saving in QGIS Field Calculator?

When I try to enter the following expression to remove NULLS, it does not appear to be saving/doing anything. if( "number" IS NULL, 0, "number") Open Attribute Table Open Field Calculator Check ...
0
votes
2answers
41 views

Reclassifying vector polygons based on text string to integer using Python Parser of ArcGIS Field Calculator?

So I am trying to reclassify a text string by searching for bits of strings and converting those strings to an integer value in a new field within the field calculator. e.g. I want to find all values ...
3
votes
1answer
55 views

How to run a Epanechnikov (parabolic) decay in QGIS 3.6 field calculator

Does anyone know how you would implement a Epanechnikov (parabolic) decay to a field in QGIS field calculator. I am trying to apply varying distance decay functions in order to assess the best ...
0
votes
1answer
51 views

ArcGIS Pro Field Calc to calculate pipe volume

I'm trying to do this calculation: (!DIAMETER!/2)*( !DIAMETER!/2)math.pi/144 !Shape.STLength()!*7.48 and keep getting an error. Can anyone give me the correct syntax for calculating the volume of ...
0
votes
2answers
106 views

QGIS how to fill the fields instantly and automatically when creating an entity

I have a polygon layer, I want to fill the fields automatically each creation of a polygon. Knowing that there is a spatial relationship (intersection, contain ...) between my polygons and other ...
1
vote
1answer
54 views

Map based on highest percentage from different variables

I've the 8 social classes (see under) for +- 900 polygons. I would like to create a new column that keep only name of the main social class for each row (based on the percentage). After that I would ...
1
vote
0answers
94 views

Getting error message in QGIS field calculator?

I have used an equation within the field calculator, that has previously worked in an older version of QGIS, I am currently using QGIS 3.6.2 the equation being: (atan((xat(-1)-xat(0))/(yat(-1)-yat(0))...
1
vote
1answer
236 views

Converting text strings to numbers using QGIS?

I am working in QGIS, which is quite new to me. I have a text string containing dates. I want to have new column where only the year from the text-date string appears. How is that possible. See ...
-1
votes
1answer
31 views

Using Field Calculator for subtracting values with same ID in ArcPy? [closed]

I have a line shapefile that used for some calculation. One of the calculation is subtracting values with a same group ID. The shapefile has a filed called LineID that consists of 2 lines with Side 1 ...
0
votes
0answers
43 views

Calculating field after arcpy.Append_management()?

I have some AutoCAD layers (f.e. Cad1, Cad2) and I want to export them into feature class in a geodatabase (f.e. feature_class). Also I want to calculate field in "feature_class" for objects from CAD. ...
0
votes
1answer
37 views

1:n relations in label expressions & general syntax

I've got a colleague who wants to create a (concatenated) label based on a 1:n relation between some shapes and related tables. They asked me if this was possible in QGIS - and I think it should. I ...
0
votes
1answer
41 views

Expression returning wrong value in QGIS Field Calculator?

My QGIS Field Calculator expression: case when "field_value" = '' or "field_value" <> NULL then (if( "field_value" = '', 'N', 'Y')) end returns null value even if "field_value" has something ...
0
votes
0answers
44 views

Field calculator not working with division command

Really do not understand what is up. I am able to sum two columns, but unable to divide them. I selected out any entries with "0". Nonetheless, a simple division command in the form of ([a]+[b])/[...
0
votes
1answer
38 views

Auto Incrementing Field based on Selection of Records in Feature Class?

I'm attempting to write a script that will add an incremented value to a field based on a selection of records. For example, the script will select the first 300 records in a feature class and then ...
1
vote
0answers
48 views

Reprojection puzzle

Initially, my question was about strange results in area calculations in QGIS. I got bigger results for planimetric calculations - using area($geometry) - compared to ellipsoidal calculations - using $...
3
votes
1answer
208 views

Date formating in QGIS using expression?

My expression: day(now()) || '/' || month(now()) || '/' || year(now()) returns current date as 15/4/2019, but I want to get the date in dd/mm/yyyy format i.e. 15/04/2019. How can I get that using ...
3
votes
1answer
212 views

Expression for random numbers without duplicates

Using only the QGIS field calculator, how to create an expression that generates random numbers without duplicates? rand (1,10) and randf (1,10) generate random numbers but could be repeated in a set ...
1
vote
1answer
35 views

Calculating field from three conditional statements

I am working on a road dataset and would like to calculate a field(speed) using three conditional statements from two fields: formOfWay: with value, Dual carriageway etc. routeHierarchy: with values ...
6
votes
1answer
90 views

Update Cursor skipping last row?

I have created a python function within field calculator to calculate the time difference between a timestamp (yyyy-MM-dd HH:mm:ss) in a row and the row after (the interval field in seconds). I have ...
0
votes
4answers
108 views

Copying/replacing first letter in column of attribute table in ArcMap with field calculator and Python Parser? [closed]

How to copy / replace the first letter in a column if that letter is "N" and replace with "C" in the field name "DISTRICT" inside the attribute table in ArcMap using Python inside the field calculator?...
0
votes
1answer
52 views

Python Script is repeating results

I have developed a python script to copy and paste in the field calculator. Having an input of three values, it compares all of them and returns a list of unique values. The problem is that when I use ...
3
votes
1answer
180 views

How to extract the maximum value from an array in the QGIS Field Calculator?

I'm trying to get the maximum value from an array, using the max() function. The syntax for the max() function is this: max(value1,value2…) I have an array: [ 1, 2, 3, 4, 5, 6, 7, 8 ] which I got ...
0
votes
0answers
20 views

Sum calculation in Field Calculator using Python script [duplicate]

I have a problem with Python script in Field Calculator. How to sum the values of one field ('AB') and paste the sum in another field ('RE') using Python in Field Calculator? I'm working in ArcMap 10....
3
votes
1answer
64 views

Calculating acreage as a percentage in ArcPy

I am struggling to calculate the acreage as a percentage in Calculate Field Management, but I am getting this error message: "ValueError: could not convert string to float! BufferAcreage! arcpy....
2
votes
0answers
196 views

Advanced Python Field Calculator - QGIS Processing Toolbox

I'm trying a very simple task. I want to write the layer name in a new attribute column. I managed to do this using Field Calculator. But I need to do the same for a lot of files in batch mode, only ...
0
votes
1answer
56 views

Using If/Then Statement in ArcGIS Field Calculator?

I am trying to add a column that shows vegetation production (numeric) in relation to soil series. I have each soil series already in the attribute table however I am having a hard time writing the if/...
1
vote
2answers
50 views

Use a python expression in Field Calculator to sum each row across several columns

this seems like it should be easy but I am new to python and am having trouble... I have four columns. I would like perform a field calculation that sums the values by row for three of the columns and ...
1
vote
2answers
100 views

Selecting latest date with QGIS field calculator?

My shapefile contains columns like "Street", "number" and "date". What I want to do is, to find the latest date (where we have done house services). If we have 2 dates for one house number ("number")...
3
votes
2answers
127 views

QGIS how to sum a certain vector field inside a polygon and populate a field in the polygon?

I have a polygon with vector point civic addresses inside it. Each civic address has a different number residence. I want to sum the total number of residence inside that polygon and it populate a ...
1
vote
1answer
60 views

Reclassifying field using Python wildcard string search?

I have a point layer with 900K Tree Point records. In that layer I have field (d_Species) that contains the tree species of each record. I've created a field (SpecieValu) to assign a value (0-3) for ...
2
votes
2answers
49 views

Get DD Lat and Lon from CRS EPSG:3111 - GDA94

I have a shapefile in CRS EPSG:3111 - GDA94 that I am trying to generate Lat and Lon, however when I use the field calculator and try to populate the lat lon I am getting values that I can't use as ...
0
votes
0answers
48 views

How to trim cell values in an attribute field

I am working in ArcMap 10.4.1 and need to trim cell values in the NAME field of a feature class. Everything starting from double underscores needs to be deleted. This is my attempt in Field Calculator....
0
votes
2answers
38 views

Splitting string ID code into various parts

I have a series of identification codes that I need to split out. The format of these codes is [region(letter)][district(number)] - [place(number)][subdistrict(letter)]. An example of some codes ...
1
vote
1answer
23 views

Calculate field tool doesn't stop running because of codeblock in ModelBuilder?

I am running the following model, which seems to work and populate the added field that I want, but the final calculate field doesn't stop running even though it seemed to do what it should. The point ...
3
votes
1answer
18 views

Calculate a field using text from another field separated with comma

I have an address field containing the following text: "64,ramkoti,hyderabad,500070" I need to copy hyderabad to another field. What would be the code used in the field calculator tool to achieve ...
2
votes
2answers
73 views

Understanding arcpy.CalculateField_management with Join?

I am using arcpy.CalculateField_management to fill a column field with another column values. I have two shapefiles, fishnet.shp and new_run.shp. First I joined both using arcpy.AddJoin_management as ...
1
vote
1answer
27 views

Prioritising values in accordance to various Columns

I previously asked for help in Prioritizing the Attribute table of a self made polygon layer Prioritising polygons in QGIS Now I want to change this prioritisation in accordance to multiple values ...
1
vote
2answers
381 views

Getting QGIS processing script field calculator error?

I have a processing script that I created for QGIS 3.4.5 but I keep getting the following error: Traceback (most recent call last): File "", line 66, in processAlgorithm File "C:/PROGRA~1/QGIS3~...
1
vote
1answer
45 views

Autoincrementing one character in calculate field of ArcGIS Pro?

I am using ArcGIS Pro. I have this set of points where I like an unique id (uid). The only thing they need to be unique is a counter of some sort at the end. I have another field with some id that ...