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

Stripping part of text value using Python Parser of ArcMap Field Calculator [closed]

I am using ArcGIS Desktop 10.7. Using Field calculator and the Python function strip, I was able to obtain that in a test: *!test_S!.strip("ab")* Value in the source field : abcdefghij - Result in ...
-1
votes
2answers
49 views

How to sum values across fields, but ignore values greater or equal to 99 [closed]

I have a very large table where I need the sum of values across each field for each record. However, I need to skip or ignore values greater than or equal to 99.
2
votes
1answer
42 views

Saving calculated fields to reuse in other QGIS projects

I am using QGIS 3.4. I want to make attribute tables with many calculated fields that link to styles, and reuse the same structure for many projects. For example, when I draw a pipe (line vector), ...
2
votes
1answer
55 views

Automating Attribute Table with Field Calculator

I'm using QGIS 3.10.0 A Coruna. I'm using the field Calculator for an equation which requires a variable (which I Type in manually) and a (fixed) value within the same attribute table. This variable ...
1
vote
0answers
29 views

Scripting a conditional formula in field calculator QGIS

I'm trying to write down a script in the field calculator but I'm getting to nowhere. In one field I have runoff data, and in two other ones I have the first quartile of the runoff data (Q1) and the ...
1
vote
1answer
26 views

Conditional statement using Long and Text fields with Python Parser of Calculate Field in ArcGIS Pro

I have 3 fields: "ISL_Numero" - Long (values are '1', '2', '3', '4' etc.) "Subtipo_IS" - Text (values are 'A', 'B', 'C' etc.) "Ambiente_C" - Text (values I want to calculate) An example of what I ...
1
vote
1answer
39 views

Using Python script inside QGIS Graphic Modeler and iterating over all features

I created a graphic model which simply creates multiple vector attributes. All attributes are empty to be filled manually. Only one attribute column (let's call it KEYS), needs a different process and ...
1
vote
0answers
47 views

Select characters using regular expression in QGIS

I'm trying to seperate characters from database to seperate fields. Database is like: 999-10-1-1 999-10-11-111 999-10-111-1111 999-10-22-1 999-10-1111-2221 and I want something like in seperate ...
3
votes
0answers
117 views

Is it possible to rename a table column with an expression in the field calcultor of QGIS?

I want to be able to rename a few column names with an expression in the field calculator in order to be able reproduce this action with the QGIS graphical modeler. I tried to do this with the ...
1
vote
1answer
38 views

Calculate attribute table field using a near function (or a similar function)

I'm having an attribute table with a field called 'name' which represents the streetnames of an area. The streetnames are derived from OSM, but unfortunately not all street (or parts of streets) have ...
1
vote
1answer
29 views

Why does Arcpy CalculateField alter string being written to string field?

I have a "Model_Version" field in my feature class that is being used for record keeping. I do not intend to ever do any numeric operations with it, so I am storing it as a string field. Right now ...
1
vote
0answers
45 views

Using QGIS field calculator expression on Execute SQL

The following expression copy only minimum value from group/subset to a new column field in QGIS. Case when "FID_Net"=minimum("class", "FID_Net") Then "FID_Net" Else 0 End But this expression on ...
0
votes
1answer
54 views

Error in Conditional Statement in QGIS Field Calculator

I have a layer with multiple columns as shown in the picture below. If I want to make another column giving 'match' when column 'layer' and 'left(dista' are same value. How can I apply this in field ...
1
vote
2answers
46 views

QGIS - look up Table to feature Layer where Table answers questions to Multiple Columns in Feature Layer

In the image example below: Feature Line Layer = Transport - District Lookup Table = TRAFFIC_IMPACTOR_CODE What is the most efficient way to "connect" (join/relation/query/field calculator) both ...
1
vote
2answers
103 views

Calculate sequential numbers along line

I am looking for a way to calculate sequential numbers in points feature along line. I've got polygon 1 feature intersected with other layer of polygons. Then I extract points from the intersection, ...
1
vote
0answers
40 views

Calculate field with a value in a list based on field

I didn't want to write an if statement for every field. I wanted to know if there was another way to field calculate each field with the values related to it in this example table. Fields (X,Y,...
0
votes
0answers
20 views

Calculating difference between value of each row using ArcMap Field Calculator

Logic: Compute the difference between the angle for each subsequent geometry in the attribute table def GetAngleDif(angle): dif = angle.a - angle.b return dif ERROR 000539: Error running ...
2
votes
1answer
55 views

If two columns match, return only closest absolute value from other two columns

I have a shapefile with points that are joined to the closest twenty points from another shapefile. The joined shapefile has columns from the original shapefile: name (ID), elevation (Z), name from ...
1
vote
0answers
46 views

Use QGIS field calculator raster_value() function inside Graphical Modeler

I need to use the raster_value() function (from field calculator) inside a graphical modeler workflow. The function works if the raster is already loaded on QGIS, and then calling the raster name on ...
0
votes
1answer
18 views

String field being populated with a 0 when field calculating

I am trying to field calculate a text value into a string field and when the process is completed, a 0 is being placed in the field as opposed to my text value. Is there something that I am ...
7
votes
4answers
304 views

Applying field calculator for multiple layers at once

Is there a way to apply field calculator for multiple layers at once? For instance, I have 80 layers as the picture shown below. If I want to apply $area for all the layers, is there a quicker way ...
1
vote
2answers
37 views

Writing if/then Statements for Python Parser of ArcGIS Field Calculator

For some reason I cannot get this code to work in the Field Calculator of ArcGIS Desktop 10.6.1. I'm trying to use the Python parser to populate the field "SHAP_CLAS" with multiple conditional ...
2
votes
2answers
45 views

Conditional label expression gives error in ArcGIS

I have a polygon dataset and I would like to label the area of all polygons which have "kamer" in the column "type". I tried some expressions but I get different Errors. Two examples of what I tried ...
0
votes
1answer
40 views

ArcMap calculate field based on conditional statements for other fields

I have a large dataset of species occurrence records. One field, (call it "Status_Full") contains a string of abbreviations of each designated statutory status for each record. Another field (call it "...
0
votes
1answer
37 views

Calculate Field - Why does the field populate with the same number, but prints correclty?

Why does the field populate with the same number, but prints correclty? import arcpy import rivers arcpy.env.overwriteOutput = True arcpy.env.workspace = r"C:\Data" import math def sinuosity(shape): ...
0
votes
0answers
28 views

Debugging VB script in ArcGIS Field Calcultor?

I work in ArcMap and I would like to use Field Calcultor (VB script) but my script is not working. The message is: there was a failure during processing check the geoprocessing results window for ...
0
votes
1answer
27 views

Replace few symbols in all strings using QGIS Field Calculator?

I created the "Photos" column in the attribute table. Each line contains a unique path to a specific photo. For example: D:/.../IMG0031.JPG D:/.../IMG0048.JPG Now I need to replace the path for ...
0
votes
0answers
18 views

Calculating Field from text to integer using ArcMap [duplicate]

I'm using ArcGIS 10.7 trying to calculate a speed field (for my data of roads in California) really simply such that roads = 45 and highways = 65. I know I need to use an if then statement but I'm not ...
1
vote
2answers
42 views

Getting max value from field in Field Calculator of ArcMap

I'm working from a geodatabase in ArcMap 10.5, and using Model Builder. I currently have a field with values that range from 0 to 30 and I want to convert that to a 0-10 scale. The idea was to use a ...
4
votes
2answers
148 views

Switching road names from uppercase to mixed case in ArcMap?

Our county road data has road names for all roads in the county. In the attribute name field, there are some entries with all uppercase for the road name and some with mixed case. I would like to go ...
0
votes
0answers
39 views

Using Calculate Field in ArcGIS Pro

I have several field in an attribute table that have value, I am wanting to using the 'Calculate Field' GP tool to select the values and replace them with zero. Anyone have any ideas on the Python ...
5
votes
1answer
175 views

QGIS Field Calculator Expression - GeoHash32

I am attempting to write a QGIS 3.10 Field Calculator Expression that will use the mz2geohash library to encode the centroid of the current feature as LAT/LON, and then pass this tuple to the ...
1
vote
1answer
36 views

Making a spatial link to points within polygons in the field calculator in QGIS

I have a polygon shapefile of the counties in the UK and a separate point shapefile of project sites. Within the project sites attribute table I would like to add a new virtual column with the name ...
3
votes
1answer
75 views

Calculating the sum of a column based on another column in another table in the field calculator of QGIS

I have a records table with site numbers and abundances of different species at that site (e.g. site 1 has 6 common bats and 13 pipistrellus bats). I would like to sum total number (i.e. 6+13=19) at ...
6
votes
2answers
59 views

Assign values to points according to a pattern

I'm making a map of trees in QGIS (3.10). Each point represents a tree and the attribute table has a column that should contain the tree species. For now this column is empty, but I would like to fill ...
1
vote
1answer
54 views

Replacing Attribute Values With New Values Based on the Old Values Using ArcMap Field Calculator [closed]

I am using the Field Calculator of ArcMap. I need to replace multiple values (codes) with another words in a field at one time in one script. For example in my CodeField I need to replace "A01", "...
2
votes
1answer
56 views

QGIS 3 field calculator- hide name of one field (column/attribute)

My code: CASE WHEN length("Straße/Nr.")>0 THEN ( ( 'Name: '+ "Name" ) +'<br>'+ ( 'Straße: ' + "Straße/Nr." ) +'<br>'+ ('Religion: ' + "Religion" ) +'<br>'+ ( 'URL: '+ "URL" ) ...
2
votes
1answer
47 views

QGIS 3 field calculator

first: my screenshot What I want: the two fields here only with "Straße:" should be empty. The other four results are ok. What I have done is: CASE WHEN "Straße/Nr." IS NOT NULL THEN ('Straße: ' ...
1
vote
0answers
27 views

Calculating values for new field using values from another field as values in dictionary?

I am using the ArcMap application of ArcGIS Desktop 10.5. Im trying to use field calculator to return a max value between other fields in the feature based upon a condition. I am not new to python, ...
3
votes
1answer
55 views

Use field calculator to calculate geometries with a different SRS than the dataset itself

I have a polygon dataset containing hundreds of rectangle map 'frames' that represent map extents across the CONUS. The dataset containing the frames is in EPSG:3857, but the frames themselves ...
3
votes
1answer
68 views

Using the field calculator in rule based symbology

I am trying to categorise my site points by species group with rule based symbology; e.g. bat uses the formula "Group"='Bat' But I would also like to have a different symbol for where there are ...
4
votes
1answer
47 views

Referencing a polygon layer in the field calculator of a point layer to make a virtual field

I have a polygon layer that shows the counties of England and a point layer of project sites. I am trying to make a new virtual field within the point layer that will reference the county that it is ...
0
votes
0answers
16 views

AutoIncrement based on Field Value [duplicate]

Is there any way to automatically restart the AutoIncrement () function based on the Field Value on ArcMap? I am developing a model in ModelBuilder to name parcels automatically. The polygons are ...
6
votes
3answers
191 views

Use field calculator QGIS: if value in one column, then value in new column

I am having troubles using the field calculator to get what I want. One column in my attribute table is named 'Taxa' and has a set of species in it. Species are separated by #. I want to make a new ...
1
vote
0answers
14 views

Populating a text field based on another text field using Python parsing in ArcMap field calculator

I am trying to populate a text field 'Subunit' based on another text field 'ACEC_Name'using the python parser in the field calculator (ArcMap). If the ACEC_Name = "Mojave Ground Squirrel" then I want ...
0
votes
1answer
65 views

Adding spaces in string using Python parser of ArcMap field calculator

I am using ArcGIS Desktop 10.6. I have a integer field [no_lot] which contains values in the following format: '3 546 777' I need to transfer the data into a text field for joining purposes. I ...
3
votes
1answer
168 views

Shapefile disappeared from layout view and its symbology changed after updating data source?

I am trying to update a map based on a pre-built mxd template. However, after everything ran successfully (python code below), the shapefile that was updated did not show up on the map. Its symbology ...
2
votes
1answer
50 views

Designing text in QGIS

I want to write cubic meters in QGIS 3, I searched a lot but I didn't find any instructions. Is there a way to write cubic meters as m³?
2
votes
1answer
48 views

Sort or add Rank within QGIS 3 model

I have the following function in order to add a sorting value to a layer: array_find( array_sort( array_agg("field")), "field") This works fine if I use it through the calculator within the ...
1
vote
1answer
55 views

Calculating fields (multiple) with different conditions for each field using ArcGIS Pro

I have a population dataset where I want to reclassify the age groups and include gender. I have the field "gender", 1 for men and 2 for women, and the field "age". One row for each person in the ...