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

How to use calculate geometry on non versioned data?

Every time I attempt to use calculate the geometry of some shapefiles I receive this message: ERROR 130051: Input feature class is not registered as versioned. I did not understand why a mathematical ...
1
vote
1answer
36 views

What is the syntax for assigning a feature attribute value to a variable in the QGIS Advanced Python Field Calculator?

Using the QGIS Advanced Python Field Calculator, I am able to assign the new field a value from a feature an existing field using value = <Attribute_1>. I run into a problem when I am using ...
1
vote
6answers
46 views

List of ID's of all selected features as default-value

I would like to get a array with id's of all selected features of layer 'LayerB' (field-name: "id_of_layerB") as a default-value in a qgis-attribute-form of 'LayerA'. I tried something like ...
1
vote
0answers
23 views

QGIS Advanced Python Field Calculator Syntax

I am attempting to calculate the difference between two azimuths using the following code in the QGIS Advanced Python Field Calculator : def azimuthDifference(): Model_Azimuth = <Model_Azimuth> ...
3
votes
1answer
114 views

QGIS: Use of a model output in the same model as a layer in the field calculator formula

I am trying to use field caluclator within a model. In this formula I want to reference the output (temporary layer) of another step of the same model (output objektfilter_strassen_wege, which is ...
0
votes
1answer
39 views

QGIS Field Calculator Help Results Always NULL [closed]

I have a shapefile which is points and I created the table to include the x and y coordinates, now I also need to have the coordinates in DMS and DDS so I have gone to the field calculator and use the ...
1
vote
1answer
57 views

Removing last part of a field in QGIS attribute table, not the same length of cells

I got a question regarding removing and/or creating a new field just with the 4 first characters of a field. Whenever I search for this I just find answers about how to remove a specific number of ...
0
votes
1answer
51 views

$area is not returning the correct value in QGIS

I'm working in a black QGIS project set to EPSG:27700 and a layer in EPSG:2770. When I measure the area of a polygon using the measure tool I get a value of 7594315ha. When I subsequently do this in ...
1
vote
1answer
44 views

Calculating dates and using arcpy.CalculateField_management(

I am in the process of converting my scripts from python 2.7 to 3.x I am trying to calculate a date field with a datetime object exactScriptTime = datetime.datetime.now() exactScriptTime = ...
0
votes
2answers
51 views

How to substring a number out of a string field using Python field calculator in ArcGIS? [duplicate]

Using ArcGIS Desktop 10.7 I want to substring numbers as text out of a string field into a new string field with field calculator so that I can use them for layer symbology. The field contains highway ...
1
vote
0answers
51 views

Randf in correlation to other field QGIS [closed]

I'm looking for solution that will allow me to create random values with correlation to other field. For example: Field_a | Field_b (that will contain random values) 1 | 0.001 2 | 0....
0
votes
0answers
45 views

Python conditional statement for range of numbers isn't working

Using ArcGIS desktop 10.7. The field Shape_area_Hect is float and the field Core_patch is string. Error for following syntax: def Reclass(Shape_area_Hect): if (Shape_area_Hect >= 12150): ...
5
votes
1answer
115 views

Converting double values into time in QGIS's Field calculator

How can I achieve the following result (in column "output", string) in QGIS attribute table? The values in "duration" were calculated with some other formulas and represent a ...
1
vote
2answers
41 views

Finding average of values assigned to a field

I am using ArcGIS Pro. I have an attribute table with point data of the amounts of time it takes a vehicle to reach its destination. Each destination is assigned to one of three zones and each ...
5
votes
1answer
100 views

Defining a Python function to calculate a value using multiple fields

I am using the Calculate Field tool in ArcGIS Pro to get it to calculate fire hydrant flow data. I need data from the table fields PitotPressure, COE, and HydrantOrificeFlowed in an attribute table to ...
2
votes
1answer
75 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 ...
1
vote
1answer
42 views

Re-ordering text strings within field using Python Parser of Field Calculator

At ArcGIS 10.8.1, I have a shapefile attribute table containing a text field with names ordered last, first, middle, as in this example: Smith Sally J Doe John Jones William Randolph ... I need to ...
0
votes
1answer
80 views

Expression to Transform XY coordinates to LatLong in QGIS

I have a Point Layer referenced in a projected CRS (UTM) with X, Y and Elev fields that represent coordinates of some points I have surveyed. I would like to have in the same layer Lat and Long fields ...
0
votes
1answer
62 views

QGIS Action to update several fields

I would like to update one ore more fields of my attribute table on demand (f.e. using a QGIS Action) with one simple click. For now I have to open attribute table or the layer properties, start field ...
2
votes
2answers
176 views

Reducing number of if statements in Field Calculator code block of ArcGIS Pro

I am using Python 3 in ArcGIS Pro. In plain English, my goal is calculate one field in a table using a list of values from another field. I can do this with a long list of if statements, but I can't ...
2
votes
1answer
72 views

QGIS field calculator in the graphic modeler: Is it possible to refer to a field name that contains a substring?

I am building a model in which I join attributes from a .csv file (let's name it "upload" here) to a layer. I want to work with some of the new attributes in the next step of the model and I ...
2
votes
1answer
31 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'...
3
votes
1answer
73 views

Increment value based on grouped field

I've got a dataset of buildings roof segments in shapefiles. I need to sequentially number the roof segments from 1 to n of each building. Is there a way to do it with the QGIS field calculator? ...
1
vote
3answers
107 views

QGIS 3x put apostrophe in the field calculator text

I want to put the street name in my field calculator. The problem is, that it contains the apostrophe as per in the image below: The expression becomes invalid. Even if I try: "Christy's Yard&...
2
votes
0answers
24 views

QGIS 3x Update existing field autoselection in field calculator

I want to have the "Distance [meters]" column autoselected when launching a data field calculator. It's driven by a multitude of records, which I want to put by using the expression (...
3
votes
2answers
156 views

Expression in arcpy.CalculateField_management

I am working on a toolset, and one of the inputs is a field of a shapefile. I have defined the field and I have used it in multiple functions, and it is working without any error. The problem is that ...
2
votes
0answers
58 views

Calculate multiple fields at once

Image a polygon layer with fields calculated from values found in a point layer. No witchcraft, there, as that's what we have all been doing for years. The polygon layer needs to be populated with ...
3
votes
0answers
57 views

Reducing points but maintaining attributes from original shapefile

I have a shapefile with points but there are a lot of points and I want to reduce the amount. I have tried "Points thinning" which automatically reduces the amount of points but it loses all ...
3
votes
2answers
168 views

Adding consecutive unique ID for distinct value sets and sorting by date [closed]

I have a layer with features, which have a unique ID, called "Object_id". A second column is "Date", a third called "info" (see below). What I need is to fill the fourth ...
3
votes
1answer
80 views

Calculate the shortest distance between polygons QGIS 3.12

I need to calculate the shortest distance from the boundary of one polygon to the boundarylines of a set of polygons as shown in the image below I have followed the instructions according to this ...
4
votes
0answers
59 views

Calculate Field tool in ModelBuilder only returns first value of string

I am using ArcGIS Pro 2.6.1. In ModelBuilder, I am using a Calculate Field tool to determine a compliance status based on a color value derived from a Bentley DGN file. Here is the expression used: ...
4
votes
2answers
77 views

Selecting features whose text is equal to the text after certain word in QGIS

I have origin-destination lines and I'm looking for intra-city lines or lines whose origin and destination are in the same city. A sample intra-city feature would be "Quezon_City to Quezon_City&...
9
votes
1answer
157 views

Determine roundness of polygon in QGIS

Suppose a polygon layer in QGIS with differently shaped polygons (no multi-geometries, let's keep it simple). Is there a way to calculate some kind of roundness characteristic of the individual ...
4
votes
3answers
239 views

Adding unique ID for groups of items using field calculator in QGIS

I have a set of string values in a shapefile's attribute column and want to assign a number to them in a way that each unique string gets an integer number, like this: How do I do this using the ...
2
votes
1answer
55 views

Creating aggregate attribute from two polygon layers

I have two layers: one underlying land use information layer (with columns 'land_use_type' and 'area') and one for leased land. To organize the leasing of the land it would be important that when ...
0
votes
1answer
37 views

Selecting attributes that contain “%”-symbol in Field Calculator

I have a Text field and it contains values that have a "%"-symbol and "°"-symbol. Example: 1.2% 3.2° 2.3% -1.2° I don't know how to select just the values that have the "%&...
0
votes
0answers
30 views

How do I obtain the coordinates of the points that define the polygons' shape in ArcMap (not the centroid)?

I'm starting at ArcMap. I want to export the coordinates of the points that form the line that defines the shape of each polygon. I can add a new field to the attribute table, but when I calculate the ...
2
votes
1answer
115 views

Using Field Calculator to Combine Month, Day, Year into Date

I merged 2 layers in QGIS and am trying to clean up the attribute table using the Field Calculator. One layer has 1 column called Date in the format YYYY-MM-DD. The other layer has 3 separate columns ...
4
votes
2answers
94 views

Calculating new attribute based on condition in QGIS 3 Field Calculator

I have a shape with different city areas that contains the average building heights ("HHO-mean") in meters. Now I want to categorize the average bulding heights in a new column in five ...
1
vote
1answer
87 views

Stand alone Calculate Field script using Code Block for IMG Raster in Python

I am somewhat familiar with using the python language in the Calculate Field tool in ArcGIS Pro, but was wondering how this is done in a stand alone Python script with a raster .img (...
0
votes
1answer
78 views

How to fill a field with the ranking of another field for a shapefile attribute table in ArcGIS Pro?

I want to add a field ("FreqRank") in my attribute table with the rank of the field "COUNT", so it was sorted descendingly (see below). I tried the code here from another post ...
1
vote
0answers
33 views

Implementing numpy.mean in Expression using Calculate Field Tool in ModelBuilder

I am using ArcGIS 10.4 ModelBuilder. I developed a model that iterates through a bunch of feature datasets. I need to add a field to each one of these features and apply one formula on it. My formula ...
3
votes
1answer
62 views

Splitting string into “alphabetic” or “numeric” in QGIS 3.10.1

What are the right functions and formulas with the field calculator to delete "alphabet" or "number" inside a field? Let me be clear. I want to be able to delete "alphabetic ...
1
vote
2answers
60 views

Calculate the value of two different fields (int), and summarize those two into a new field in attribute table [closed]

I am trying to make a pie chart, that means I have to connect some fields in AT. How do I sum two integer fields into a new created field. The sum should also be connected to the different object id. ...
2
votes
1answer
47 views

How to keep 0 decimals using QGIS Field Calculator's “to_string”

Why does Field Calculator's to_string function rounds decimal numbers if they have zeros? For example: to_string(70.0) gives 70 (textual). But I would need it to be 70.0. And as I have to convert an ...
3
votes
2answers
80 views

When using case when in QGIS 3, even without else, all other previously filled cells are replaced by NULL

I would like to update a column with different strings based on other strings in another column. For instance : if A, B, C in column 1, write Cat1 in column 2. So I use "case when". But even ...
3
votes
1answer
34 views

Creating value in QGIS based on multiple “OR”-conditions

Different cities are part of the same subregional group. I would like to assign this same name to all these cities. I want to live the other cells empty. So far I have tried these but it doesn't work: ...
0
votes
2answers
87 views

Extracting numbers and text from string field using Python Parser of ArcMap Field Calculator?

This is a similar question to Extracting numbers from string field using Python Parser of ArcMap Field Calculator? I have a similar issue in ArcMap 10.6. I have a field named 'SIZE' that holds number ...
2
votes
1answer
59 views

Creating new column based on parts of strings in another column in QGIS

I have a column with zoning names (with "subzones" like UV036, UMTs2 etc.) and would like to create a new column with the general zone instead (UV instead of UV036, UMT instead of UMTs2... ...
4
votes
1answer
69 views

How to sum two fields in Python Advanced Field Calculator?

I need to perform a quite simple task (or at least it was simple on ArcGIS): I have two numeric fields called c0g1 and c0g2, and want to add them into a new field named TOTAL. Must use the Advanced ...

1
2
3 4 5
39