We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [python-parser]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
316 views

model builder expressions code block and definitions

I am having difficulty wrapping my brain around the point of the expression vs the code block. What am I suppose to be defining? I copied the example from calculate value in the ArcGIS help website ...
0
votes
1answer
166 views

Parsing Data for Label using Python

I have field called PIN in my parcels shapefile. Formatting looks like this: xx-yy-zzzzz, just much longer. I want to split the first two sections on one line and the third (the z's) on the next. I ...
0
votes
1answer
56 views

Populate field using a combination matrix

I have a polygon shapefile that represents combinations of soil hydrologic type (A,B,C,D) and soil cover (53 different possible covers, coded from 0 to 53). Each of the 53 soil covers can be either ...
0
votes
1answer
103 views

indentation problem or function problem?

I am trying to create in Field Calculator (arcmap) a function to assing a numeric value in a column (heighs) based on a text value from another column(building). 'Pre Logic' input box def a(heighs, ...
0
votes
1answer
156 views

How to translate VBScript to Python-parser in Field Calculator

How do I translate the following VBScript code in Field Calculator to Python using the Python-parser? Function FindLabel ( [MHUNIT], [BLDG_NUM] ) If Not IsNull( [MHUNIT] ) Then FindLabel = [MHUNIT]...
0
votes
1answer
85 views

Filling Field2 Based on Values in Field 1 using Python Parser of ArcGIS Field Calculator?

I have been trying to rework attributes in a polygon shapefile and think I have figured out how to ask in a sensible manor. I need to fill column Field2 with a 1 IF the value in column Field1 is ...
0
votes
1answer
46 views

Identify same values and assign code to them using ArcGIS field calculator?

There is the attribute table the FID_lote_teste fields and selecao both integer. The selecao field receive zero (0) if the FID_lote_teste field number does not exist in memory. For example: First ...
0
votes
1answer
900 views

How to concatenate string and noneType object

My issue is: I can't concatenate string and noneType object. Some attribute values are empty. It follows that label isn't displayed. What is the solution? def FindLabel ( [CONTENU], [...
0
votes
1answer
142 views

Field calculation based on the field name by using arcpy

The shapefile table is like this. I want to do the sum of cells when their field names meet the condition. In this case, I want to sum the cells to the TotalCT field if the field name contains the ...
0
votes
1answer
968 views

Calculate percentages with field calculator in arcgis?

I am trying to calculate the percentage of each the area of each polygon in the selected area. I tried using ( math.fsum(!shape.area!) / !PolygonArea! )*100 and other codes but I cannot make it work. ...
0
votes
1answer
171 views

Extract acres from legal description

I need to extract the acres from the legal description. I have tried "(!Legal!.split(" AC")[-1])" but it gave an error. I am using ArcGIS 10.2 using python in the field calculator. I realized why my ...
0
votes
1answer
149 views

Sum field and use that sum to populate existing field in same table using ArcGIS ModelBuilder?

I am trying to break down land uses in a watershed by making a tool in ModelBuilder. Right now I am clipping a land use layer by a watershed polygon, dissolving land use layer by land use code, ...
0
votes
2answers
529 views

Add value to a field Python

I have a feature Class with the columns KOMMUNE and GKR and some other columns.. Both columns are string. In the column KOMMUNE I have the value 0723 and 0724. In column GKR I have the value 0107 and ...
0
votes
0answers
15 views

AutoIncrement based on Field Value [duplicate]

Is there any way to automatically restart the AutoIncrement () function based on the Field Value on ArcMap? I am developing a model in ModelBuilder to name parcels automatically. The polygons are ...
0
votes
1answer
30 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 ...
0
votes
0answers
30 views

Updating Date Field based on date value ONLY from another field using ArcGIS Field Calculator

In ArcMap 10.4 I have the following code in Pre-Logic Script Code Section in Field Calculator with python option selected and show code block: from datetime import datetime def myfunction(date_text):...
0
votes
0answers
35 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
0answers
58 views

Converting Python to Arcade in ArcGIS Online?

The following python expression can trim street addresses for labeling in ArcMap. I need to convert the expression to Arcade so I can retain the same labeling scheme when pushing my feature layer ...
0
votes
0answers
71 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
0answers
44 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
0answers
20 views

Sum calculation in Field Calculator using Python script [duplicate]

I have a problem with Python script in Field Calculator. How to sum the values of one field ('AB') and paste the sum in another field ('RE') using Python in Field Calculator? I'm working in ArcMap 10....
0
votes
1answer
260 views

“No module named numpy” Python Error in ArcGIS Label Expression?

I have developed code to label points that pull formatting from a dictionary. I developed this code and it was working fine two weeks ago, today I try to open my map and I am now met with an error ...
0
votes
0answers
344 views

Converting Text Field to Numeric in ArcGIS Pro?

I'm trying to convert text to numeric, but am unable to in ArcGIS Pro. Is there a Python function? I tried int(!FieldName!) but I think NULL values are messing it up?
0
votes
0answers
52 views

Calculating Raster Percentile Values in ModelBuilder

I want to calculate the 75th percentile value of a raster dataset (floating, 32Bit) and use this value as an input to a set null expression. I have multiple rasters to perform this on so I need to ...
0
votes
0answers
44 views

Calculating sequential numbers into sorted table not dependent on OBJECTID? [duplicate]

I am having a problem with adding sequential numbers to the new column based on other sorted value. I would like to use 'Sort by' column to be able to generate numbers in the 'Required number'column. ...
0
votes
1answer
210 views

Creating label with number circle and field “1v” in ArcMap?

How to create a label which combines a circle number and field "1v" in ArcMap? For example: I need, a line the labels. My code label expression is: Function FindLabel ( [TOTAL_VIV] ) FindLabel = "&...
0
votes
1answer
57 views

Converting Angles in a File Geodatabase Table - via Field Calculator's Python

In a file geodatabase table, I have an attribute called 'NEAR_ANGLE' created via the "Generate Near Table" tool that I'd like to convert to a 0-360 degrees format. I've created an attribute called '...
0
votes
0answers
31 views

Field Calculate unique ID, based on another column, overriding FID / Object ID order [duplicate]

I have a couple thousand polygons across several hundred towns. I want the polygons within each town be labelled as such - first 3 letters of town name + _ + incrementing ID, so that they might look ...
0
votes
0answers
58 views

python syntax error in field calculator [duplicate]

I'm trying to strip the last character in a string if when the string is split by spaces the last element has a length of 1. I then want to put that letter in front of the rest of the other elements. ...
0
votes
0answers
16 views

ArcGIS Field Calculator reformat Lat Long values [duplicate]

I have a table which is filled with point values that have been exported from an external source. Unfortunately the Lat Long values are formatted strangely and this is preventing me from simply ...
0
votes
1answer
59 views

Field Calculator: Prefixed, padded IDs from a number field

Using the Field Calculator, I want to create prefixed, padded IDs from an existing number field. By "padded", I mean I want the IDs to have a specific number of characters, regardless of how many ...
0
votes
0answers
21 views

Ensuring expression always yields same number of digits in ArcGIS Desktop? [duplicate]

I am using ArcGIS Desktop 10.5 and trying to create a unique ID with the following expression: "city_id"='2'&'002'&"popn_rank" The expected result would look like 20020001, 20020002, etc. ...
0
votes
0answers
37 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 ...
0
votes
1answer
53 views

Constructing distribution graphs of attribute tables using ArcGIS field calculator?

Since I'm new to python I have an issue with writing the correct code to achieve the following. The picture is an example of an attribute table of which i want to make frequency distribution graphs ...
0
votes
1answer
153 views

Python if/then Statement in Field Calculator to return 0 or 1 based on numbers divisible by 28?

I don't use python all the time. In a point feature class, I'm trying to populate an ID field with 1's and 0's based on whether the FID is divisible by 28. I've started the following code but can'...
-1
votes
2answers
907 views

Removing white space from field values? [closed]

If I have a field say 'account' and I want all the white space (if there is any to the right and left of the account entry, for example 83128313 - is there a python script or field calculator function ...
-1
votes
1answer
44 views

Field Calc Python/VB script to populate field with one field, along with the last 6 digits of another [closed]

I'm trying to populate a field in a table using field calculator with the value of the field in another, concatenated with the last 6 digits of another field.Example below, I would like a field ...
-1
votes
1answer
73 views

Address Prefix Strip Using Python

I have a field of data with a lot of prefixes that are difficult to remove. They involve two letters and up to three numbers that are not separated from the Street Number with a space. For instance, ...
-1
votes
1answer
46 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
votes
1answer
209 views

Convert VB CalculateField_management expression to Python in ArcPy

I am trying to change VB expression of CalculateField_management to Python expression. What I am trying to achieve is to adding suitability rank values to new fields for a dbf created out of raster ...
-1
votes
2answers
2k views

If Then Else Statement in Field Calculator using Python - ArcGIS 10.1

I am trying to populate a field [Hazard] based on the values in two other fields [Depth2D] and [Speed2D]. I have managed to write a code block in VB script that works but I really want to figure out ...
-1
votes
1answer
254 views

Splitting attribute using Python Parser in ModelBuilder expression? [closed]

Goal: I need to upgrade an existing ModelBuilder where the expressions use Python 9.3. Work process & Goal: My *.mxd Have 1 attribute field containing the following build: X1-X2-X3-x4_x5_x6-x7. ...
-1
votes
1answer
184 views

Python Script error in function ERROR 000539: SyntaxError

I am receiving the following error; is it a simple syntax issue with the Calculate field because I'm not seeing anything missing. ExecuteError: ERROR 000539: SyntaxError: unexpected EOF while parsing ...
-1
votes
1answer
218 views

Python Contour index [closed]

I'm getting my feet wet with python in the field Calculator. I'm working with contour data and I'm looking to see if someone can help me. I basically need to do this, but with python.
-2
votes
1answer
63 views

Field calculator in ArcGIS 10.4 multiline python code

I am trying to use field calculator to calculate a field based on unique types in another field. I had to go for a for loop to add new values. I have 81 classes and every class should be assigned an ...
-2
votes
2answers
1k views

vb script for carriage return in label string over 50 character long

IN ArcGIS, what is the vbscript in the label expression box to build a label which has the outcome that if the string is over 50 characters long then the label should be formatted over 2 lines.
-2
votes
2answers
379 views

Writing python script to group and sum records from each group? [closed]

I am doing hydrology analysis in ArcMap 10.2 and have a drainage area feature class containing hundreds of records. Each record is assigned a drainage area name and acreage amount. How do I sum all ...
-2
votes
1answer
171 views

Converting VB to Python for Labeling in ArcGIS Desktop?

I am using ArcGIS Desktop 10.2.1. I am really new to Python and do not understand VB. I need to convert this VB script to Python. The code is below. It believe it is looking for a numerical value ...
-6
votes
1answer
97 views

Field calculator with next() function? [closed]

I want to do calculate with script, field - field.next () with incrementation of 2 rows