Questions tagged [python-parser]
For questions about ArcGIS Python Parser for labelling expressions and field calculations
38
questions with no upvoted or accepted answers
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 ...
2
votes
0
answers
181
views
Using Python nested if statement for labels in ArcMap?
I am trying to use python to write a label expression that will display a specific set of labels based on nested if statments. The expression should result in a 4 line label if the value is greater ...
2
votes
0
answers
585
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
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
0
answers
25
views
Populate/reclassify newly created field with values dependent on an existing field
I'm trying to populate/reclassify a newly created field with values dependent on an existing field. The new and exiting field has text data type.
Here is the code that I'm using. The existing field is ...
1
vote
0
answers
216
views
ArcGIS pre-logic script code does not work
I am trying to define a function in pre-logic script code on ArcGIS 10.8. While running it, it shows the failure. I am not able to figure out the reason behind it.
I have defined the following ...
1
vote
0
answers
60
views
Determine field being updated using Field Calculator and Python parser
I have to updated some values in different fields and different feature classes. The calculation is always the same. For example if the field is called MyValue then the calculation would be ...
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):
...
1
vote
0
answers
79
views
Calculating values for new field using values from another field as values in dictionary?
I am using the ArcMap application of ArcGIS Desktop 10.5. Im trying to use field calculator to return a max value between other fields in the feature based upon a condition. I am not new to python, ...
1
vote
0
answers
194
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
0
answers
608
views
If Then Statement, Python Label expression, ArcGIS Pro
I'm trying to create a Python label expression in ArcGIS Pro for a parcel layer where I only want to label the parcel when a street number in the Address field is present.If a street number is not ...
1
vote
0
answers
216
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
0
answers
101
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
0
answers
48
views
Limit the number of lines in a stacked label using python parser in ArcMap labels
I am labeling names of places by stacking the labels at each space using the python code below. This makes some incoherent labels for text with many spaces and short or abbreviated words.
def ...
1
vote
0
answers
67
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
1
answer
1k
views
Calculating fields (multiple) with different conditions for each field using ArcGIS Pro
I have a population dataset where I want to reclassify the age groups and include gender. I have the field "gender", 1 for men and 2 for women, and the field "age". One row for each person in the ...
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:
...
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 ...
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 ...
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 ...
0
votes
0
answers
217
views
Syntax for Field Calculator in ModelBuilder of ArcGIS Pro
I'm migrating a legacy ModelBuilder tool that has a VB code block in it to ArcGIS Pro 2.9.
It's a straightforward issue:
The model runs a Calculate Field process. If the field is not null, do nothing,...
0
votes
0
answers
57
views
ArcMap Field Calculator Expression for Highest Value + 1
I'm looking for a VB or Python field calculator expression in ArcMap that will calculate the Highest Value + 1 into the same field named Corr_ID. I was thinking something as simple as this max(!...
0
votes
0
answers
169
views
ArcGIS Pro Python Labelling Expression does not update labels
I am trying to alter the size of labels around a point layer using a python if/elif expression. The expression is valid but nothing changes when I apply the expression. Below I have included the code ...
0
votes
0
answers
42
views
Why does script output blanks at certain rows?
I have been trying to run a script, which runs successfully. However, when using the select by attribute tool and choosing get unique values, I have noticed there are certain rows that do not produce ...
0
votes
0
answers
151
views
Using Python function In Field calculator of ArcGIS Desktop
I am trying to run this expression in Field calculator to create symbology values for a point shapefile
The script below is not doing what I want. The script needs to calculate the mean and the ...
0
votes
0
answers
30
views
Getting invalid syntax in Python Parser of labeling in ArcGIS Pro
I am writing a Python expression in order to label gravity mains based on their attributes. I will provide screenshots of the specific error and my attribute table's field settings for reference.
def ...
0
votes
0
answers
290
views
How to replace a word using python parser in ArcGIS
I have the names like below
Rua Jose Rovira
Travessa Jose Rovira
Rua Antônio de Jose Belém
I need to replace the name José where the Jose.
I'm trying this:
!field!.replace("Jose","...
0
votes
0
answers
128
views
Count duplicates in a field for sequential unique ID
I am trying to create a unique ID for my street feature class. (My unique ID starts with first 3 letters of the Street Name, 2 letters of the Street type, and 3 letters of the City Name Abbreviated.)
...
0
votes
0
answers
36
views
ArcMap polygon labelings
I have a challenge with advanced labels of polygons in ArcMap 10.1. I wish to make the label take the longest direction(either curved, horizontal, vertical or diagonal) inside the polygon.
The python ...
0
votes
0
answers
231
views
Changing stacked labels new line character to other than comma using ArcMap
Trying to execute some stacked labels with little bit of Python from the examples given here:
https://desktop.arcgis.com/en/arcmap/10.3/map/working-with-text/about-building-label-expressions.htm
The ...
0
votes
0
answers
76
views
How to use Field Calculator on 1 to Many Join and keep most recent
I have a Hydrant layer and a hydrant inspection table. So when I join them, it is a one to many join since there are multiple inspections for one hydrant.
I need to populate a field in the hydrant ...
0
votes
0
answers
53
views
Python conditional statement for range of numbers isn't working
Using ArcGIS desktop 10.7. The field Shape_area_Hect is float and the field Core_patch is string. Error for following syntax:
def Reclass(Shape_area_Hect):
if (Shape_area_Hect >= 12150):
...
0
votes
0
answers
54
views
Using Python Parser in field calculator to update column from another column
I am an experienced ArcMap user who is fairly new to Python. I am having trouble getting the script to look for a list of values and assign a new label in a new column. The script runs without errors ...
0
votes
0
answers
459
views
Using Calculate Field in ArcGIS Pro
I have several field in an attribute table that have value, I am wanting to using the 'Calculate Field' GP tool to select the values and replace them with zero.
Anyone have any ideas on the Python ...
0
votes
0
answers
134
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 ...
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
0
answers
129
views
Calculating field after arcpy.Append_management()?
I have some AutoCAD layers (f.e. Cad1, Cad2) and I want to export them into feature class in a geodatabase (f.e. feature_class). Also I want to calculate field in "feature_class" for objects from CAD.
...
0
votes
0
answers
41
views
Add the lengths of columns with the same id in arcmap
I have a polyline dataset that contains a unique feature (manhole) and the lines segmented by outflows from it. I need to get the distance from the manhole to each break on the line.
So in the MH ...