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
1
vote
1answer
325 views

Computing long expression in ArcGIS field calculator?

I am trying to compute the following expression with the Field Calculator of ArcMap. The input table values are around the size of this value: 562643580,7843, and the field name (the field of ...
0
votes
1answer
23 views

Extracting 2 groups of numbers from string in QGIS Field Calculator?

I have an attribute field that contains strings like "iuyluf45567kjyyr347fklj". All strings contain various amount of characters and digits (there is no clear pattern) but each string contains 2 ...
29
votes
4answers
22k views

Filling column with consecutive numbers in QGIS?

I make a new column in my attribute table and it has a default value (for example 0). I want to (probably using the field calculator) have the result that row 1 has the value 1, row 2=2 and so on, ...
2
votes
1answer
59 views

Difference between $x and x($geometry) [on hold]

I just stumbled across something weird: I had point-data in EPSG:3059 and wanted to add the coordinates to the attribute table using $x resp. $y - which returned NULL. x($geometry) on the other hand ...
2
votes
1answer
276 views

Vector Fields as Input Variable in Field Calculator

I’m working with QGIS 3.2 Bonn and I try to build a workflow in the graphic modeler. The model aims to build variable buffers depending on values from two attribute fields of an input vector layer. ...
6
votes
6answers
2k views

Using ArcMap Field Calculator to set Row 1 (Column D)= Row2 (Column B)?

This is probably a fairly basic question but I have a long list of latitude and longitude values that represent telemetry points that will be the start point of the line. Before I convert them to ...
3
votes
2answers
5k views

Field Calculator returning incorrect length and area values

I can get accurate lengths of line features and areas of polygon features using the "Measuring Tool" in a QGIS project. However, when I attempt to generate length or area data in Attribute Tables ...
3
votes
1answer
480 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 ...
3
votes
2answers
3k views

Calling variables within ArcPy functions using Calculate Field tool?

I have a defined function (ex. def my_function(x,y)). def my_function(x,y): """algorithm""" my_variable = my_function(filex, filey) How can I call this variable within the code block section of ...
1
vote
0answers
20 views

Getting less calculated area after merging/dissolving polygons [closed]

After I merge/dissolve polygons together, the area I calculated using the field calculator seems to decrease, in comparison to the calculation of each individual area and then summing it up. Can ...
3
votes
2answers
860 views

Adding both string and automated numbers in series to attribute table using ArcGIS field calculator?

I would like to fill a column in my attribute table with an string that ends in a numeric value. Example: Object001 Object002 Object003 I would like to automate the process of filling in the ...
1
vote
0answers
23 views

Reclassifying string variable in ArcGIS Field Calculator with Python Parser?

I am trying to calculate a roadway pedestrian restriction based on its functional class, using if/else logic in Python. Every time I enter this, it only turns up 'No'. The categories are strings, and ...
3
votes
1answer
42 views

Change data format in QGIS field calculator using format_date

I´d like to change the data format in the attribute table from yyyy-MM-dd (default) to dd.MM.yy using the format_date function in the field calculator. Using: format_date(date, 'dd.MM.yy') I got ...
4
votes
1answer
45 views

Evaluate string in field calculator QGIS

Is there any way to evaluate a string as an expression in QGIS. For example, I want to evaluate the string in Column 'hukg' as an expression.
4
votes
2answers
1k views

Transforming ArcGIS date field to integer?

I have a featureclass with a 'date' class field named 'ACQ_DATE' formatted as: 1-8-2013 24-7-2013 etc. As you can see the number of digits is not harmonized. I want to display the dates on a ...
5
votes
1answer
100 views

Counting number of features within another feature using aggregating function in field calculator of QGIS?

My data: 1 polygon layer + 1 point layer My target: Calculate the number of points and the sum of a field within each polygon using the aggregate function in the QGIS field calculator. I know I can ...
3
votes
1answer
43 views

Coalesce field “X” if field “Y” is a duplicate

(QGIS 3.4) The image below will help explain my goal: I'm working out how to coalesce the attributes of the field "ID" if the field "X, Y" is a duplicate. I have highlighted some duplicate ...
7
votes
4answers
966 views

Parsing serial date in ArcGIS Desktop?

I have imported a shapefile that contains a serial date number that looks like this: 41256.260799. I would like to create a new field that shows only the hour and second like this: 06:33. I've tried ...
2
votes
2answers
1k views

Converting 5 digit serial date to mm/dd/yyyy using VBScript in ArcMap Field Calculator?

I have imported a table from Excel that has one field (StartDate) to hold dates. When I imported the table it into ArcMap, the date values in that field changed from DD/MM/YYYY to a 5-digit number, e....
2
votes
1answer
35 views

Keeping only 7 digit number within field name using ArcGIS Pro field calculator and regex

I have a field titled GEOGRAPHY, which contains hundreds of records containing various strings of all similar format, for example: "Witless Bay (1001559) T 00000 ( 6.5%)" "Laniel (2485905) NO ...
1
vote
3answers
131 views

Making one field/values equal to another field/values

I have created a new field called "SFX" in a shapefile called "myshape.shp": input = r"C:\files\myshape.shp" arcpy.AddField_management(input, "SFX", "TEXT", field_length=100) There is now a field ...
2
votes
1answer
41 views

Sum the area of buildings inside a block (QGIS) [duplicate]

My problem is to get the sum of the area of all buildings inside a block. There are a layer with the buildings (they contain an block_id to which block they belong and the area) and a layer with all ...
3
votes
3answers
632 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 ...
1
vote
2answers
39 views

Creating array of z-values from line vertices in QGIS field calculator?

I would like to create an array of a line's z-values to use as part of another expression. The z-values should be in the same order as the vertices, I would like to be able to use it as an input for ...
4
votes
2answers
64 views

Adjusting condition in field calculator in QGIS [duplicate]

I need to calculate a score based on an area field using these ranges: if >= 30000 (square meters) then 4 (score) if < 30000 AND >= 10000 then 3 if < 10000 AND >= 5000 then 1 if &...
5
votes
2answers
2k views

Extracting Derived Z-coordinate data

I am trying to extract the z coordinate value from the derived attributes, similar to How to re-calculate area, perim, p2a,width and length in QGIS? but I cannot see a dedicated operator for finding ...
0
votes
1answer
24 views

Pulling date from filename and in proper format for time enabled use?

My feature attribute table has a folderpath that indludes a date time. Example:/documents/foldername/xyz2015OCT15063333.shp It seems very simple, but I am not a programmer and have done my best to ...
1
vote
1answer
67 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 ...
0
votes
1answer
37 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
1answer
29 views

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

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

Concatenating strings from two fields using Python in ArcMap Field Calculator?

I'm new to Python scripting and I don't understand what is wrong with this code. I want to concatenate the string values from GRID1MIL and GRID100K. I've created a text column MGRS to begin with. I ...
0
votes
2answers
40 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 (...
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 ...
1
vote
2answers
293 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~...
0
votes
2answers
48 views

Showing lowest value first after one-to-one spatial join with delimiter?

After a spatial join (one-to-one) in ArcGIS my result looks like this: (I use a / as delimiter) 2015/2015/2014/2014/2013 After that i use python in calculate field to filter out duplicate values ...
1
vote
1answer
40 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".
0
votes
1answer
45 views

Using Calculate Field tool to make empty field be populated with adjacent field's data?

I have about 80 species of birds with at least about 100,000 records each. I used the iterator tool to create a field named [Count] for each species, but now need the empty field to be populated with ...
1
vote
1answer
24 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 ...
2
votes
1answer
833 views

Field Calculator giving Error message in QGIS?

Field Calculator: using the x- or yat or (0 "or-1" ) expression, I keep receiving an error: An error occurred while evaluating the calculation string: Index is out of range. I have shut down ...
3
votes
4answers
9k views

Concatenating string data plus numeric data in ArcMap field calculator?

I am using ArcMap 10.2.2. I have three attribute fields (Address_No: 1, StreetName: Main, Street_Ty: ST) that I want to merge together. How do I concatenate string data found within the table plus ...
1
vote
1answer
306 views

Run field calculator script in Python window

I have a script that runs perfectly in the "Field Calculator." The codeblock looks like this: def timeday(time, am, diur, pm, noc): if(time >=am and time < diur): return "crep_am" ...
3
votes
1answer
79 views

Adding unique indexes which start with “A” go up to 99 (A1-A99) and then start again “B1” and continue up to B99 and so on? [closed]

i want to add unique indexes which have to start with "A" go up to 99 (A1-A99) once the 99 rows of finished it has start again "B1" and to continue up to B99, so this index system has to continue ...
3
votes
2answers
87 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
49 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
40 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
63 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
3answers
492 views

Changing Values Greater than Standard Deviation of Mean to Zero using ArcMap?

I have a feature class with greater than 1000 features and I would like to change all values greater than 2 Standard Deviations to a Zero. Seems like I could possibly use Field Calculator for ...
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 ...
14
votes
5answers
18k views

Concatenating fields in field calculator of QGIS?

Is there a way to concatenate fields in field calculator of QGIS? (e.g. hectares + ' ha')