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
3
votes
1answer
417 views

Using replace function to replace value to one of value map using QGIS field calculator?

I kind of made a mistake, with a certain setting one column to a value map. Originnaly the "Regio Column' had text which consited of four specific value's (five if I count Null with it). To make thing ...
3
votes
1answer
500 views

QGIS graphical modeler calculator

My question is about the calculator in the QGIS graphical modeler. I explain my problem issue first: I want to build a modeler that creates buffers around layers and makes a selection on a second ...
3
votes
4answers
9k views

Concatenating string data plus numeric data in ArcMap field calculator?

I am using ArcMap 10.2.2. I have three attribute fields (Address_No: 1, StreetName: Main, Street_Ty: ST) that I want to merge together. How do I concatenate string data found within the table plus ...
3
votes
1answer
3k views

Deriving Z-score values for given field using ArcGIS for Desktop?

I have a shapefile with an attribute field with a range of numerical values. How do I derive z-score values for this field using ArcGIS for Desktop?
3
votes
1answer
659 views

Field Calculator: Split address into house number, street name

I have an ADDRESS field in a table with values like: 1 MAIN ST 20 SIDE AVE W 300 JOHN DOE JR RD S I want to use the field calculator to split the addresses and insert the parts into HOUSE_NUMBER and ...
2
votes
1answer
1k views

Does QGIS support parsing of date strings in tables?

It is straightforward to load GPX files (GPS downloaded tracks / points) into QGIS, then save and manipulate them as shapefiles. However, the recording date (in the comment (cmt) field) of waypoints ...
2
votes
1answer
759 views

Copy first row of attributes and paste for each feature

In a newly digitised polyline vector layer, there are 7 columns attributes value that are choosen inside a value map combo-box that MUST be exactly the same for every newly digitised line (I choose ...
2
votes
1answer
399 views

sequential number field in ArcGIS?

How can I get a sequence of numbers 1,2,3,4 from the model below Is there any code I can use in Arcgis to do this in the field Calculator ObjectID POINT_X POINT_Y N_Ordem 179705 277537,...
2
votes
2answers
3k views

Trimming Specific Text Values in QGIS Field Calculator

Sorry if this is a dumb question, but I am wondering if there is a way to copy the text from one field to a new field, but eliminate specific words. For example: **Old Field** ...
2
votes
1answer
575 views

Add or subtract days to date field using the field calculator

I am using ArcGIS 10.1 I'm not a programmer I want to use the field calculator to add 4 days to the current date if the status is "delivery" or subtract 5 days if its status is "order" this ...
2
votes
2answers
7k views

Writing Python script in Field Calculator in ArcGIS Desktop?

I'm a programmer, I have programmed in C#, Java, but not with Python. And I'm not a geographic worker. How can I write a python script into Field Calculator to be able to check the other column value. ...
2
votes
0answers
173 views

Advanced Python Field Calculator - QGIS Processing Toolbox

I'm trying a very simple task. I want to write the layer name in a new attribute column. I managed to do this using Field Calculator. But I need to do the same for a lot of files in batch mode, only ...
2
votes
1answer
3k views

How to Get QGIS to calculate Area in Layer's Units?

I have a Polygon Shapefile in a custom CRS which has feet as units. The Qgis Map is also set to the same CRS. When I open the field Calculator, and enter $area, I see that the proper area is ...
2
votes
1answer
3k views

How to compare string fields in the same table with ArcGIS 10

I don't know exactly if there is a tool for this or a maybe a python script could be more suitable. I want to compare string elements from a field (POI_NAME) with another string element in another ...
1
vote
1answer
187 views

How to split string, removing digits keeping letters/words

How to split string (the last digits) in QGIS? new street 25 = new street old street 2 = old street lower 26A = lower lower new street 125 = lower new street Jozefs and Elisabeths new gardens ...
1
vote
1answer
868 views

Python Field Calculating for Document Hyperlink?

I am trying to create a script that will hyperlink to a .tiff or .pdf. These files are stored in one folder on a shared server. I want the script to look in a field: 'PLAT_IMAGE', which has the plat ...
1
vote
1answer
250 views

Calculating centroid latitude in ArcMap throws error 000539 in Arcpy?

I can create a centroid latitude field in ArcMap10.1 using "Calculate Geometry..." in the attribute table, but when I try the same thing using: arcpy.CalculateField_management(bins_WGS84, "cent_lat", ...
1
vote
1answer
286 views

How to write a expression in field calculator for finding $X and $Y?

I'm trying to calculate the lat/long of points using the Q GIS field calculator.Nathan W suggested to First, save the layer as WGS84 and import it again. Then in the field calculator you can use $x or ...
1
vote
1answer
2k views

How to calculate unique IDs starting from highest current ID

I have been using a python script in field calculator in ArcGIS 10.2 to add unique IDs automatically, however there are two things I would like to improve this process: Each ID also has letters at ...
0
votes
1answer
55 views

Field Calculator: Prefixed, padded IDs from a number field

Using the Field Calculator, I want to create prefixed, padded IDs from an existing number field. By "padded", I mean I want the IDs to have a specific number of characters, regardless of how many ...
0
votes
3answers
358 views

Sequential IDs with field calculator: Pad a prefixed field to specific length

I have an ID field that is a text datatype. The IDs in the field have a prefix, and are padded with zeros to always be a specific length. Examples: INSP000098 INSP000099 INSP000100 INSP000101 I ...
10
votes
1answer
18k views

How to perform If Statement in Field Calculator of ArcGIS for Desktop?

I have a shapefile containing two numeric fields ("Dist_1" and "Dist_2"). I want a Field Calculation that will populate an additional field ("Result") with one of three answers: First if Dist_1 is ...
9
votes
1answer
186 views

Documenting custom Python functions in QGIS

How can I document my custom Python functions in QGIS? I would like to offer users help for functions I wrote for them: I've tried adding a docstring: But whenever I click Load an error message is ...
8
votes
2answers
3k views

Capitalizing The First Letter Of Each Word In Attribute Field

Does anyone know of a way to capitalize the first letter of each word in a field in an attribute table? I am doing this in QGIS. I know of field calculations to change all the words to Lower or ...
7
votes
1answer
9k views

Meaning of exclamation mark in Python parser of ArcGIS Field Calculator?

In the following line, I don't understand what those exclamation marks mean? And why put everything in quotation? I don't understand the purpose of the variable expression, please explain to me as I'm ...
6
votes
1answer
10k views

How to copy same values to another field in attribute table in QGIS using field calculator?

I am trying to copy values from Parsel_ID to Parsel_NO using an equation (look at pictures) in field calculator but it is not working. What is the problem and how can I success this task?
6
votes
2answers
2k views

Way to find minimum value from a group of values - QGIS?

I'm wondering if there is a way to find the minimum value of a group within QGIS? Basically I need to find the minimum distance of each unique value in a table of about 5000 records. I can do the ...
5
votes
1answer
111 views

Auto-generated field in ArcSDE for end user

The objective: Create a process where a coworker can open an .MXD, start editing, add a feature to represent a complaint, then add records in a related table to represent an inspection. Along the way, ...
5
votes
2answers
625 views

Using field calculator to delete specific contours

I have 3 contour shapefiles with 25m, 50m and 100m equidistance. Now I want to delete in the 25m-shp-file every **50m and **00m contour and in the 50m-shp-file every **00 contour. How can I show them ...
5
votes
4answers
3k views

Why do area calculations return negative values?

I have created a shapefile with some polygons and am now trying to calculate the area of these polygons. The original CRS was WGS84, I have reprojected it to WGS 84 / World Mercator so unit is metres. ...
5
votes
1answer
2k views

Is it possible to increase Output Field Name length beyond 10 characters?

When creating a new Column, the default value for the length of the name is 10. Using the Field Calculator via the Model Builder, I want to include the names of regional areas into the columns which ...
5
votes
1answer
5k views

Recording frequency of names in the attribute table?

I have a question with ArcGIS 9.2. In an attribute table the column [name] includes the name of every place in this layer. Next to that (in columns [numbers]) there should be recorded how often a ...
4
votes
2answers
123 views

Can ArcGIS geoprocessing tools be used in ArcGIS Field calculator?

Can you put ArcGIS geoprocessing tools such as arcpy.SelectLayerByLocation_management() or arcpy.MakeFeatureLayer_management() into the code block of the ArcGIS Field-calculator (ArcGIS Desktop 10.4)?
4
votes
4answers
6k views

How to insert a quotation mark through the Field Calculator of attribute table of a Shapefile?

I have a shapefile of polylines with information of diameter. But the problem is that i didn't enter the inch sign(") with the values of diameter. What would be the solution that qutation mark would ...
4
votes
2answers
936 views

Extracting only number from address in QGIS Attribute Table

I want to print only the number part of the address field. I tried to use the "field calculator" with "regexp_substr" to extract just the number (only string before the first space) but couldn't ...
4
votes
2answers
136 views

Giving polygons classificaton code in ArcGIS Desktop?

Does anyone have a trick for assigning polygons a code based on the classification classes? For example, if I symbolize the population of census blocks with 10 classes using Natural Breaks, I would ...
4
votes
1answer
7k views

Field Calculator VB Script Codeblock IF statement syntax is wrong?

I can't figure out why the syntax is wrong in Field Calculator ArcMap 10. The complete codeblock is Dim CapitalDia As Number Dim TwagDia As Number Dim X As Number CapitalDia = [New_Pipe_S] TwagDia =...
4
votes
3answers
1k views

ArcGIS Field Calculator Python numbering rows of fishnet

I have a grid of 100*100 cells. I want to add to each cell a number representing the row it is in (like in excel). I added a field and want try to solve that with field calculator: The code is ...
4
votes
1answer
4k views

Find and Replace expression needed in Field Calculator ArcGIS 10

Looking for the Field Calculator code (Python preferred) to replace the last numeral values in a field using another field's values for entire attribute table. Please see screen shot here:
4
votes
1answer
100 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 ...
3
votes
2answers
433 views

Using ArcGIS Desktop field calculator (python) to parse date

I'm trying to parse a datetime field using python (but have never used python for it before). I have a field that contains a valid date, but not a valid time... and other fields that have valid hour ...
3
votes
1answer
529 views

Measuring world-wide distances in QGIS

My guess is that I'm doing something wrong with QGIS, but here goes. I have multiple point data layers in WGS84, mostly of UK locations, but with point in Canada, South Africa and New Zealand. I also ...
3
votes
1answer
177 views

Weighted values of field in QGIS

In QGIS in the Attribute Table, I have 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, ...
3
votes
1answer
2k views

calculate value using maximum value from different feature class

I'm trying to get the maximum numeric value from one feature class and use that value in an expression to calculate values of a different feature class. fc2.bldg_id = max(fc1.bldg_id)+1 Can this ...
3
votes
1answer
12k views

How to search text string and select item in QGIS?

I have a table attribute with complete roads name. I have to search items by digiting a part of the road name and I need to colour all the items selected. eg: ROAD NAME: / road 01 / road 02 / road 11 ...
3
votes
2answers
3k views

Inserting %20 instead of a space as a string

I have 600 records that I need to be linked on a website. As clickable urls. But when I have the URL's, they only link to the 1st set of text before a space. So is there a code in QGIS that I can ...
3
votes
1answer
867 views

Python Max Function in Field Calculator for Date values

I have 4 fields with Date Time values, and created a new field (Date type as well) which takes the most recent date from these 4 fields. I have tried using the Max python in the field calculator to ...
3
votes
1answer
4k views

How to sum up multiple columns values into one single column

I have one table containing many columns. Using field calculator, I want to create a new column containing (for each line) the sum of all columns values. Pretty dumb, but just cannot find the correct ...
3
votes
1answer
162 views

Referring to Null value with ArcPy Expressions?

How do I refer to Null values in a field using an expression in Python? I've tried using the following as well as = None and =Null but nothing has worked yet: ScoreCondition = "Cond_Score(!"+...
3
votes
1answer
446 views

Using QGIS Field Calculator to replace backslash?

I actually use the Field Calculator "replace" formula that works very well but I have some '\' caracters in my field that I cannot replace. ex : '\naninana' and I want to keep only 'naninana'.