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
2
votes
2answers
1k views

Cannot convert string to int using ArcPy Calculate Field?

When I load a csv file to join with ArcPy, it converts all string fields that are numeric to integers. Therefore, I have to add another field within the feature class that I'm using for joining that ...
2
votes
1answer
2k views

Splitting field with comma as separator into two fields in QGIS

How to split a "Field" into "Field 1" and "Field 2" when the comma is a separator in the field? I am using Field Calculator in QGIS.
2
votes
1answer
172 views

Changing a string of text in QGIS

I have some text in a column in QGIS, I am using field calculator, I need to replace it with some other text. This is what I have so far: replace("url", 'Y:\Natural Environment Record\', 'http://...
2
votes
1answer
2k views

Calculating centroids of polygon using ArcPy?

I am trying to calculate the centroids of a polygon and add the x- and y-coordinate to their respective fields: arcpy.env.workspace = r"C:/..." input_fc = "shapefiles/precincts_v.shp" arcpy....
2
votes
3answers
527 views

Use field calculator to change values from a,b,c etc. to 1,2,3 etc.?

I have a vector shapefile with a column with string values. How can I convert this to a column of integer values in another column but keep the categorization. e.g. from: col1,newcol2 A, A, B, A, C, ...
2
votes
1answer
899 views

Concatenating string with space

I am adding a number of strings together to create a linestring but as such I need spaces between the initial XY values and the end XY values, plus a comma in between the two halves. Should result in ...
1
vote
3answers
232 views

If/Then Field Calculator Return Calculations

After collecting GPS location for road culverts I would like to calculate the $ values for each culvert based on their diameter and length in ArcMap. Existing number fields in the attribute table are ...
1
vote
1answer
85 views

Using python to convert string values with Calculate Field in ModelBuilder?

In ArcGIS 10.5, I am building a model that should convert a field of coded values to another code. This seems like it should be a simple if/then statement but I am not getting it. To simplify the ...
1
vote
1answer
650 views

Field Calculator If/Then in ArcGis 10.1

I've been looking through these threads, i found something similar and thought it could be the answer, but it doen't seem to work for me... I could do this the slow way with Select By Attributes, but ...
0
votes
2answers
1k views

How calculate sequential values based on group field?

In field calculator i calculate sequential values in field [ORDER_ID] What need change in script to calculate sequential values based on group field [GROUP_ID]. I select values manually and use ...
0
votes
1answer
3k views

Splitting field in ArcGIS field calculator using Python Parser?

I'm using field calculator in ArcGIS Desktop 10.2.1. I have field1 which has a values of "A_B" (example). I created two fields out of this, values to the left of the underscore go in fielda and to ...
0
votes
2answers
990 views

area values determined with field calculator become null when saving

using field calculator in Qgis 1.8.0 to get the area, it shows just right at first but when I save it, the values become Null.
-2
votes
2answers
358 views

Writing python script to group and sum records from each group? [closed]

I am doing hydrology analysis in ArcMap 10.2 and have a drainage area feature class containing hundreds of records. Each record is assigned a drainage area name and acreage amount. How do I sum all ...
12
votes
1answer
13k views

Syntax of conditional statements in QGIS Field Calculator(s)

I have a shapefile which I need to modify. There is one column "CLASS" with the attributes: "A", "B" and "C". I need to change "A" into "1", "B" into "2" and "C" into "3". I tried it with case when ...
5
votes
1answer
7k views

How to make autoIncrement number start with (001…009, 011…099)?

i have a challenge with my time in my work, i have feature class called "Parcel" storing many data, i generated an autoIncrement number by using field calculator, in field "parcel code" Expression: ...
10
votes
1answer
1k views

Obtaining specific part of string from field in QGIS attribute table?

I'm having a bit of trouble here with this situation. I want "NumeroCamp" only to have the numbers are showing in "Text". Is there any function in field calculator that could help me with that?
9
votes
3answers
3k views

How to convert a string field to a date field

I have a layer with points which represent the fatal road accidents and the field "dates_14_D" contains their date but its type is string. I would like to convert this string field to date field but ...
7
votes
3answers
3k views

Calculating field in which null values may be present?

I would like to calculate a field (short integer) using other fields (short integer) present in the table. In some cases these fields may have null values for one or more of the fields. For example, ...
6
votes
1answer
427 views

Adding field to table using QGIS graphic modeler?

I was wondering if anyone could help as I'm struggling to get anything out of the QGIS graphic modeler. I need to be able to add a new field to an attribute table and update that field with a value ...
6
votes
2answers
2k views

How to delete last part of a string starting from the 1st non numeric character? [closed]

I'm looking for a Python or VB statement to remove the last part of a string, starting where the 1st non Numeric character appears, using the Field Calculator in ArcMap 10. Here's an example of what I'...
3
votes
3answers
912 views

Using field calculator in QGIS to return name of country from different shapefile?

I have a shapefile that consists of a list of archaeological sites with the x and y coordinates. I have an Natural Earth shapefile for the countries of world. I was wondering how I go about ...
3
votes
1answer
1k views

How can I refer to a model variable in a Field Calculator or Pyculator formula?

I am new to QGIS 2.0.1 Modeler (Sextante) and not very able in Python programming. My question regard the use of field calculator (or advanced python field calculator) inside the modeler. Is it ...
3
votes
5answers
23k views

VBScript - If/Then Statement - Field Calculator

I am trying to do a simple (or so I thought) if/then statement in the ArcGIS field calculator. I am trying to add the HydroCode field - hydologic soil codes - to an existing data set. I know what the ...
3
votes
2answers
108 views

QGIS how to sum a certain vector field inside a polygon and populate a field in the polygon?

I have a polygon with vector point civic addresses inside it. Each civic address has a different number residence. I want to sum the total number of residence inside that polygon and it populate a ...
3
votes
2answers
317 views

Problem using field calculator to add numbers in new field with preceding zeros

I wish to add a field in an attribute table that should work as a georeferencing key. It needs to take into consideration values from a series of fields. The last field is a housenumber and it ...
3
votes
2answers
811 views

How to split string (the last digits) in QGIS?

I´m working with QGIS 2.12. Is it posible to split string "from the right side" (it means I needed the last text from every field)? In one field I have description like: new street 25 old street 2 ...
2
votes
2answers
920 views

Update multiple fields/columns in QGIS

I need to update fields in attribute table of a vector using QGIS. I use field calculator for each field, but i have too many fields (and too many vectors also) and i need to program the task. The ...
0
votes
3answers
6k views

ArcGIS Python Script, Calculate Field

I am trying to write a Python Script for ArcGIS 10.2. #import system modules import arcpy import math from arcpy import env #Set environment options env.workspace="C:/Users/el/ac/script1" # ...
16
votes
3answers
28k views

Rounding column in attribute table using ArcGIS Field Calculator?

I want to use the Field Calculator in ArcMap to round an existing column to two decimals. Currently I have a column that is 6 decimal places long and would like to simply round it down to 2 decimals. ...
9
votes
4answers
7k views

Removing numeric characters from alphanumeric value in field calculation?

I have a field containing alphanumeric values in the following format: A-AA00 Sometimes they are also A-AAA0 I need a Python script I can put in the field calculator in ArcMap 10 that will at ...
9
votes
4answers
463 views

Saving Equations used in QGIS Field Calculator?

Im trying to calculate certain values of a newly calculated point. So I use the field calculator to write an equation to determine the values. Is there a way to save that equation, so that if and ...
7
votes
4answers
972 views

Parsing serial date in ArcGIS Desktop?

I have imported a shapefile that contains a serial date number that looks like this: 41256.260799. I would like to create a new field that shows only the hour and second like this: 06:33. I've tried ...
5
votes
4answers
2k views

How do I fill in serial letters (AA, AB,AC…,BA,BB,BC…ZZ) to a shape?

(I am using ArcGIS software, ArcMap...) MY PROBLEM I have a shape file containing points. The shape file contains 3 columns named FID, Shape* and Label. In the column I want to fill in AA, AB, AC...,...
5
votes
1answer
3k views

Adding hyphen in ArcGIS Field Calculator to merge two columns?

I am trying to build a field calculator expression to merge two columns into one. I am looking for the word that makes it a range. Example: I have 2 columns in elevation, From and To. I want to ...
5
votes
2answers
5k views

Field Calculator does not notice selection? [closed]

I have a problem with the Field Calculator in ArcGIS 10. I selected specific points of a Shapefile I want to calculate, but FC is always calculating all fields. Unfortunately there is no checkbox in ...
5
votes
1answer
2k views

Calculate population coverage?

I am relatively new to QGIS. I am looking at the percentage of an population that has geographical access to healthcare. Therefore I have one shapefile with village boundaries including population ...
5
votes
2answers
7k views

using mod() with IF THEN field calculation

I am trying to use the field calculator to assign a "odd" or "even" value to a field of small integers. I usually do this with by selecting where: MOD([field],2) = 0 and then just calculating it as ...
5
votes
1answer
834 views

Using Field Calculator to assign values to only Odd (or Even) page fields for Data Driven Pages?

I am creating a map book but do not want the page numbers for each map page to be on the same side (since its printed double sided), I need the page numbers to be placed on opposite sides. I am ...
4
votes
1answer
551 views

How to calculate the intersected area from a layer with overlapping buffers in QGIS

I need to calculate the area of landusetypes in 50m around various dots (all in one shapefile). My problem is, the buffers around the dots are overlapping each over in some places. I tried to ...
4
votes
1answer
521 views

Using ArcGIS Field Calculator to populate number field from text field?

I'm trying to assign speed values to street types using TIGER street shapefiles. So I created the new field for the speed, and I was going to use the field calculator to take the MTFCC classifications ...
4
votes
1answer
253 views

Graphical modeler in QGIS 3.0.3 - Access Vector Field in Calculator

I want to create an algorithm with the graphical modeler in QGIS 3.0.3 where i define one Vector Layer and a Vector Field from this Layer as my inputvariables. Then i want to access the field-values ...
4
votes
1answer
12k views

Deleting first two letters from string field usimng Python Parser of ArcGIS Field Calculator?

I'm looking for a field calculator Python statement to delete only the first two letters of string entries. For Ex: !Name!.strip([0:2]) I know this syntax is incorrect.
4
votes
1answer
2k views

How to use the field calculator's centroid() Geometry function in qgis 2.0?

There is an option in the field calculator for centroids under geometry which when you double click gives you "centroid( ". What information is required here in order to use this function?
4
votes
2answers
2k views

Writing If-Then Statement in ArcGIS Field Calculator using Python Parser?

Scenario: I have four fields: A, B, C and D Field A is text-based and contains values from '000' up to some number 'xxx' Field B contains a set of values (also text, but represented by numbers) ...
3
votes
2answers
3k views

How to calculate azimuth in QGIS field calculator?

Is there any way to calculate the azimuth of two points in the QGIS field calculator? The coordinates are stored in an attribute table. x1 | y1 | x2 | y2
3
votes
1answer
660 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 ...
3
votes
2answers
232 views

Summarizing Fields based on content in QGIS?

already read many answers for similar questions, but i didnt find a solution for my problem. Dont know how to start. Problem: shp with about 50 fields. Each field contain NULL, 1 or 2. Now i need ...
3
votes
2answers
898 views

Calculate Field - getting the code value but not the description

If STREETNM value are blank or _ then I want to replace them with the value of ST_DESIG. My code below returned the code value of ST_DESIG but not the description. How can I get the description ...
3
votes
1answer
190 views

QGIS Field Pyculator Reclass

I'm new to the QGIS Pyculator and need to reclass a field ('AP') based on another field ('Mag'). What I have so far, from the ArcGIS field calculator: def Reclass(Mag,AP): if Mag>= 2000: ...
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 ...