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

Using ArcGIS Field Calculator?

I have a large shapefile with 2,5 million points and I would like to create a new field in the attribute table that groups the features into groups of 65000 features. In other words: Select the first ...
1
vote
0answers
42 views

Getting value from another table with dbquery

I am trying to use dbquery to get a value from a table when a record in it is the same as a value in the source table. In the table where I need the value-added (Sewerage_Manholes...) I am trying ...
1
vote
1answer
28 views

Selecting by attributes which have alphabet data using ArcGIS Field Calculator? [on hold]

I only want to select values that are entirely alphabetic characters. Select by attributes which I have alphabet data. SELECT ONLY RED INDICATED VALUES
0
votes
2answers
37 views

Calculate time duration from military time with ArcMap Field Calculator [closed]

I have two text fields (STRTTIME, ENDTIME) which are are formatted as military time with leading zeros. For example, 0540, 1655. I want to calculate a new field with the time duration as integers (...
0
votes
0answers
19 views

Adding XY coordinates for Polygon through ModelBuilder? [closed]

i have polygon data. i need add xy coordinates for polygons using ModelBuilder. i'm getting this type of data......
1
vote
1answer
38 views

Row_number with create virtual field in QGIS

How can using @row_number option or similar together the command "Create virtual field". It works very well with "Create new field", but doens't work with "Create virtual field".
3
votes
2answers
81 views

Cleaning up layer by deleting features with only one overlapping vertex in QGIS

After applying r.thin and then r.to.vect to a raster image the resulting vector layer contains hundreds of small "branches" that are not supposed to be there: I've tried selecting and deleting these ...
2
votes
1answer
49 views

Using If statements to conditionally populate a field in Field Calculator

I'm trying to use the field calculator to poplulate a string field in a table based on info in another string field. This is what I have: def Reclass(Correction_Comments): if (MSAGSTREETNAME) = '...
0
votes
2answers
48 views

Passing string field value to another field in same Feature Class using ArcPy?

All the literature I have read suggests that to pass a string value to a another field in a feature class via ArcPy you need to do the following. I am running it in ArcMap 10.6. arcpy....
1
vote
0answers
39 views

QGIS 3 - Set width of line by attribute

I have a line-layer and want to style the line by using a data-table with no geography - I am using GeoPackage. With other words, how can i get a field-value (i have two fields for filtering the ...
1
vote
3answers
58 views

Calculating areas of world map in QGIS?

I have a dataset with polygons of administrative areas for the whole world (https://www.gadm.org/download_world.html). I want to have the area size of each polygon in square kilometers. I saved the ...
0
votes
2answers
29 views

Counting string in cells? [closed]

How can I count strings? I would like to know how many words (strings) I have in each cell. So I know that somewhere is too many words. Len() function calculates individual string character (including ...
1
vote
2answers
161 views

Using Python Parser in ArcGIS Pro Field Calculator?

I am having a problem in migrating from Vbscript to Python for ArcGIS Pro. Building 5, Street 6 What is wrong in this expression? "{}:{}:{}:{}:{}:{}".format("Building ",!Building_Number!," , ",!...
0
votes
1answer
30 views

Simplifying a long if condition statement and adding status report?

def Assign(csdname, cdname, ccsname, zone): if csdname == "Oshawa" or csdname == "Whitby": return "70" elif csdname == "Toronto": return "71a" elif csdname == "Mississauga" or csdname == "...
2
votes
2answers
40 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
29 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
23 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
139 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
49 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
126 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
33 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
25 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
31 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
57 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
39 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
51 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
39 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
91 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
56 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
112 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
29 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
37 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
32 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
34 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
31 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
32 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
47 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
130 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
169 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 ...
4
votes
1answer
88 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
91 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
100 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
17 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
48 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
142 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 ...