Questions tagged [field-calculator]

allows you to perform calculations on the basis of existing attribute values or defined functions in QGIS, ArcGIS, etc.

Filter by
Sorted by
Tagged with
2
votes
0answers
33 views

How can I improve my expression including an aggregate-function?

I have a polygon layer and a point layer ("wka"). I want to count the points in each polygon. I know I could do it with the following tools: "count points in polygon" or "join ...
0
votes
0answers
12 views

Calculating SMR (standardised mortality ratio) in Field Calculator

I'd like to calculate an SMR for the number of disease cases by county. I have in my attribute table [Cases] and [Pop] and should be able to calculate the SMR with this. In R it would be: caseSMR &...
1
vote
1answer
49 views

Choosing correct datetime format

I want to change my date (string) to a date format %Y-%m-%d for the time manager. I already try with the Field Calculator. But it is not working. What should i write in the expression. And should I ...
0
votes
0answers
16 views

Decimal disappears after calculation with CalculateField_management

I try to change the field name with the following steps: Add new fields Calculate new fields by making them equals to old ones Delete old ones As the new fields are not fixed, for example, some ...
10
votes
3answers
246 views

Filling a field with a random string from a list in QGIS

I need to fill a field with false string data from a given list randomly. There are rand and randf functions generating random numbers. There is a similar (not identical) question: Updating attribute ...
1
vote
2answers
34 views

Split contents of dbase text field into words at “ ”, “-” or “_”, capitalise first letters, and replace “ ” with “_”

A shape file field has text with words separated by blanks " ", dashes "-" and underscores "_". I want to standardise the words to capitalise each word, and then replace ...
2
votes
1answer
52 views

Calculate a field based on values repeated of an another field

I'd like to know how can i calculate in QGIS a field (field3) based on how many times a value is repeated (field2) considering an another field (field1). For example, the field to fill with the field ...
3
votes
0answers
36 views

Populating row numbers with Field calculator using PyQGIS

I have the following code, which is creating a new column called "group" without issue, but not populating it with a row number 1-n, as I'm intending it to. pv = layer.dataProvider() pv....
1
vote
1answer
30 views

Expression to extract part of an address [closed]

I have a column of addresses and want to separate into several parts. Ex. house number, street name, city, zip. For example lets say I have a cell with this string: '111 Example St, City, State 89786 ...
1
vote
1answer
26 views

Creating new variable conditional on another feature using Python Parser of ArcMap Field Calculator

I don't usually work in ArcGIS Desktop or Python. I have a shapefile of road data and the roads have a 'class' feature. I want to categorize the 'Class' feature into just 5 groups and call that ...
1
vote
1answer
84 views

Calculating ratio between “rows” in ArcGIS field calculator

I have a problem similar to Dividing two or more rows in single attribute table? but that is for QGIS whereas I have to perform it in ArcGIS. I have to calculate the Ratio between rows (sequentially, ...
5
votes
1answer
108 views

Converting table UTM coordinates to decimal lat-long in Attribute table using expression

I would like to formulate an equation in the attribute table calculator tool to calculate the decimal latitude and longitude values from the existing UTM NAD3 coordinates in the table. The UTM NAD83 ...
4
votes
1answer
70 views

Calculating the percentage of overlapping areas from different layers in QGIS

I work with QGIS 3.16 Hannover and I have three polygon layers 'A', 'B', 'C' with multiple geometries in each. In the image, layer 'A' has the bold polygons and, for each of them (meaning within each ...
8
votes
2answers
147 views

List of polygon neighbours with field calculator in QGIS 3

I'm using QGIS 3.16 Hannover. I've got a hexagon grid layer and I want to create, with the field calculator, a new field with the id's of the surrounding polygons. I've adapted the following ...
1
vote
1answer
39 views

ArcPy expression syntax in CalculateField_management

I am trying create a new column in my shapefile by concatenating a fixed/defined value with the value in another column. I have a syntax error that I can't seem to catch. Below is my code, current ...
1
vote
0answers
14 views

Adding numeric field to end of text string in annotations using ArcMap

I am using ArcMap 10.8.1. I carefully moved thousands of annotations for a network that just contain a feature's name. Now for a report map I need to append a numeric score to the end of each ...
0
votes
0answers
35 views

Updating field in attribute table of multiple shapefiles in ArcGIS 10.1

I have almost 100 shapefiles (all having polyline features only) in a single folder with each filename "0","1"..."99" . I need to recalculate the length and another field ...
3
votes
2answers
151 views

Replacing HTML links in attribute table Field Calculator in QGIS

I am having trouble doing a simple replace of a string in QGIS attribute table field calculator. My table has a field "tbljoined_link" that contains HTML links like <a href='islands/luzon....
0
votes
1answer
16 views

Field Calculator Skipping Statement

I am having trouble with a field calculator statement! I am trying to reclassify an attribute column based on their values. So if value =0 then make it 14, if value < 3 make it 11, if value >3 ...
0
votes
1answer
21 views

Retrieving everything after certain part of column by using field calculator in ArcMap

I have a column in an attribute table and I want to split it with the field-calculator in arcis in a way that I get everything after the 4th blank (space) in a new column: I tried it by using !...
2
votes
4answers
113 views

Calculate distance from polygon feature centroid to coordinate in QGIS 3.18

I have a shapefile with a lot of polygon features in it. For each polygon, I want to calculate the distance from the centroid of each polygon to a certain coordinate. How can I achieve this using the ...
3
votes
1answer
60 views

QGIS: FieldCalculator stripping away a street address a certain way

I have set up some expression to strip away the address in multiple columns. While so far it works fine I have bit of a problem when it comes to letters. I have a column in this table called "...
2
votes
2answers
105 views

Calculate field in a joined table in ArcPy

EDIT: I was able to solve the problem with the dictionary approach suggested by @BERA. However, I still don't get why it does not work with the CalculateField method. I'm trying to calculate a field ...
5
votes
1answer
156 views

Percentage of feature area covered by features of other layer in QGIS

I'm working with QGIS 3.16 Hannover under MacOS 10.13 environment. I've got two polygon layers A and B with multiple features in each. I want to calculate, for each feature in layer A, the percentage ...
0
votes
1answer
35 views

Calculate certain records (Calculate Field)

I have records that need to be updated. For this I select all records that are false and then process them with Calculate Field. The other records should not be changed. The output has NULL in each ...
0
votes
2answers
49 views

QGIS function layer_name in fieldcalculator batch-mode

Working with QGIS 3.10, I want to use the @layer_name function in batch mode for all layers in a project. In individual cases, I do this via the field calculator. I also found the script for the field ...
4
votes
1answer
67 views

Calculate non overlapping areas with QGIS

I'm working with QGIS 3.16 Hannover under MacOS 10.13 environment. I've got two polygon layers: natural_parks (multiple features) and region (single feature). Some natural_parks features lay entrely ...
2
votes
1answer
46 views

Add a new field to a layer containing the ovelapping area with another layer in QGIS

I'm working with QGIS 3.16 Hannover under MacOS 10.13 environment. I've got two polygon layers: natural_parks (multiple features) and region (single feature). I want to add a new field to the layer ...
1
vote
1answer
12 views

Using more than one condition in a CASE expression

I am currently trying to update the attribute "barcode" of layer that has many features. If the value is null or "0" then I take the value from barcode 2. I wrote the code bellow: ...
2
votes
2answers
35 views

Python split expression to Python code

I have a Python expression that I use in Field Calculator. !PROPR_NAME!.split(",")[0] I am writing a script in PyCharm and I am wanting to add this expression, however I am uncertain of how ...
1
vote
1answer
48 views

Creating a dummy variable for properties that intersect the buffer I created

I created a 1000 foot buffer around waterways for a single county in the U.S. I need to create a dummy variable for the properties that intersect the buffer I created. It would be 1 if the property ...
3
votes
1answer
58 views

Automatically updating geometry attributes in QGIS without using Virtual Fields

I have a line layer and I computed the attribute "length" with the field calculator. After that, I changed the geometry of some lines with the editing toolbar. That means the values of "...
2
votes
0answers
29 views

How to correctly merge the value in the columns, in the case of using the widget type the Value map, with QGIS

Trying to do work that was previously done in ArcGIS. There is a table when filling 4 columns, these values are added in the Sum column. In QGIS, I decided to use the Value Map for fields For the ...
2
votes
1answer
29 views

Combining rows in attribute tables in QGIS 3.4 with some strings that should be added together and others left untouched

I want to do the following with some fields in the attribute table but I have no idea how to do it: Each row is about a parcel and its selling price, it also contains its address, cadastral ID etc. ...
0
votes
0answers
29 views

Auto-populate field based on other field when selected

I’m dealing with thousands of points in my project and requires me to select points base on distance from other line features (i.e roads). Since the possibility for some points to overlap are high, I ...
1
vote
2answers
49 views

Making one field equal to another in the same Attribute table using Field calculator in QGIS

I am trying to have a new field with the same content of an existing field. In ArcGIS I would normally use the Field Calculator to make this instantly. In QGIS I have followed the same steps (create ...
0
votes
1answer
27 views

ArcPy - Get Date as parameter value and calculate Date field

In my ArcPy script I have an input parameter for the Date, so the user is asked to input a date value (time is not needed) using the data type GPDate. In the script I calculate a new field, field data ...
3
votes
1answer
216 views

Eliminating decimals without approximation

Is there any way I can eliminate decimals without approximating the number? Example: Value | Desired output 1.69 | 1 2.12 | 2 105.9999 | 105 I want to use the field calculator for ...
1
vote
1answer
41 views

How to get a codeblock in a tool?

I wrote a script in ArcGIS Pro Notebook. It runs there perfectly. Now I try to create a tool with the script. ArcGIS has problems to read my "codeblock" in CalculateField correctly. I think ...
0
votes
1answer
30 views

Assigning values to empty field in attribute table

In my attribute table, I have a field with empty slots. Though, I want to add Christchurch to fill all of these empty slots for this one particular column. I have thousands of rows, and wish not to ...
1
vote
0answers
29 views

QGIS Field calculator Problem: Display percentage

So basically I have this formula which puts out decimal numbers, but I want it to output percentages. How can I achieve this? This is my formula: (("crimes_2020" - ("crimes_2017_2019&...
2
votes
1answer
49 views

QGIS Field Calculator Syntax Error Problem

I never before worked with the field calculator and this problem is driving me nuts ... Interpretationserror: syntax error, unexpected NAME syntax error, unexpected ')', expecting $end My expression ...
1
vote
0answers
46 views

Creating/Deleting fields (with expression) for a shapefile in a batch script

I am new to GDAL/Scripting in general. For a study project, I have to create two new fields to a shapefile/vector file using a certain expression. I also need to delete two fields. Normally, I would ...
1
vote
1answer
47 views

Assigning a weight to thousands of values in the attribute table to then make a heat map in QGIS 3.10

I am working with some data that has about 19,000 values. This data has been imported as a text delimited file layer, as it is GPS (long and lat) point value data, that has an associated metadata or ...
7
votes
1answer
105 views

Identifying duplicate geometries in different layers with QGIS

I'm using QGIS 3.16 Hannover under MacOS 10.13 environment. I've got two polygon shapefile layers: 'LIC' and 'ZEPA'. Some polygons (name, code & geometry) are present in both layers and I want to ...
1
vote
1answer
55 views

Updating an existing field with field calculator in QGIS modeler

When incorporating the field calculator into the graphical modeler in QGIS is it possible to update an existing field without having to create a new field and then remove the existing. For example I ...
7
votes
2answers
177 views

Add new field in a point layer with an attribute from another layer in QGIS

I'm working with QGIS 3.16 Hannover under MacOS 10.13 environment. I've got a point and a polygon shapefile layers. I want to add a new field to my point layer with the id of the polygon that contains ...
0
votes
1answer
31 views

QGIS Fieldcalculator

I have a QGIS layer with points and the column 'name'. This column contains names like "AS 10450 to 1045" or "BAS 1045B100 to AS 1457745". Now I want to create another column with ...
1
vote
1answer
40 views

Does the $length function in QGIS field calculator support LinestringZ?

I have a shapefile with a MultiLinestringZ geometry type that I created using the grass v.drape function to attach z-values from a DEM. In order to calculate the 3d length of a line segment, can I use ...
0
votes
0answers
28 views

QGIS field-calculator time formating produces NULL

I'm struggling to format a QString attribute field to a DateTime or Date field. I've been trying the built in functions to_date to_time to_datetime of QGIS 3.10.14 and none of them seem to do the ...

1
2 3 4 5
40