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
0
votes
1answer
29 views

Calculating values in field to round up to 1 if value is greater than 0 using ArcGIS Field Calculator?

I am prepping vector data for raster conversion and analysis. In order to prep the data I need to have a field that represents data/no data (1/0). I built a model that outputs the necessary features ...
0
votes
1answer
29 views

Using field calculator in ModelBuilder?

I'm creating a model in ModelBuilder to calculate vehicle emissions at road level that have multiple geoprocesses. I have a database (.dbf) of pollutant emissions (CO, VOCs, etc.) from vehicle ...
-1
votes
1answer
45 views

What does if-else code do?

I just started a new job and in one of the procedures I was given for one of my tasks I found this piece of code. It just adds a comment to a field that's already filled up. For instance, field1 might ...
1
vote
0answers
27 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: ...
2
votes
1answer
48 views

QGIS Measure Distance Using Field Calculator

I have a point shapefile with 80K+ records. Shapefile is projected in wgs84. The shapefile contains fields with the latitude and longitude of the point. I need a new field that contains a distance ...
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
1answer
35 views

Adding $length on the fly when adding line feature

is there a simple way (without writing script or python skills) to auto calculate and auto populate length attribute in QGIS? When I add a new line feature in my layer, I'd like the attribute length ...
1
vote
2answers
51 views

Filling attribute tables with values from the same attribute table

Just wondering if there's an easy way to fill null values in one column in an attribute table with values in another column of the same attribute table by just writing a query "just the "null values" ...
2
votes
2answers
42 views

Finding and replacing with if then else statement in field calculator of ArcGIS Pro?

I have a column of strings that always start with the first two characters being numbers, like 39 or 07, etc. In a new column I want to process the original column so that I replace any of those ...
3
votes
1answer
61 views

Counting layer segments in QGIS Field Calculator

I have a segmented line (road) dataset and I want to get the number of times each road is segmented. In SQL it's just SELECT RoadMntnc, count(RoadMntnc) AS count FROM clip_DSC_Roads GROUP BY ...
0
votes
0answers
33 views

Adding minimum point Z of polygon using ArcGIS Field Calculator?

In the middle of a ModelBuilder tool I created, I have a Z enabled feature with multiple polygons. I want to add on a specific field of this feature, the lowest Z value of each polygon. I know this ...
1
vote
2answers
58 views

Calculating frequency in Field Calculator

I have a table with many instances of duplicate values. My end goal is to have three columns: "The Value": a file name. most are non-unique "Duplicate Instance": "this is the 1st time this file name ...
1
vote
2answers
47 views

Regex to get unique values in field using QGIS field calculator

I need to get the unique values from a field. (?<=,|^)([^,]*)(,\1)+(?=,|$) Works in an online test but I get invalid expression in QGIS Field Calculator. How can I rewrite this in QGIS Regex ...
1
vote
1answer
32 views

QGIS 3 Graphical Modeler field calculator with attribute's parameters

I want to make a model with a vector layer to calculate the sum of two parameters contained in the attribute table of the layer. I want to create two variables in the model, the name of the two ...
1
vote
1answer
33 views

Extracting 2 groups of numbers from string in QGIS Field Calculator?

I have an attribute field that contains strings like "iuyluf45567kjyyr347fklj". All strings contain various amount of characters and digits (there is no clear pattern) but each string contains 2 ...
2
votes
1answer
63 views

Difference between $x and x($geometry) [closed]

I just stumbled across something weird: I had point-data in EPSG:3059 and wanted to add the coordinates to the attribute table using $x resp. $y - which returned NULL. x($geometry) on the other hand ...
1
vote
0answers
22 views

Getting less calculated area after merging/dissolving polygons [closed]

After I merge/dissolve polygons together, the area I calculated using the field calculator seems to decrease, in comparison to the calculation of each individual area and then summing it up. Can ...
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 ...
3
votes
1answer
46 views

Change data format in QGIS field calculator using format_date

I´d like to change the data format in the attribute table from yyyy-MM-dd (default) to dd.MM.yy using the format_date function in the field calculator. Using: format_date(date, 'dd.MM.yy') I got ...
4
votes
1answer
45 views

Evaluate string in field calculator QGIS

Is there any way to evaluate a string as an expression in QGIS. For example, I want to evaluate the string in Column 'hukg' as an expression.
3
votes
1answer
43 views

Coalesce field “X” if field “Y” is a duplicate

(QGIS 3.4) The image below will help explain my goal: I'm working out how to coalesce the attributes of the field "ID" if the field "X, Y" is a duplicate. I have highlighted some duplicate ...
2
votes
1answer
37 views

Keeping only 7 digit number within field name using ArcGIS Pro field calculator and regex

I have a field titled GEOGRAPHY, which contains hundreds of records containing various strings of all similar format, for example: "Witless Bay (1001559) T 00000 ( 6.5%)" "Laniel (2485905) NO ...
5
votes
1answer
106 views

Counting number of features within another feature using aggregating function in field calculator of QGIS?

My data: 1 polygon layer + 1 point layer My target: Calculate the number of points and the sum of a field within each polygon using the aggregate function in the QGIS field calculator. I know I can ...
2
votes
1answer
43 views

Sum the area of buildings inside a block (QGIS) [duplicate]

My problem is to get the sum of the area of all buildings inside a block. There are a layer with the buildings (they contain an block_id to which block they belong and the area) and a layer with all ...
4
votes
2answers
67 views

Adjusting condition in field calculator in QGIS [duplicate]

I need to calculate a score based on an area field using these ranges: if >= 30000 (square meters) then 4 (score) if < 30000 AND >= 10000 then 3 if < 10000 AND >= 5000 then 1 if &...
0
votes
1answer
26 views

Pulling date from filename and in proper format for time enabled use?

My feature attribute table has a folderpath that indludes a date time. Example:/documents/foldername/xyz2015OCT15063333.shp It seems very simple, but I am not a programmer and have done my best to ...
1
vote
2answers
44 views

Creating array of z-values from line vertices in QGIS field calculator?

I would like to create an array of a line's z-values to use as part of another expression. The z-values should be in the same order as the vertices, I would like to be able to use it as an input for ...
0
votes
1answer
38 views

Using ArcGIS Field Calculator?

I have a large shapefile with 2,5 million points and I would like to create a new field in the attribute table that groups the features into groups of 65000 features. In other words: Select the first ...
1
vote
1answer
72 views

Getting value from another table with dbquery

I am trying to use dbquery to get a value from a table when a record in it is the same as a value in the source table. In the table where I need the value-added (Sewerage_Manholes...) I am trying ...
1
vote
1answer
30 views

Selecting by attributes which have alphabet data using ArcGIS Field Calculator? [closed]

I only want to select values that are entirely alphabetic characters. Select by attributes which I have alphabet data. SELECT ONLY RED INDICATED VALUES
0
votes
2answers
42 views

Calculate time duration from military time with ArcMap Field Calculator [closed]

I have two text fields (STRTTIME, ENDTIME) which are are formatted as military time with leading zeros. For example, 0540, 1655. I want to calculate a new field with the time duration as integers (...
1
vote
1answer
42 views

Row_number with create virtual field in QGIS

How can using @row_number option or similar together the command "Create virtual field". It works very well with "Create new field", but doens't work with "Create virtual field".
3
votes
2answers
91 views

Cleaning up layer by deleting features with only one overlapping vertex in QGIS

After applying r.thin and then r.to.vect to a raster image the resulting vector layer contains hundreds of small "branches" that are not supposed to be there: I've tried selecting and deleting these ...
2
votes
1answer
50 views

Using If statements to conditionally populate a field in Field Calculator

I'm trying to use the field calculator to poplulate a string field in a table based on info in another string field. This is what I have: def Reclass(Correction_Comments): if (MSAGSTREETNAME) = '...
0
votes
2answers
50 views

Passing string field value to another field in same Feature Class using ArcPy?

All the literature I have read suggests that to pass a string value to a another field in a feature class via ArcPy you need to do the following. I am running it in ArcMap 10.6. arcpy....
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
3answers
65 views

Calculating areas of world map in QGIS?

I have a dataset with polygons of administrative areas for the whole world (https://www.gadm.org/download_world.html). I want to have the area size of each polygon in square kilometers. I saved the ...
0
votes
2answers
29 views

Counting string in cells? [closed]

How can I count strings? I would like to know how many words (strings) I have in each cell. So I know that somewhere is too many words. Len() function calculates individual string character (including ...
1
vote
2answers
164 views

Using Python Parser in ArcGIS Pro Field Calculator?

I am having a problem in migrating from Vbscript to Python for ArcGIS Pro. Building 5, Street 6 What is wrong in this expression? "{}:{}:{}:{}:{}:{}".format("Building ",!Building_Number!," , ",!...
0
votes
1answer
31 views

Simplifying a long if condition statement and adding status report?

def Assign(csdname, cdname, ccsname, zone): if csdname == "Oshawa" or csdname == "Whitby": return "70" elif csdname == "Toronto": return "71a" elif csdname == "Mississauga" or csdname == "...
2
votes
2answers
42 views

Conversion from number field to text field

I have a field "folio" formatted as a number with decimal. I added a new string field "folio_1" and using field calculator to populate it with the value of "folio". The problem is that the new field ...
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 ...
2
votes
1answer
37 views

Conditional statement in PyQGIS field calculator

I am trying to perform a if/elif/else routine in the field calculator environment from PyQGIS (i.e. coding in Python). My code is the following, however I keep getting indentation errors. The field ...
1
vote
0answers
35 views

Field calculator returning ERROR 000989? [closed]

I'm trying to split a field of street addresses (field name "PROP_STREE") so that it returns only the house number (so "123 Main St" would become "123"). Following the solution provided Field ...
1
vote
1answer
25 views

How to enter text into attribute tables with QGIS graphical model?

I am using QGIS 2.14 to open NC files for chlorophyll satellite data with the end goal of compiling chlorophyll values for many dates (each its own initial file) in a spreadsheet. I know how to do the ...
3
votes
2answers
170 views

Creating dummy variables between layers based on their geometries in QGIS

I have the following data: administrative boundaries for the United States: https://biogeo.ucdavis.edu/data/gadm3.6/shp/gadm36_USA_shp.zip vector layer containing coastlineshttps://www....
2
votes
1answer
50 views

Why is my default value stil NULL even when i have made an expression for the Default Value?

I seem to have a problem with the default value in one of my colums by the calculator expression. I have two specific columns that have widget input one being tekst value and the other being numbers ...
3
votes
2answers
132 views

Doing COUNTIFS equivalent in ArcGIS Field Calculator?

I have an attribute table with location data for a series of individual animals. They are often found at the same locations, so I have created a column in my attribute table where I list the rock ID. ...
1
vote
1answer
34 views

Accessing fields info from code block using Python Parser of Calculate Field in script?

I need to codify a field with other fields information I have this code running into a script: # Process: Calculate Field (12) arcpy.CalculateField_management(RedHID_Layer, "TIPOcorr", "...
-1
votes
1answer
26 views

Auto incrementing start form the second row and every second row in ArcGIS Desktop? [closed]

Subsequent to Auto incrementing every second row in ArcGIS Desktop? , how can i start the auto increment from the second field (i work with 150 fields) so the result will be: