Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [field-calculator]

Use for questions about Field Calculators of QGIS, ArcGIS Desktop, etc and their Calculate Field tools

1
vote
1answer
38 views

How to write Python if/then statement using information from two fields in field calculator

I am using ArcGIS Desktop 10.6.1. I create a new field of type short integer in the Attribute Table. My new field is named CIPOT and I want to populate it with values from the field CI, but only if ...
2
votes
2answers
133 views

Using Python in field calculator to extract highest value from 3 columns [closed]

I have three columns, one for percentage White, percentage Hispanic, and percentage African American per census tract. I'm trying to use Python to extract the population subtype with the highest ...
1
vote
1answer
48 views

QGIS working with a point and polygon layer

I have 2 layers, layer A ( point data) and layer B (polygon data). Within layer A I want a column which will indicate Yes or No if a polygon is within 500m. I have created a 500m buffer for layer b ...
0
votes
1answer
26 views

Using Calculate Field tool to make empty field be populated with adjacent field's data?

I have about 80 species of birds with at least about 100,000 records each. I used the iterator tool to create a field named [Count] for each species, but now need the empty field to be populated with ...
2
votes
2answers
28 views

Calculate field does not update using ArcPy

I want assign 33 if the field no_apt is zero and 34 if no_apt is any else value. The model run without any error, but no value are assigned the field GGV_kW. What is wrong with the code since it doesn'...
3
votes
1answer
44 views

How to re-use an expression, stored as a string, in QGIS Field Calculator

As discussed in this question, QGIS automatically saves recently used expressions in the field calculator. But recently used expressions are deleted after a while. Sometimes I need to re-use an ...
4
votes
1answer
151 views

How do I get this query to work in the field calcuator in QGIS 3.2?

I have a geopackage file which contains point data with column of 'depth of cover' and score. In the score column I am using the field calculation to create an expression so that any number less than ...
2
votes
0answers
46 views

Extract features in .gdb file based on their attributes

I have a .gdb file with >17,000 features. Simplified example of attributes table: ID NAME DATE ETC 0001 london 2012 12 0002 london 2012 23 0003 thame 2012 45 0004 ...
2
votes
1answer
58 views

Simplifying variable (if condition) with field calculator in QGIS

I want to simplify the variable ("SIOSE_CODE") which has values like this: A(90MTRfr_05PST_05SDN) A(65PST_35MTRfr) A(70FDCfr_10PST_10MTRfr_05MTR_05SDN) The first number (here 90 resp. 65, resp. 70) ...
3
votes
2answers
96 views

Extracting substring from field in ArcMap using Python Parser of Field Calculator?

I have some parcel data where I need to extract a subdivision name from a long string. The format is always "Subdivision: ____ ______ _____" etc. BUT, there is no uniformity to what comes before or ...
1
vote
1answer
33 views

Argument 1 has unexpected type 'set' Error using processing in QGIS?

I am currently working on a code that adds a field to a shapefile and inputs its filepath. I understand that the processing.run has changed from qgis 2 to qgis 3 but I am not sure why I am getting ...
3
votes
0answers
32 views

Time series condition through field calculator [closed]

I am attempting to filter some time stamped data which I have enabled through the Convert Time Field tool, depending on a true/false condition. I am doing this through the field calculator within ...
0
votes
1answer
28 views

Use relation to apply same colour to children feature

I m'looking for a function with field calculator in a symbology context to apply the colour of parents features to the children with transparency.
0
votes
3answers
54 views

Converting VB codeblock to Python in ArcGIS Field Calculator?

I have created a tool in Model Builder to plot telecoms data - the user clicks a point on the map, enters a radius and enters an azimuth. The model then creates the buffer and cuts a segment out of ...
1
vote
0answers
40 views

Using IF-Statements in Calculate Field Code Block inside an Iteration

I have created a model in ArcGIS 10.2 that iterates through some feature classes in order to add a field 'Zmin10' (double) and calculate the field value based on a variable (called "Minimum") to which ...
1
vote
0answers
49 views

Making sequential number's not based on Object ID number

I have a question about sequential numbering. I found a script (i'll put it below), which allows me to make a sequential numbering based on OID and thats good. But what i need is different structure ...
0
votes
1answer
29 views

VBA/Python If/then statements in Field Calculator for one column based on another not working

I know this question has been asked a hundred times on here, for example: Basic If/Then in Python Parser of ArcGIS Field Calculator? Using if/elif/else statements in ArcGIS Field Calculator? Checking ...
0
votes
0answers
30 views

Calculating sequential numbers into sorted table not dependent on OBJECTID? [duplicate]

I am having a problem with adding sequential numbers to the new column based on other sorted value. I would like to use 'Sort by' column to be able to generate numbers in the 'Required number'column. ...
0
votes
1answer
47 views

Extracting numbers from string field but omit some unnecessary cells using Python Parser of ArcMap Field Calculator?

I refer to Extracting numbers from string field using Python Parser of ArcMap Field Calculator? The script above works fine for me, but I have to develop it a little. What I want is just to omit ...
0
votes
2answers
40 views

ArcGIS If/Else with calculation

I am seeking to calculate the variable MASSSTAB through rounding the variable LAENGE and doing some basic math. My codeblock currently looks like this: x = long(round(!LAENGE!, -1)) def ifBlock(m, ...
3
votes
2answers
59 views

Refering to (Joined) Field Names in arcpy in Field Calculator

I'm trying to update the locations of a point FeatureClass using a table. I have joined the table to the featureclass, and am attempting to use Field Calculator to update the SHAPE field. I found ...
1
vote
1answer
38 views

Line first,last node distance along another line QGIS

I am using QGIS 2.18.6 . I have created two line layers. First layer "testroad" with long line (road). Second with short lines along,near road. I would like to know distance of first and last point of ...
3
votes
2answers
111 views

How to Refer to a Null value with ArcPy Expressions

I feel like this might be a bit of a simple answer but I can't figure out how to refer to Null values in a field using an expression in python. I've tried using the following as well as = None and =...
5
votes
2answers
79 views

Measuring average, min and max of vertex height of linear shape using QGIS?

I have a linear shape, all of the vertexes of each segment has a z-value, stored in the geometry. I need for every record, segment the average, min and max height value aggregated from their vertex ...
0
votes
1answer
36 views

Simple Field Calculation With No Results in ArcGIS Pro?

I have a grid in ArcGIS Pro that I've named the X and Y axis (in separate columns) and am now trying to do a field calculation on the total grid name (I've tried using both single and double quotes. I'...
2
votes
4answers
71 views

More Efficient Conditional Statements - ArcGIS Field Calculator

I am new to Python and have successfully created the following statement that writes a change period value (01 or 02) based on the municipality and date fields. I am wondering if anyone could point ...
1
vote
1answer
35 views

How to turn a string field with 2 numbers in two numerical fields in the atribute table?

I have a feature class with a big number of features. In the attribute table I have a string field made from two numbers separated by an underline (e.g.: 0_1, 98_237, 31_31...). I want to create two ...
2
votes
2answers
126 views

Converting none to zero (0) in geodatabase table using ArcPy?

I have an attribute table looks like this How do I convert Nulls into 0? I've tried to set this table non nullable type but got this: while the official doc says this: At least one of them is ...
0
votes
2answers
66 views

Concatenate fields (double and string) to create address using arcpy

fields: STNUM = double STRDIR = string STRNAME = string STRTYPE = string Tuple and s.format I have tried: arcpy.CalculateField_management (newparcelsUTM, "SiteAddress","{0} {1} {2} {3} ".format('!...
0
votes
1answer
56 views

Why the strange area calculation in QGIS?

I have a 550 meter by 550 meter square polygon in a shapefile. The QGIS 2.18 project and the shapefile both reference EPGS:32648 WGS84/UTM48N. EPGS:32648 uses meters as the units. When I use $area ...
4
votes
3answers
205 views

Converting full road names to abbreviation using ArcGIS field calculator?

I have a data table with a column 'names' that have street names with street type (Road, Lane, Street etc.). I need to get the names in a format like in column 'new_names'using field calculator in ...
2
votes
1answer
80 views

Different results using $length (field calculator) in QGIS versions 2.18 and 3.0

I use the field calculator to measure the length of LineStrings in my shapefile layer, but i get different results when using QGIS 2.18 or QGIS 3.0. If I am using the local coordinate system the ...
0
votes
1answer
31 views

Splitting second word of attribute using Python Parser of ArcMap Field Calculator?

This is Field Calculator in ArcMap. I am trying to split the word after the first space if the words starts with "San" like San Francsico, San Diego and etc. It return an error. Below is the script.
2
votes
1answer
36 views

Number each value in each section due to other value

I'm working with map of plants in garden. This garden is divided into about 40 sections. Plants of one species have their number for example every Scots pine is 12 and every Common oak is 15 in field "...
0
votes
2answers
93 views

Using Arcade, AGOL, and Attribute Expressions to Create a Text field with Quotes

I am working on creating a Attribute Expression that would display HTML with quotes in the field. I tried putting double quotes for the inner quotes, but I keep getting "Parse Error: Unexpected String"...
4
votes
1answer
114 views

Using QGIS field calculator with geometry operations between layers

A curiosity question. I am looking for making a field calculation with QGIS, I see is possible to include the geometry field of the same feature layer, nevertheless I was wondering if it is possible ...
2
votes
1answer
50 views

ArcGIS Pro Field Calculator completing without error, but no change to Feature?

I'm attempting a research project in which I am seeking to categorize a municipality's Property Use Codes as Generalized Land Uses. For example, "AGRII - Developed Farmland" and "INDGR - Grain ...
0
votes
2answers
116 views

How to convert Zipcode+4 into standard 5 digit zip code using Field Calculator

I have a ZCTA shapefile that I would like to join to a table by the zipcode. My problem is that some of the zip codes in the table have a 5+4 digit format, and the ZCTA shapefile has only the 5 digit ...
2
votes
0answers
29 views

QGIS: processing-modeler to add multiple layer name to attribute field

I'm trying to add layer name using the field-calculator in QGIS (3.4.1). If I do this manualy it works fine, but if I do this using the processing-modeler I get NULL for every field. I just type @...
0
votes
3answers
46 views

Making one field/values equal to another field/values

Lets say I have created a new field called "SFX" in a shapefile called "myshape.shp": input = r"C:\files\myshape.shp" arcpy.AddField_management(input, "SFX", "TEXT", field_length=100) There is now ...
0
votes
1answer
25 views

Adding Greek letters in existing columns in ArcPy?

Example table: colA colB colC 173743 01 8974 173443 02 8934 173943 05 8924 173243 01 8994 173343 03 8964 I want to pass to the third column: The 3 first numbers from the ...
2
votes
1answer
58 views

Distance betweeen classified Points

I got two sets of points. The first set has a unique ID The second set references to this ID (one-to-many). So I merged the two sets. Now every point in the joined table has the X and Y coordinates ...
1
vote
1answer
24 views

Decimals Appearing after ArcGIS Pro field calculation?

I'm working on an application that would reference phone numbers in an online application that would allow our call center to automatically call the number depending on the jurisdiction. When I take ...
0
votes
2answers
31 views

How to break a string line with many values to a single field?

I don't speak English very well... I have this case, for FID in field "CPFS*" exists some codes. I need in field "identifica" only one. For exemple: to [FID = 0 identifica = 00417549210], to [FID = 1 ...
1
vote
1answer
54 views

Averaging rows in attribute table QGIS

I have two rows with monthly rain run off per watershed as in the picture below. I'd like to obtain the average runoff between may and august for basin 218187 and 218265 (note that basin 218187 will ...
0
votes
1answer
86 views

Replacing all null values in attribute table by “no”

I am new to QGIS. This question about how to use the field calculator, because the procedure to replace all fields is explained very nicely in Replacing all null values from attribute table with zeros ...
1
vote
1answer
128 views

Add a character every nth character in QGIS Field Calculator

I can't find an expression to add a character every nth character from the right of a string, in field calculator. As an example, I have a list of UK postcodes which I need to add a space to 3 ...
1
vote
2answers
120 views

Multiplying values for each field with unique id

For one country I have population densities (highlighted with a red rectangular) per watershed literacy rate 4.48% (highlighted with a green rectangular) watershed IDs, e.g. 3222, 3271 etc. I'd like ...
0
votes
1answer
53 views

Calculating field with ArcPy cursor?

I am trying to calculate field with the formula. I tried arcpy.calculate field management but still having difficulty. (10/10.4*(100*(math.exp(0.000871* !A!)-1+math.exp(0.000537* !B! )-1+math.exp(0....
1
vote
1answer
38 views

Connection between output variable and calculate field

I want to use the calculate field function, to calculate which input comes an expression that should be connected with an output variable. But I can't figure out how to do so. And if it is possible ...