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
1
vote
1answer
19 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
82 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, ...
4
votes
1answer
68 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 ...
-1
votes
0answers
48 views

How to find special characters [closed]

I have a door no as 10-2-3-4-5. How can I filter these type of numbers contains 3 hyphens or 3 slashes in QGIS? I want to filter only numbers containing 3 or more any special characters. Is it is ...
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 ...
2
votes
1answer
44 views

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

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 ...
6
votes
5answers
4k views

Why do area calculations return negative values?

I have created a shapefile with some polygons and am now trying to calculate the area of these polygons. The original CRS was WGS84, I have reprojected it to WGS 84 / World Mercator so unit is metres. ...
5
votes
1answer
107 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 ...
1
vote
1answer
45 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 ...
10
votes
2answers
5k views

Making automatic updated date and time field in QGIS?

I want to make a date and time updated field as I edit an attribute field in this format yyyy-mm-dd 00:00:00 (= 2016-05-08 11:04:00) - my local date/time. The data is in a QGIS 2.14 shapefile and ...
1
vote
1answer
39 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 ...
2
votes
1answer
106 views

Showing values in attribute table in scientific (exponential) notation in QGIS3

One of my virtual field contains too big numbers like "5994865699857.456". I need to show those values in scientific/exponential mode like 5.99E+12. I didn't find proper function in Field ...
4
votes
1answer
118 views

QGIS: Accessing layer's CRS from expression 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) ...
3
votes
2answers
898 views

Copy first row of attributes and paste for each feature

In a newly digitised polyline vector layer, there are 7 columns attributes value that are choosen inside a value map combo-box that MUST be exactly the same for every newly digitised line (I choose ...
7
votes
2answers
168 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 ...
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
36 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
1answer
5k views

Writing expression syntax for Calculate Field in ArcPy?

I'm stuck on my CalculateField function with how to correctly type the syntax. I'm not particularly tied to the variables I assigned up front. The issue is syntax for the expression. I am ...
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 ...
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
20 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 !...
3
votes
2answers
150 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....
2
votes
4answers
112 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 ...
5
votes
1answer
152 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 ...
1
vote
1answer
43 views

Table join erases previous field calculations

I have issues with a normal join of two layers. The first set consists of a large list (n=259102) and I need to pick out 56 objects from this list. For that I have a second list with the 56 object IDs ...
3
votes
1answer
41 views

Call an input layer in field calculator for another layer

My model start by asking two input layer LAYER1 and LAYER2. Then, in field calculator for LAYER1, i want to join an attribute value from LAYER2. Using this code : attribute( get_feature( 'LAYER2','ID1'...
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 ...
0
votes
1answer
87 views

Iterating over table to create chainages using Python in ModelBuilder

I routinely have to do the following workflow: Map GPS points;- Create lines based on those GPS points; Split the lines at a set interval distance (every 50m, every 100m etc.) Add from / to fields ...
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 "...
0
votes
1answer
34 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
44 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
64 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
45 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 ...
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. ...
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
56 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 "...
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 ...
2
votes
0answers
28 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 ...
1
vote
2answers
48 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 ...
0
votes
1answer
29 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
45 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
44 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 ...
17
votes
3answers
5k views

Assigning row number for sorted table by column in QGIS

Field calculator has a great function under "Records" called "$rownum" which returns (assigns) the number of the current row. Is there a way to make it work together with sorting? ...
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
2 3 4 5
40