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
26 views

Issue with Calculate Field and text array

I've tried this expression in the Arcade playground and it works as I expect. Number(Split($feature.PVI,"+")[1]) $feature.PVI is a text field that contains something that looks like "R+...
0
votes
0answers
22 views

Fill fieldX based on shared fieldY

I have a dataset with sensors measuring e.g. Nitrogen. Every sensor has an unique ID, but for every sensor there are multiple points (for each year one). However, when adding the new values for this ...
8
votes
2answers
160 views

Converting geometry to WKT format by using QGIS Expression

I have a gpkg file and I am changing the geometry to wkt format by using expression geom_to_wkt( $geometry ) in the Field Calculator. The output looks like this in the image. The geometry type is not ...
4
votes
1answer
76 views

Exporting QGIS Field Calculator user defined function [duplicate]

I have created many Python functions in QGIS Field Calculator Function Editor. How can I export the user defined functions to use in other computers or share to other people? My QGIS is 3.12.1 on ...
7
votes
3answers
185 views

Allocating point attributes as default values for line layer

I want to add points "ID" attribute as a default value for a line created between two points, for line layer fields "start_point" and "stop_point".
3
votes
0answers
34 views

Change default of QGIS field calculator: turn off “Only update selected features” (always update all features)

Is there a setting to change the default so that the checkbox Only update %1 selected features in QGIS field calclulator is not checked? As a default behavior, I would like the expression to be ...
1
vote
2answers
98 views

Replacing characters using an expression in QGIS

What regular expression can I use to change values in a string field? I need to change the letter B to a symbol - before the digits, and digits with letter F to make positive. Like this:
4
votes
2answers
113 views

Using the field calculator to replace the character in QGIS

How to use the field calculator to replace the character - in part of the values with the character "B" at the end of this value? I also want to replace the other values without symbol - ...
3
votes
1answer
35 views

Saving Starting / Ending points of connecting line in attribute table

I have 3 layers ( 1 line and 2 points) as shown in image. The layer id,s are mixture of integers and text such as cable4389175, node1 , service_point5316. I connect the two point layers (node and ...
0
votes
1answer
27 views

Ending Python if-then using triple double quote gives EOL while scanning string literal [closed]

I keep getting the same error, I think it's because of how I end my if-then statement. It basically looks like this, except it's much longer (like, 300 lines long). myIfThenVariable="""...
3
votes
1answer
45 views

Getting user input for QGIS FieldCalculator parameters

I'm trying to calculate and output a virtual field -- something that is a straightforward function of fields from a vector layer in QGIS 3. The FieldCalculator does the trick, but I need to manually ...
1
vote
1answer
34 views

Calculate ratio of a vector field within a raster grid cell

I have a large dataset (shapefile) in which one variable is binary. I want to be able to find the fraction of 1 for all the points, but within a given raster grid cell, see below. Yes, as you can see ...
1
vote
1answer
15 views

Adding two fields in attribute table and assigning result to third field if some cells contain null values using ArcGIS Pro Field Calculator

I am using ArcGIS Pro, field calculator to add the values of two fields (Result_A and Result_B) and assign the value to new Field Combined_Result. The type for all three fields is "double". ...
1
vote
0answers
32 views

Using ModelBuilder to iterate row and calculate field (code block)

I would like to use "iterate row selection in ModelBuilder" and for each row, I want to use the field calculator's code block to create a conditional statement that goes: If field=0 then go ...
2
votes
1answer
26 views

How to sum the area depending from another field value in field calculator?

I have a landcover-layer with an attribute of the administrative region (GEN). I am looking for an expression in the field calculator to calculate the summarized area depending on the GEN-field value. ...
1
vote
0answers
30 views

Adding an incrementor in CalculateField_managment() expression

I am trying to recalculate a value for a field using arcpy.CalculateField_management() using a tricky expression. Currently, I am recalculating one field named REACH_ID, using another field ('CO_FIPS')...
6
votes
1answer
100 views

Creating Unique IDs of points in order from west to east

I have a dataset with over 1000s points. I am wondering if I am able to give each point a unique ID starting from west to east. I am using ArcMap 10.6. Is there a way to do this in ArcMap?
0
votes
0answers
16 views

How to average # of parks per child within 1 sq mile and average parks per child in whole county?

I have a shapefile of census tracts within Cook County, IL that has been combined with a shapefile of every park in the cook county area. It displays as a graduated color scheme of number of parks per ...
7
votes
2answers
202 views

Deleting any characters after certain character in QGIS label expression

I have a shapefile with attribute values like this: C834 K9 L523;L553 W2,T48 I want to display only the characters before certain characters, for example ; and , : C834 K9 L523 W2 How to achieve ...
4
votes
1answer
69 views

Use field calculator to check for intersection

Ultimate goal I plan to retrieve attributes from layers using the field calculator where they intersect with a geometry. Current step Checking whether the current $geometry intersects with the layer ...
2
votes
1answer
45 views

When calculating a field in an attribute table, how can I find one value out of many fields when every other field has a null value?

I have 4,018 rows of data with about 50 fields. About 45 of those fields are the same variable, but the data came from different layers, so out of those 45 fields, only one has a value for the row, ...
1
vote
3answers
85 views

How to calculate/update multiple fields at once using QGIS 3.10 field calculator?

In QGIS 3.10, i want to calculate multiple fields at once on more than 10 similar layers. I now i can do it manually, but I'm looking for an automatic way. I need something like this: "nomrue&...
1
vote
0answers
52 views

How to use multiple field calculator in QGIS graphical modeler

I find myself struggling to understand how to chain field calculator process in the graphical modeler in QGIS. I have build a model that take 3 layers input and 3 vector field parameters and try to ...
1
vote
1answer
56 views

Using values of a coma-separated list to arrange and extend attribute table in QGIS

In my attribute table (neighbors) there is a comma-separated list in which the IDs of adjacent polygons are located. But now I want one line to appear for each adjacent polygon. So there would be e.g. ...
0
votes
1answer
32 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 ...
0
votes
0answers
20 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> ...
1
vote
1answer
88 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
37 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
53 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
39 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
49 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
44 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
107 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
40 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
96 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
59 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
37 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
61 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
59 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
170 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
47 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
30 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
52 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
96 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&...
1
vote
0answers
20 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
136 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 ...

1
2 3 4 5
39