Skip to main content

Questions tagged [python-parser]

For questions about ArcGIS Python Parser for labelling expressions and field calculations

40 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2 votes
0 answers
208 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 ...
Ryan's user avatar
  • 21
2 votes
0 answers
189 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 ...
Daniel's user avatar
  • 21
2 votes
0 answers
617 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 ...
NRutt2005's user avatar
1 vote
1 answer
103 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 ...
ArcheoHorst's user avatar
1 vote
0 answers
29 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 ...
Alex's user avatar
  • 11
1 vote
0 answers
259 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 ...
lsr729's user avatar
  • 323
1 vote
0 answers
64 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 ...
Midavalo's user avatar
  • 29.8k
1 vote
1 answer
638 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): ...
kent 's user avatar
  • 101
1 vote
0 answers
88 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, ...
jboges's user avatar
  • 107
1 vote
0 answers
206 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 ...
Emmett McKinney's user avatar
1 vote
0 answers
651 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 ...
GISMapper's user avatar
  • 387
1 vote
0 answers
223 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 ...
Serena's user avatar
  • 13
1 vote
0 answers
105 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 ...
Liz-Gis's user avatar
  • 31
1 vote
0 answers
54 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 ...
JS24's user avatar
  • 127
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 ...
user88842's user avatar
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 ...
user74862's user avatar
  • 131
0 votes
0 answers
33 views

How to give numbers by order to column in ArcGIS Pro through FieldCalculator and Python

How to give numbers by order to column in ArcGIS Pro through FieldCalculator and Python? Sequence doesn't work as I need. I sorted X_North and need to give a numbering (from 1 to 296) to new column. I ...
Sandi's user avatar
  • 17
0 votes
0 answers
56 views

Calculate Field calculates once

Why did Calc Field work the first time I wrote the following code, but not when I re-ran it with an additional criteria? I figured out the code I needed to classify all fields in a new attribute ...
Ryan Stephenson's user avatar
0 votes
0 answers
126 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: ...
Mohammad Hosseini's user avatar
0 votes
0 answers
52 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 ...
LandArch's user avatar
  • 2,201
0 votes
0 answers
216 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 ...
GISLad's user avatar
  • 11
0 votes
2 answers
289 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 ...
rweber's user avatar
  • 51
0 votes
0 answers
247 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,...
MattS's user avatar
  • 117
0 votes
0 answers
61 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(!...
Mercator's user avatar
  • 283
0 votes
0 answers
242 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 ...
AC87's user avatar
  • 1
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 ...
Maqsooda Mahomed's user avatar
0 votes
0 answers
174 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 ...
JHR's user avatar
  • 29
0 votes
0 answers
39 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 ...
bsmithmcrobie's user avatar
0 votes
0 answers
360 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","...
RakeshReddy Posham's user avatar
0 votes
0 answers
184 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.) ...
Gabriella Santana's user avatar
0 votes
0 answers
37 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 ...
Samuel S. Adeapin's user avatar
0 votes
0 answers
316 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 ...
Tom's user avatar
  • 33
0 votes
0 answers
83 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 ...
Katie B.'s user avatar
  • 807
0 votes
0 answers
65 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): ...
kent 's user avatar
  • 101
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 ...
justin landolt's user avatar
0 votes
0 answers
492 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 ...
Chezel's user avatar
  • 19
0 votes
0 answers
159 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 ...
Felipe Gonçalves's user avatar
0 votes
1 answer
2k 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&...
Brewkeeper's user avatar
0 votes
0 answers
157 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. ...
Lora's user avatar
  • 45
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 ...
GeorgeC's user avatar
  • 8,238