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
0answers
44 views

QGIS field calculator: Subtracting values from specific fields

I am trying to create an Isopach map of two subsurface formations. If a well has the two formations in question, then I would like a new layer with the data created so I can contour the points. I ...
2
votes
1answer
69 views

ArcGIS Pro Calculate Field giving WARNING 002858: Certain rows set to NULL due to error while evaluating Python expression

I'm working with some county level data for the 2016 US Election. I'm trying to calculate a blank Text field "Winner" based on two numeric fields "votes_dem" and "votes_gop" where it will take the ...
1
vote
1answer
51 views

Add multiple fields to a shapefile based on multiple expressions

I would like to optimize the creation of several fields within a very large shapefile in QGIS based on multiple expressions (see below). I've done it manually without any problem in QGIS with the ...
1
vote
0answers
31 views

$area returning NULL for some areas

Dataset: English Regions boundaries, merged with those of Wales and Scotland, all from the ONS (UK stats body). Creates a multi-polygon layer because of the islands within each region. Problem: ...
1
vote
2answers
41 views

Calculating Cumulative Field Values in ArcMap using a case field in ArcGIS 10.4

I want to calculate cumulative field values using an case field from another column in ArcGIS 10.4. For example, if I have an "ID" column and "Count" column inside my attribute table, I want to ...
0
votes
1answer
19 views

Replacing Street Directional Abbreviations (N, S, E, W) with spelled out value (North…) using ArcMap ModelBuilder

In converting street centerlines to Next Gen 911 schema compliance, how do I iterate a !St_PreDir!.replace("E", "East") to include replacing N with North, S with South, and W with West? I am trying ...
4
votes
2answers
168 views

QGIS: Use 'replace' expression for 2 characters in one field calculation

I have a field of currency values in an attribute table. As an example, I'm attempting to replace £10,000.00 to 10000.00 so QGIS can run graduated styles on the new field. The following replaces the £ ...
0
votes
0answers
25 views

How to use field calculator to return the percentage of each record within a group (defined by a different field)? (ArcGIS Pro)

Within ArcGIS Pro, I am trying to summarize records in a shapefile by calculating a new attribute field that shows the percentage of a given record within each group, defined by another field in the ...
0
votes
0answers
31 views

Field calculator - “and” + “or” operators not working in “If/Then” statement

The following Python code I'm trying to use isn't working, and I believe it's due to how I've integrated the "and" and "or" operators. Although I suspect my full code (below) is not ideally written/...
3
votes
1answer
29 views

Field calculator 'if/then' statement, with 'and' not working

I'm trying to do some conditional formatting of an attribute table using Field Calculator. I tried using code below, but am not getting any returns that meet conditions specified (even though the ...
0
votes
0answers
15 views

Doing a SUMIF in Model Builder

There is a way to do a SUMIF, from EXCEL, in Model Builder? I tryed something like this in field calculator, but i can't iterate through an attribute from the attribute table. def AreaTotal(A,B): ...
2
votes
1answer
51 views

In QGIS, how to group the days of a year every 15 days?

In QGIS, how to group the days of a year every 15 days? I have a column with date values throughout 2018, I would like to create a new column identifying which group that date is in
0
votes
1answer
36 views

Problem while applying trigonometric functions in QGIS 3.1

Using the Trigonomteric functions in the QGIS 3.1 field calculator gives me unexpected output. For example sin(180) produces the output -0.8011526357338304 instead 0. What is the reason for this? ...
0
votes
1answer
28 views

ArcGIS Pro field calculator if - else - string error

I try to calculate some fields with the field calculator using a simple if-else condition. I would like to write the values in the field volume, based on some calculations including values of fields ...
2
votes
2answers
58 views

Adding new field in PyQGIS

I am trying to add new field to my table based on two other existing fields. In the field Calculator it's quite simple: When I am trying to run as a Python code I got into trouble, Here's my code: ...
1
vote
1answer
31 views

Syntax error during calculate field between two long integer fields

I keep getting an error when trying to run a calculate field section of my code. I'm trying to simply add values from two long integer fields (Speed and Lanes) into a newly added field (Stress_Calc). ...
0
votes
1answer
34 views

How to use field calculator in this situation [closed]

How to use this formula in field calcultor in ArcMap. for example: A = Field1 B = Field2 if A =<B C = B else: C = A
0
votes
1answer
38 views

Implementing ArcPy codeblocks

I have tried examples from the GIS support website and many more, but I cannot figure out how to get a codeblock for a field calculation to work within ArcPy. Part of my code is underneath, it is a ...
0
votes
0answers
31 views

Calculate field with Null values

I am trying to add to rows using the calculate fields. An error message appears stating that my expression !base_co_p! + !base_co_j! has some null values, hence it cannot proceed with the ...
0
votes
1answer
19 views

Calculating Field in ArcGIS Pro ModelBuilder

Trying to setup my first automated mapping project and I need to add a field and then set it to 0. I've tried to use the Calculate Value tool, but I don't have any idea how to actually use this as it ...
3
votes
2answers
136 views

Checking if attribute name exists using QGIS Field Calculator

I'm trying to write and reclassification expresion, within the field calculator, that works in two different layers (vectorial) with two different names for ther same thing. The issue here is that in ...
0
votes
0answers
10 views

Use Summary Statistics and Add Join to Categorize Blockgroups

I am relatively new to GIS and am still learning how to us ArcGIS Pro. I am trying to figure out how to use the "Summary Statistics" tool and the "Add Join" tool in order to categorize blockgroups in ...
0
votes
0answers
47 views

Why does the 32-bit version of QGIS 3.4 works better (does not regularly crash) than the 64-bit on my 64-bit W10Pro laptop?

I was initially using the 64-bit version then it started crashing. First, it crashed whenever expressions/Python was involved. Then, it crashed when I was closing it. This happens in both the 64-bit 3....
0
votes
1answer
51 views

ArcMap Field Calculator gives ERROR 999999 [closed]

I am trying to do a fairly simple calculate but I keep getting ERROR 999999. I am running ArcMap 10.7. My Input is: (500,000/16) + ( (500,000/25) * [Join_Count])
1
vote
0answers
33 views

QGIS Attribute tables and adding fields data to all attribute tables through a lookup from an imported database attribute table [closed]

I understand you can add data to a single attribute table in QGIS via the field calculator from a database CSV layer. This allows a lot to be done with a single attribute table. Now this is good if ...
4
votes
1answer
96 views

QGIS 3.4 Add vector styles and attribute fields in a model

I made a model, which works like this: from a polygon, it extract its edges coordinates, turns it into lines and add an extra line.shp who will store the distance between the points. Because my ...
1
vote
0answers
16 views

Calculating field to equal adjacent polygon field when field = 0

I have a polygon Feature Class in ArcGIS Pro 2.5.0 In the image below, yellow is when the field value is 0, and blue is all other values. I want to calculate all the 0 values to equal the adjacent ...
2
votes
0answers
23 views

Calculating time difference between consecutive rows does not work within graphical modeler

I have a dataset with time-stamped GPS points. I would like to calculate the time difference in seconds between these rows. I successfullymanaged to do so by running the piece of code below in the ...
2
votes
1answer
30 views

Categorizing attributes by keyword in new field with field calculator in QGIS 3

So, the geological classification shapefile of the Philippines has the 'DESCRIPT' field which contains the geological time scale of each feature. "Oligocene-miocene" and "Oligocene-miocene (igneous ...
3
votes
2answers
94 views

Conditional statements in Field Calculator QGIS

Is it possible to modify the following syntax somehow that it would be applicable in Field Calculator in QGIS? The input layer is point layer and I would like to do following calculations which I can'...
3
votes
2answers
60 views

Updating a field with something like “if feature_1 is in field_1 then write category_1 to field_2” in QGIS Field Calculator?

I'm grouping different geological time scales into more general time scales. An example of what I would want is "if Oligocene-miocene is in descript_title, write Oligocene-Miocene in ...
3
votes
2answers
71 views

Field calculator: generate n fields reporting n-largest values

I have a polygon shapefile and I need to generate n new fields reporting the n largest values across k variables. In this particular case n = 3, so that I would like to create three new fields: "...
1
vote
3answers
51 views

Extract digits from string

I have a string field that I want to extract only the digits example: (1,500 m2 --> 1500) QGIS I've tried with regexp_substr( "location", '(\\d*)' ) to remove all after the blank space, but I need ...
0
votes
1answer
45 views

ArcGIS Field Calculater DateAdd() gives Expected end of statement error

I need to add seconds in an numeric column(TS_sec) to a datetime column(TS) in ArcGIS field calculator. I am using Vbscript. But i am getting following error: ERROR 999999: Error executing function. ...
2
votes
1answer
54 views

Change sorting feature to area

I have a table of attributes with polygons, from the area data I sort from largest to smallest, and when using the command @row_number, he writes the order in which the polygons were created. I want ...
2
votes
1answer
73 views

QGIS @row_number with defined intervals

I would like to write a sequence of numbers of lines that goes from 1 to 90 and restart on 1 again. For example 1 2 3 1 2 3 1 2 3
0
votes
1answer
29 views

Calculate field with IF statement

i'm a python beginner. I have a table with 4 fields def_score, PA_score, GPS_score and coop_score. I would like to calculate coop_score based on the first 3 fields with the following code block, but ...
1
vote
1answer
23 views

Convert values from a string column into a numerical column

I have a table, coming from Excel, with 21K rows, which is partially filled with numbers, and partially with the "" value from excel, which is displayed as <Null> in the table view. I need to ...
0
votes
2answers
28 views

Calculating shape area for polygons in different files using Python

I need to calculate the shape area (and possible the perimiter) of polygons for over 300 files. I tried to use a Python code but I am not very familiar with Python so when it returns an error I do not ...
4
votes
2answers
118 views

How to use an expression to count intersections in QGIS

I have a line layer and a point layer. The points intersect the lines. How do I write an expression for the Field Calculator in the line layer which will tell me how many points intersect each line? ...
1
vote
1answer
61 views

Field Calculator Python

I have a point file that has a field in it that lists all the streets at an intersection, eg) 1st St & A blvd & 2nd Ave etc I want to be able to separate each street out individually into its ...
2
votes
1answer
36 views

Creating a new field based on ranges in a field using Field Calculator in QGIS

I have a field (Tot_Score) that has scores from 2,3,4,5,6,7,8. I would like to create 4 classes out of these scores whereby the classes will be created in another field (Vul_Class) so 1st class = 2 ...
2
votes
2answers
81 views

Arcade expression to find minimum value that is not zero

I am trying to create an Arcade expression to calculate a field in ArcGIS Pro. In my streets feature there are 4 number fields to evaluate. I can easily use the Min() function to do this. The problem ...
4
votes
1answer
71 views

QGIS: Accessing layer's CRS from expresison and/or PyQGIS

How can I access the current feature's/layer's CRS from an QGIS expression, or from a custom expression in PyQGIS? In my expression, I use the following to buffer a (currently lat-long-specified) ...
1
vote
2answers
57 views

Difficulty with select by attributes using list fields in for loop

I am trying to add fields to a table and then populate the fields with text values (Yes/No). The text values are based on whether or not a species was found in a specific block. If the species was ...
2
votes
0answers
81 views

Calculating spatially weighted average value of vector layer in QGIS 3

I have a vector layer across an area with several different polygons of varying size. Each polygon has a rate of fertilizer as an attribute. I would like to calculate the average rate of fertilizer ...
4
votes
1answer
82 views

Getting value from another feature depending on value of field using QGIS Field Calculator

I'm a total newbie at coding. I'm working with water catchments in QGIS. Runoff of some catchments feeds other catchments. I'm trying to get the cumulative run-off. Each feature in the table has the ...
1
vote
1answer
29 views

Is there a way to create a new, pre-populated field within a view (Feature Layer), in Arcpy?

In SQL, users can write a SELECT statement that 'invents' a new field with a default value already populated in it, for all records returned. In the example below, the field Type doesn't actually ...
1
vote
1answer
37 views

Error calculating field with script exported from ModelBuilder

I am attempting to add a new field called "TimeYrCode" to a list of shape files, and then add values to this field based on the value of the "gridcode" attribute, which represents different days of ...
0
votes
0answers
32 views

Polsby-Popper measure in field calculator of ArcGIS Pro

I'm trying to assess the compactness of Virginia's congressional districts using the Polsby-Popper measure (4π (Area/Perimeter^2)), with this being my input into the code block: import math def ...

1
2
3 4 5
37