Questions tagged [python-parser]
For questions about ArcGIS Python Parser for labelling expressions and field calculations
676
questions
7
votes
3
answers
7k
views
Calculating Field based on name of shapefile
I have multiple shapefiles to which I have added a field called "gname1". For each shapefile, I want "gname1" to be set to the name of that particular shapefile, for every feature within the shapefile....
1
vote
1
answer
555
views
Why does Python if/else statement only return else condition when trying to reclassify field using ArcMap field calculator?
Using ArcGIS 10.4. I'm trying to reclassify values from a field (ECOREGION_DIVISION), which is in string format, into new values using the following Python syntax:
def Reclass(ECOREGION_DIVISION):
...
4
votes
2
answers
3k
views
Counting Characters using Field Calculator - ArcMap
I am trying to use field calculator to populate a column based on the the number of characters in another column. I am using the Python Parser. I am not sure if the .count() function is appropriate in ...
0
votes
2
answers
249
views
Iterating through Calculate Field using ArcPy
I have three shapefiles as points that I am trying to create new fields for and fill in the fields with a string descriptor. I am then trying to merge all three point files deleting every field but ...
1
vote
1
answer
21
views
Using ArcGIS Pro field calculator: check values one column and enter specific data in a second column
I have two fields and I want to use field calculator to check the column Datierun_1 (alias is Datierung) for certain words (in this case "Achaemenid"). In case it finds a match it should ...
1
vote
2
answers
221
views
Iterating over table to create chainages using Python in ModelBuilder
I routinely have to do the following workflow:
Map GPS points;-
Create lines based on those GPS points;
Split the lines at a set interval distance (every 50m, every 100m etc.)
Add from / to fields ...
3
votes
1
answer
4k
views
Calculating Cumulative Field Values in ArcMap
In ArcMap 10.2, I wish to create a field which contains the cumulative values of another field in the same attribute table. For example, if the first three cells of the original field contained the ...
0
votes
1
answer
1k
views
Changing date format for labels in ArcGis Pro with label expression?
I am trying to use an expression to convert my date field to a simple %d,%b,%Y format. Right now it is in "%Y%m%d %H:%M:%S %z"
How do I do it properly using Python to do this in ArcGIS Pro?
Q&...
0
votes
1
answer
29
views
Populating field based on value of another field using Boolean OR [closed]
I am trying to enter values for a new column, FloodZone, based on another column's (NEW_ZONE) values. I am doing this in ArcGIS Pro 3.1 using the Calculate Field Tool via Python. However, I am getting ...
1
vote
1
answer
302
views
Conditionally skip field calculation for certain rows
Regarding the field calculator in the ArcGIS Pro 2.9 attribute table (Python):
Is there a way to skip calculating a certain record, if certain conditions are met in the script?
For example, if the ...
13
votes
3
answers
18k
views
Calculating sequential numbers into sorted table using ArcMap
I am using ArcMap 10.3.
Is there a way to calculate a sorted field with sequential numbers in the Field Calculator or using an Update Cursor in ArcPy?
I have seen Sorting feature class to calculate ...
1
vote
1
answer
1k
views
User defined parameter within code block of ArcMap field calculator in model gives ERROR 999999
I am using Reclass within a Code Block in Field Calculator in a Model to calculate field values for a variable based on several other fields.
Using reclass is much quicker than select and then using ...
0
votes
0
answers
60
views
How to convert the RGB color model to the HSV color model in ArcGIS Pro
How to convert the RGB color model to the HSV color model in ArcGIS Pro with Python parser?
I'm trying Calculate Field Tool, everything seems correct but it doesn't work!
Method (1)
Code Block:
...
2
votes
1
answer
37
views
Using Python to change Callout Outline color in ArcGIS Pro
I am using ArcGIS pro to create some maps. There is a polyline feature layer where all of the important data comes from, which is determined by the fields "Direction" with domain of North, ...
1
vote
1
answer
38
views
ArcMap Label (Python)
SOLUTION: I was able to do it with help of a colleague by creating a list instead, I'm assuming the tuple was was a quirky bug;
def FindLabel ( [PIPE_INTERNAL_DIAMETER] ):
lst = ['1"', '2"']
...
1
vote
1
answer
36
views
ArcMap field calculator expression failing with ERROR 000539 [closed]
I am using ArcMap 10.7.
I have an attribute table with 6 different columns of short integer data. These columns store the birth day, birth month, and birth year, as well as the death day, death month,...
-1
votes
1
answer
35
views
ERROR 000539 when trying to calculate a field and using code block [closed]
I was given these instructions for an assignment:
However when I am trying to calculate the field I keep getting this error:
I am trying to calculate the field to get something like this:
2
votes
1
answer
78
views
Moving large set of points to new lat/long using python in field calculator - ArcMap
I'm using ArcMap 10.6.1. I have a large set of points I am trying to move to a new Lat/Long based off of two new fields (X2 and Y2) joined from another table. I have been researching this question for ...
1
vote
1
answer
105
views
Calculate distance between two sets of x & y values into a new field using ArcMap Field Calculator and Python
I am a novice when it comes to python. I am working on creating a new field that has the distance between two sets of x & y values.
I've joined two tables so I have each of their x y values in the ...
1
vote
2
answers
2k
views
Changing Format of Date Field in ArcMap Field Calculator?
I am trying to change the format of date field using ArcMap field calculator.
My data is currently in the format "%d/%m/%Y %h:%m:%s" (e.g. 5/05/2016 12:25:46 AM)
I want to change this to "%d/%m/%Y" (...
3
votes
1
answer
260
views
ArcMap Field Calculator Python Parser gives ERROR 999999
I am trying to assign values to a "K" field in an attribute table based on the "gridcode" values. However, I get this error:
"ERROR 999999: Error executing function.
The ...
0
votes
3
answers
104
views
Adding two or more fields based on condition and reclass sum in existing field using ArcPy with ArcGIS Pro
I have a table that contains data that needs to be summed and the result needs to replace an existing value. I only want to sum the values if they are not -9999. The result would be put in the ...
0
votes
1
answer
94
views
Using If then statements in Python Parser of Field Calculator using ArcGIS Pro
I was trying to write and if calculation and I cannot figure out the syntax to complete it.
The one on the left doesn’t work as it will return the text of the calculation I am trying to perform ...
0
votes
1
answer
179
views
ArcGIS Pro: Calculate Field function to do multiple string calculations in one code block
I need to strip leading and trailing whitespace, split string into list to remove excess whitespace between words and uppercase all values within one Python code block and calculation in Pro field ...
1
vote
2
answers
65
views
Calculating ratio between 2 different area polygons in each cell of a given polygon grid using ArcGIS Pro
I'm trying to calculate the ratio of the areas of 2 polygons (Sealed Surfaces and unsealed Surfaces) in each cell of a given polygon (fishnet) grid. The areas are in one featureclass and I also ...
0
votes
0
answers
43
views
Recalculate a Field with data from another field, ignoring NULL values (take two!)
I am having an issue populating a field with data in a secondary field in ArcMap using the field calculator, below is what I put together...
I have a Feature Class in a Geodatabase with a field for ...
1
vote
1
answer
274
views
Dissolving stream orders using Python rather than VB script
I've been trying to dissolve streams, using orders programmatically and I came across this VB script. The reason is that if I use ArcGIS dissolve, it merges the confluence of the same orders.
How do I ...
0
votes
1
answer
55
views
Calculate Field if/else statement returns nothing
I have to generate line dimension annotation for our maps as a part of my daily workflow. As it stands, I've been using
round(float(!Distance!), 2)
for straight lines, then switching the selection in ...
2
votes
1
answer
7k
views
Writing If-Then statement in ArcGIS Pro field calculator using Python?
I've been using ArcGIS Pro over ArcMap recently because ArcMap is giving me some incorrect summary statistics that I use to populate a data field in a number of feature classes. The problem is that I'...
1
vote
2
answers
159
views
Using If Statements in ArcMap Field Calculator
I've never used Python scripting before and can't seem to figure out how to use an If statement in the Field Calculator tool.
I have a field called 'MAX_GRIDCODE' which returns the highest force a ...
0
votes
1
answer
39
views
How to calculate fields to search data within a set of unique identifier from another field
I want to know how I should go about coding this table to get the 'context" score for each unique identifier (UI). Each unique identifier has a polygon with non remnant area, remnant area and ...
1
vote
1
answer
134
views
Search for partial string in multiple fields, return full string to new field using Field Calculator of ArcGIS Pro
I am attempting a field calculation that searches multiple fields for a partial string, but returns the entire string of the field containing the partial string. For example, the partial string '...
1
vote
3
answers
275
views
Writing FIDs of points within each polygon to polygon field?
I have two feature classes one with points one with polygons (in ArcMap 10.2). Now, I want to write into a String Field of the polygon layer a list of all the Point-FIDs that are within each polygon (...
0
votes
1
answer
727
views
Calculate Field in ArcGIS Pro with autoIncrement based on another attribute [duplicate]
I want to use Calculate Field in ArcGIS Pro to count up sequentially, but start over with each new group. The groups are defined by FEATUREID.
Example of desired output:
FEATUREID GEOMETRYID
A ...
0
votes
0
answers
134
views
Using Parse path to remove extension in model builder. ERROR 000354: The name contains invalid characters
I am trying to iterate through a folder of rasters (approx 6,000) and calculate zonal statistics for roads/paths throughout GB that intersect with raster pixels. However, I am unable to generate an ...
-1
votes
1
answer
83
views
Getting failure in Calculate Field
After today's SW update I keep getting this failure, not sure why, but I am thinking it's the expression. I have no idea how to change the expression to something that makes sense if that's the issue.
...
0
votes
3
answers
177
views
Populating field from another field with conditional
I am working in ArcSDE geodatabase where I have a feature class 'Mange_Waste' and "Q1", "Q2" are two fields. I wanted to use Python script for populating "Q2" from "...
2
votes
1
answer
593
views
Assigning values to field using if/then logic involving multiple fields
I want to run a field calculation on a string field named [territory] that first looks at a string field [majr_src] to see if there is a value other than "NONE", if so [territory] = [...
2
votes
2
answers
3k
views
Calculating only values that are not null in field using ArcGIS Pro
I'm using ArcGIS Pro, the field calculator. I want to populate a hydrant layer with hydrant inspection data.
I have two fields from a joined table: field 1 and field 2. I want to populate field 1 ...
1
vote
2
answers
93
views
Split contents of dBase text field into words at " ", "-" or "_", capitalise first letters, and replace " " with "_"
A shapefile field has text with words separated by blanks " ", dashes "-" and underscores "_". I want to standardise the words to capitalise each word, and then replace ...
2
votes
1
answer
172
views
Field Calculator for Multiple Fields
I am trying to get field calculator to work on 2 fields with multiple lines.
Trying to have anything within RS10/R10 > 100,000 to return 1 if not then 0, also same results RS15/R15 > 150,000, ...
0
votes
1
answer
433
views
Calculate field python script returning NULL values
I have a script that I am using to create and calculate a new field based on the features spatial location. Basically, I have a geodatabase that contains parcels by county in florida, and I am trying ...
1
vote
0
answers
159
views
Trying to calculate a field with code block but it is not filling the fields [closed]
I am using ArcGIS Pro calculate field. With this I want to fill the null values of a new field from another field using if and elif statements. The other field is "yearsINT" which is a short ...
3
votes
1
answer
3k
views
Calculating field based on content from another table with no join in ModelBuilder?
I'm trying to work out how if (at all) it is possible to do a field calculation where there is no join or relationship between two attribute tables in ArcGIS 10.3.1. I've searched all over the place ...
0
votes
2
answers
159
views
Populate NULL from existing value from another record
I'm using ArcGIS Pro on the table below (ACCT_ID field is sorted). The goal is to calculate/populate the "Asset" field where if rows have the same "ACCT_ID" and at least one of ...
0
votes
1
answer
229
views
I need label expression in python to stack labels for points present at same geometry
I have a data set that has stacked points. I need to display the labels as one. The dataset has locations that only have 1 point and some that have 2 or 3 stacked points. I’d also like to be able to ...
1
vote
1
answer
102
views
Selecting attributes for field calculator by common name
I am trying to automate some of my GIS processes and have come across a snag in my automation. I am trying to understand the percent coverage of my suitability raster layer with my town boundaries ...
2
votes
1
answer
152
views
ArcMap - Date field
I am trying to append some data to an existing enterprise geodatabase feature class, the data I am trying to append has a date field where some entries are in correct, eg instead of 03/19/1983 they ...
2
votes
0
answers
139
views
Combining labels for multiple points in ArcMap
I have a data set that has stacked points. I need to display the labels as one. I've seen this solution Can labels for overlapping points be combined/merged into one label? but it only works for a ...
3
votes
1
answer
52
views
Automating date creation in field calculator
I am trying to calculate a reinspection date for surveys using the field calculator in ArcGIS Pro.
I am using a predefined survey date and risk zone for this calculation. The risk zones are LOW, MED ...