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

0
votes
2answers
32 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, ...
2
votes
1answer
32 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
32 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
105 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
70 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
31 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
60 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
30 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
124 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
62 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
48 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
199 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
75 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
23 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
34 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
58 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
87 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
46 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
64 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
22 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
42 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
24 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
51 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
20 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 ...
-1
votes
0answers
18 views

How to retrieve Z data from a shapefile from points on another separate layer using GeomNearest via Field calculator QGIS

I posted a question a week ago regarding extracting nearest Z data within a layer representing elevation, for points within another layer representing start and end nodes for roads. The question can ...
0
votes
2answers
28 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
51 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
64 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
121 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
112 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
44 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
35 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 ...
1
vote
0answers
39 views

Empty value for ObjectID=1

When I try to use field calculator in ArcGIS with polygon data in a geodatabase, I get an error "Empty value for ObjectID=1". I can manually change that field but when I try to use field calculator, I ...
0
votes
1answer
30 views

Can't copy field to another: 'Empty value for Objectid = 0'

I tried to copy a field with dates that had type 'TEXT' to a new column of type 'DATE' because it is not possible to change the initial type of the original field. arcpy.CalculateField_management(r'...
0
votes
1answer
20 views

Using ArcGIS Field Calculator to change text to digit? [duplicate]

I am using ArcGIS Desktop 10.6. I have one field that is titled SEVERITY, and is string type, and has words like "Medium" "Low" "High," etc. I would like to assign a number to correspond with the ...
0
votes
1answer
26 views

Add default month/day to known year in new date field?

I have a text field featuring a 4 digit year. How would I assign a default month and day to the year in a new date field? ex. 2010 needs to be converted to 1/1/2010 I attempted this in the field ...
1
vote
2answers
47 views

Deriving bearings from csv points

I've been working on deriving bearings and distances from lines in qgis 2.18 from a number of coordinates stored as a csv file. I have been able to generate the bearing of the lines using this ...
-1
votes
1answer
26 views

Representing 2 digits in 4 digits ArcMap attribute table?

I would like to represent the 2 digits in the attribute table of the ArcMap as 4 digits. For example, yun field '23' -> test field '0023' / yun field '123' -> test field '0123' What can I do?
5
votes
1answer
66 views

Calculation of a new field with conditions

I am struggling with the calculation of a new field that is based on another field. I have one field with numbers that appear twice ("Field_A") and I need to calculate a new field ("Field_B") that ...
1
vote
1answer
33 views

Min and max in a field attribute with ArcPy?

I have a shapefile with a field attribute called "Value". I would like to find the min and max in this field and if max-min > 0.014 return 1 (or Yes) if max-min < 0.014 then return 2 (or No) ...
2
votes
1answer
102 views

Weighted values of the field in QGIS

In QGIS in the Attribute Table, there is a field with values. For this field, I need to calculate the sum of all its values and divide by the number of values that are not equal to NULL. Afterwards, ...
0
votes
1answer
28 views

Remove certain substrings from name column

I have 2 kind of Strings in column "NAME": Berlin Reg.-Bez. Hannover I need a new colum "NAME2" changing the cities to: Berlin Hannover I have this so far: if("NAME" LIKE 'Reg.-%',xxxx,"NAME") ...
1
vote
1answer
37 views

How create a field of sequential number with autoincrement() that start from zero in arcpy?

I would like to create sequential numbers in a field of a point shapefile that start from 0 with an interval of 0.050. The main code works whenever the start number is not zero. The original code ...
1
vote
0answers
31 views

Discrepancy in values between Summed Line Lengths and Clip in QGIS

I have a polygon vector layer containing four polygons, corresponding to four Protected Areas in a state in India. a line vector corresponding to all the rivers in that state. Desired output: I want ...
1
vote
1answer
65 views

Trouble with creating new attributes on large shapefile?

I have a point shapefile with ~2.5 million points. I am creating a new attribute converting ft to m, and QGIS (2.18.15) is having trouble working with the datasets. I have seen suggestions to only ...
0
votes
2answers
38 views

Inputting formatted concatenate in field of attribute using ArcGIS Desktop?

I am new to working in ArcGIS Desktop. I have feature point data with 3 fields in table attribute (objectID, shape and sequence). I want to add another field lets say called "name_sequence).. in ...
1
vote
2answers
38 views

Adding formatted sequence Number based on location?

I have Feature Point DATA. I need to add some sequence number to the attribute of each point, based on their location in the display map. In my attribute it'S ordered in the opposite way. In ...
0
votes
0answers
15 views

Precision and scale 0 after passing parameters

I have a field in GIS that it needs a precision and scale argument. Using Arcpy, I pass the argument like this: d_fields = ["acres" , "p_dev"] for field in d_fields: arcpy....
1
vote
1answer
90 views

Calculate geometry not working in ArcGIS Pro?

I have a set of points whose x and y coordinates I would like to add to the attribute table. The points are stored as a feature class in a geodatabase and I have ensured that they have the proper co-...
6
votes
3answers
348 views

How to Fill blank Fields with other column QGIS

I have two columns of the same data and I want to unite for example I have the column "pole_type" and "pole_type_" and sometimes one has values and some times the other like seen in the photo I ...