Questions tagged [field-calculator]

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

76 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
174 views

Minidump in C when executing Python script

I have written a python script which should calculate the azimuth for a line (with two given points). But every time I run the script, I am getting the following error message: If I click OK, QGIS ...
4
votes
0answers
565 views

How to calculate percentages using QGIS field calculator expression?

I am new to QGIS. I am wanting to calculate a field using other fields and some operators. Here is my expression: case When "RVM_CAT" = 'B' OR "RVM_CAT" = 'C' Then ("PC1" /100) * "RE_ha" When "...
3
votes
0answers
269 views

Wrong length values on QGIS 3.0.3 and 3.2

While using QGIS 3.x today I noticed that length values were not calculated and measured correctly on EPSG:32611. Calculating and measuring the same data on QGIS 2.18 latest LTR and 2.2 on EPSG:32611 ...
3
votes
0answers
55 views

Where does qgis store calculated field from field calculator?

When adding a (computed) field for a PostGIS table, where is the new field stored? I thought it would be with the original table, but it does not seem to be the case for QGIS 3.0.1/3.0.2 (Ubuntu 16.0....
3
votes
0answers
108 views

Calculate a river system with the field calculator in QGIS

I would like to create a river system with water flow based on the following attribute table: The river system is divided in different segments (the ID to every Segment is called "SegmentNo"). The ...
3
votes
0answers
181 views

Translating ArcGIS field calculator python expressions in to QGIS field calculator python expression?

I'm transitioning to QGIS from ArcGIS. I'm having trouble getting my python field calculator expressions to work in the QGIS advanced python field calculator. Here is a screenshot of the working ...
3
votes
0answers
292 views

Using Field Calculator to Convert Data Type In Field

I am trying to convert a field that is listed as "String" because it was imported into QGIS as a CSV (rural poverty population percentages by county in NC). I need to convert the percentages field ...
2
votes
0answers
35 views

Auto populating attribute table with lat and lon in QGIS

is there a simple way (without writing script or Python skills) to auto calculate and auto populate lat and lon attributes in QGIS? When I manually add new points or move existing points in my layer,...
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
0answers
79 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 @...
2
votes
1answer
306 views

Vector Fields as Input Variable in Field Calculator

I’m working with QGIS 3.2 Bonn and I try to build a workflow in the graphic modeler. The model aims to build variable buffers depending on values from two attribute fields of an input vector layer. ...
2
votes
0answers
38 views

Shape Count vs. Record Count Mismatch

First of all, I really could not think of a good title for this question, so feel free to modify it. I keep encountering an error using ArcMap 10.5.1. I'll have a table open, to which I add a field. ...
2
votes
0answers
37 views

How to assign symbology in shapefile A based on data in shapefile B - QGIS 3.0.2

I have two shapefiles: "States" - contains polygons for the 50 US states, and "Widget_stores" - contains points where widget stores are located. I want to adjust the symbology of "States" to change ...
2
votes
0answers
32 views

Derived field dropped from layer after restarting session in QGIS

This is a question about QGIS: I am working locally (no connection to servers or databases) with some maps data which I have imported as a non-visible CSV layer. These were merged against some census ...
2
votes
0answers
236 views

Automatically fill table with Geographic coordinates if shapefile is in UTM?

I have a shapefile of points in Qgis 2.18. I created the points by direct click on a map, using the digitizing tool. Now I need to fill the 2 columns "Lat" and "Long" in the attribute table with ...
2
votes
0answers
593 views

Converting UTM to Lat Long inside a Game Engine(Untiy 3d)

This is my first post on Stack Exchange. I have exhausted my research through the game engine forums, so I am trying this forum since you guys seem to be the experts. I have an external device that ...
2
votes
0answers
195 views

How to add column to attribute table using field calculator with $length function?

I used the following code to add a separate column to the attribute table with the length of features. from PyQt4.QtCore import QVariant from qgis.core import QgsField, QgsExpression, QgsFeature vl....
1
vote
0answers
28 views

QGIS: Update geometry via geom_from_wkt('POINT(X,Y)') - how to correctly parse string columns?

The columns containing X and Y strings look like -1234,56 So far i tried: geom_from_wkt(concat('POINT(',replace("wbr_komplett.X",',','.'),',', replace("wbr_komplett.Y" ,',','.'),' )')) and also: ...
1
vote
0answers
23 views

Reclassifying string variable in ArcGIS Field Calculator with Python Parser?

I am trying to calculate a roadway pedestrian restriction based on its functional class, using if/else logic in Python. Every time I enter this, it only turns up 'No'. The categories are strings, and ...
1
vote
0answers
40 views

QGIS 3 - Set width of line by attribute

I have a line-layer and want to style the line by using a data-table with no geography - I am using GeoPackage. With other words, how can i get a field-value (i have two fields for filtering the ...
1
vote
1answer
11 views

ArcMap: Combining County Polygons for 3 separate states into one layer with attributes

I have 3 separate layers with the counties for 3 separate states: WA, OR, & ID. I want to combine them into one layer "Counties" so they all share an attribute table with the same fields. I am ...
1
vote
0answers
85 views

Getting error message in QGIS field calculator?

I have used an equation within the field calculator, that has previously worked in an older version of QGIS, I am currently using QGIS 3.6.2 the equation being: (atan((xat(-1)-xat(0))/(yat(-1)-yat(0))...
1
vote
0answers
48 views

Reprojection puzzle

Initially, my question was about strange results in area calculations in QGIS. I got bigger results for planimetric calculations - using area($geometry) - compared to ellipsoidal calculations - using $...
1
vote
2answers
337 views

Getting QGIS processing script field calculator error?

I have a processing script that I created for QGIS 3.4.5 but I keep getting the following error: Traceback (most recent call last): File "", line 66, in processAlgorithm File "C:/PROGRA~1/QGIS3~...
1
vote
0answers
49 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
89 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 ...
1
vote
0answers
145 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 ...
1
vote
0answers
37 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
0answers
27 views

How to find frequency of a field based on another attribute?

I'm working in ArcMap. I have a list of people and the states that they live in. Small Example: I want to know what is the most common name in each state. I thought I would use the frequency tool ...
1
vote
0answers
169 views

Auto-Refresh Field that has been Calculated with Python in ArcGIS Pro

Is there a way to get a calculated field to auto-refresh? For example, I have an expiration date field with dates filled in. I have another field that I will use to show the number of days left till ...
1
vote
0answers
17 views

When pressing field calculator icon Ubuntu log out!

I'm having a weird issue, as said in the title when I press the field calculator button the operative system log out. Anyone as experienced this issue? I'm running qgis 2.18 on ubuntu 16.04
1
vote
0answers
101 views

Showing cumulative load by road segment using QGIS?

The picture shows the forest roads where wood transport is carried out by trucks. From polygons, logs (wood) are collected near roads and then transported. How do I show or sum cumulatively ...
1
vote
0answers
66 views

QGIS Field Sequential Numbering with ordering rule from SW to NE

How could I use the $Rownum tool to get sequential number for a field to make sure the southernmost and westernmost point is 1 and the following numbers follow this rule set (where South is first and ...
1
vote
0answers
78 views

Creating in-line variable is possible in field calculator of QGIS 2?

I create new field based on other fields. For example; if "Field_A" is smaller than "Field_B", value of new field is 'A', otherwise it is 'B'. So I want to create new variable for this case within ...
1
vote
0answers
66 views

Calculate a Field in Model Builder in ArcGIS when the field name the calculation is based on is dynamic

I am essentially trying to do what is listed in this question: Renaming field via ModelBuilder? So I am trying to use the Add field > Calculate Field > Delete Field method listed but the problem is ...
1
vote
0answers
68 views

Layer length statistics in print composer QGIS

In a QGIS composer, I would like to add a text label with the calculation of % of length of the total layer with a specific feature value. My layer is composed of roads lines and I would like to ...
1
vote
0answers
55 views

Using python parser of ArcGIS field calculator to calculate field using information from subsequent row?

When using the field calculator, how do I get data from the subsequent row in python? Let's say I want to add a new field called head_diff. I want to take the current row's value for head, minus ...
1
vote
0answers
120 views

Converting @layer_name tokens into Shapefile Attributes (Columns/Rows) using QGIS Expression Editor?

I'm a fairly novice Python user and I've been banging my head against this problem for a number of days now. Assumptions I've made: This is doable within QGIS, and does not need to be done ...
1
vote
0answers
26 views

Table join erases previous field calculations

I have issues with a normal join of two layers. The first set consists of a large list (n=259102) and I need to pick out 56 objects from this list. For that I have a second list with the 56 object IDs ...
1
vote
0answers
159 views

creating new fields and populating with sequential numbers based on grouping other columns

(Relatively new Qqis user) I have a vector layer (lines) for a road network - which has a field for each road name and a field for road segments - but I need to add fields for numeric IDs rather ...
1
vote
0answers
70 views

Calculate fields referring to other layer?

I have to analyze different pathway segments based on a few variables: Number of properties crossed (polygons) Length of paths on public land (polygons) Number of intersection with stream (lines) ...
1
vote
0answers
40 views

Calculating Values from Various Files

I am trying to calculate the value of a number of attribute tables as shown below (Using the graphic modeler). In the first image, I outline the process whereby I have three polygons and a point ...
1
vote
0answers
58 views

Select points by continuous numbers

I have GPS points driven over the same road back and forth then clipped to a section of that road. My points are overlapping and need to identify the points going one way or one run down the road in ...
1
vote
0answers
151 views

QGIS referring to a features length with python in function editor

I tried to modify the code given in https://gis.stackexchange.com/a/212762/7849 so the value from [field_name] would be divided by the length of the feature. I tried to change the last line in ...
1
vote
0answers
426 views

Natural Breaks (Jenks) classes as a new column values

I have .shp layer with column Length In Layer Properties it's possible to display Layer with natural breaks (Jenks) classification. It's shown below: Based on that classification I'd like to ...
1
vote
0answers
173 views

Is QGIS unable to modify layers from a .gdb?

There is a .gdb file with several census tables I downloaded from TIGER. I am trying to join one of the tables to a shapefile but am not able to as the join field for the table contains excess ...
1
vote
0answers
64 views

Grid interpolation using a new calculated field

Still learning.... I am trying to run the grid interpolation tool on a point shp file. I can successfully use the tool with the existing data but cannot run the tool on a new field I created in the ...
1
vote
0answers
188 views

Using timestamp field to auto complete source field in QGIS?

I am trying to use my timestamp field to autocomplete my source field in QGIS using the field calculator. I want my source field to be completed with a saved string e.g "Sam_Sam". I want my source ...
1
vote
0answers
71 views

Using ModelBuilder or Python parser of Field Calculator to check values between two datasets?

I have a *.dbf that I need to check values against for a shapefile. I need to report whether the values match the dbf in the shapefile and, if not, what the value should have been (in two new fields)...
1
vote
0answers
198 views

Problems with rasterization through QGIS Modeler

My goal is to rasterize a vector polygon-based shapefile. Whenever I run in the modeler or even from the Processing Toolbox the Rasterize tool of GDAL, I receive a raster layer that's not good for me,...