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
23 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 ...
1
vote
1answer
115 views

Simple Field Calculation With No Results in ArcGIS Pro?

I have a grid in ArcGIS Pro that I've named the X and Y axis (in separate columns) and am now trying to do a field calculation on the total grid name (I've tried using both single and double quotes. I'...
1
vote
2answers
59 views

Adding Hyphen between text in Python Parser of ArcGIS Field Calculator

I have list of numbers like this (S20170146) and I want to turn them to this format(S2017-01-46).Basically, I need to add "-" between the numbers. I am using Arcmap I know how to use feild calculator....
1
vote
1answer
27 views

ArcGIS Pro Field Calculator Python IF statement

I'm attempting to populate a newly created field with values dependent on an existing field. The new field has text data type. The existing field is double data type. This is the python code I've ...
0
votes
0answers
29 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
1answer
27 views

Calculating New Field using Python Field Calculator From Two Fields Returning Specific Numbers

I have never used the SQL function in the field calculator and need some guidance. I am attempting to calculate new field data (date update) using python for a client that will look at first at one ...
0
votes
1answer
46 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
201 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 = "&...
3
votes
1answer
1k views

Using Python Parser in ArcGIS Field Calculator to compare two fields?

I'm trying to use field calculator to compare two fields in a table of tax parcel data, Land Value (LAND_VAL) and Improvement Value (IMPRVT_VAL). My goal is to determine (1) Parcels with land value ...
-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
2answers
52 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
44 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 ...
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
2answers
32 views

Creating conditional stacked labeling in ArcGIS Pro?

I found a code example for what I'm looking to accomplish at Creating conditional stacked labeling in ArcGIS Pro? I want to display filter quantity and sizes for a school district per building in a ...
1
vote
2answers
33 views

Adding time to variable using Python Parser of ArcGIS Calculate Value tool?

I am using Python 2.7 in calculate value in ModelBuilder. I want to query both 30 seconds before and after the variable. The original value keeps returning not the time change. What am I not defining? ...
1
vote
3answers
861 views

Creating stacked Python label expression in ArcGIS Desktop?

I am using ArcGIS Desktop 10.3. I have a number of polygons representing exploration licences and a series of attributes including licence name, operator, partners and associated interests (%) ...
6
votes
6answers
2k views

Using ArcMap Field Calculator to set Row 1 (Column D)= Row2 (Column B)?

This is probably a fairly basic question but I have a long list of latitude and longitude values that represent telemetry points that will be the start point of the line. Before I convert them to ...
3
votes
2answers
3k views

Calling variables within ArcPy functions using Calculate Field tool?

I have a defined function (ex. def my_function(x,y)). def my_function(x,y): """algorithm""" my_variable = my_function(filex, filey) How can I call this variable within the code block section of ...
3
votes
2answers
903 views

Adding both string and automated numbers in series to attribute table using ArcGIS field calculator?

I would like to fill a column in my attribute table with an string that ends in a numeric value. Example: Object001 Object002 Object003 I would like to automate the process of filling in the ...
1
vote
0answers
25 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 ...
7
votes
4answers
979 views

Parsing serial date in ArcGIS Desktop?

I have imported a shapefile that contains a serial date number that looks like this: 41256.260799. I would like to create a new field that shows only the hour and second like this: 06:33. I've tried ...
2
votes
1answer
41 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 ...
1
vote
3answers
153 views

Making one field/values equal to another field/values

I have created a new field called "SFX" in a shapefile called "myshape.shp": input = r"C:\files\myshape.shp" arcpy.AddField_management(input, "SFX", "TEXT", field_length=100) There is now a field ...
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
1answer
133 views

Error updating firstChild.data when updating WebCapabilities

I'm trying to update the WebCapabilties to allow uploads for a service definition. I've followed the instructions from ESRI's website, but when I try to set the keyValue.nextSibling.firstChild.data ...
3
votes
3answers
2k views

Concatenating strings from two fields using Python in ArcMap Field Calculator?

I'm new to Python scripting and I don't understand what is wrong with this code. I want to concatenate the string values from GRID1MIL and GRID100K. I've created a text column MGRS to begin with. I ...
0
votes
2answers
44 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 (...
0
votes
2answers
48 views

Showing lowest value first after one-to-one spatial join with delimiter?

After a spatial join (one-to-one) in ArcGIS my result looks like this: (I use a / as delimiter) 2015/2015/2014/2014/2013 After that i use python in calculate field to filter out duplicate values ...
4
votes
4answers
9k views

Concatenating string data plus numeric data in ArcMap field calculator?

I am using ArcMap 10.2.2. I have three attribute fields (Address_No: 1, StreetName: Main, Street_Ty: ST) that I want to merge together. How do I concatenate string data found within the table plus ...
1
vote
1answer
335 views

Run field calculator script in Python window

I have a script that runs perfectly in the "Field Calculator." The codeblock looks like this: def timeday(time, am, diur, pm, noc): if(time >=am and time < diur): return "crep_am" ...
3
votes
1answer
79 views

Adding unique indexes which start with “A” go up to 99 (A1-A99) and then start again “B1” and continue up to B99 and so on? [closed]

i want to add unique indexes which have to start with "A" go up to 99 (A1-A99) once the 99 rows of finished it has start again "B1" and to continue up to B99, so this index system has to continue ...
2
votes
1answer
51 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
0answers
57 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 ...
5
votes
1answer
567 views

Counting number of times value/string occures in field using ArcGIS field calculator?

How do I count the number of times a value/string etc. occures in a field (using field calculator)? In my example I want to count the number of times the letter "H" occures in a field; see attached ...
1
vote
2answers
170 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 == "...
1
vote
0answers
47 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
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 ...
0
votes
0answers
59 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&...
1
vote
1answer
2k views

Auto incrementing field that begins with text in ArcGIS Desktop? [closed]

I am searching for a way to auto increment an ArcGIS field which begins with text and followed by numbers. Ex. SWCL0000. I have tried the auto increment code in the field calculator but once I added ...
1
vote
1answer
32 views

Auto incrementing every second row in ArcGIS Desktop?

How do I auto increment every second row (field type is short and I work with 150 fields) in ArcGIS Desktop 10.3.1? I saw this code in https://support.esri.com/en/technical-article/000011137 rec=0 ...
0
votes
2answers
41 views

Reclassifying vector polygons based on text string to integer using Python Parser of ArcGIS Field Calculator?

So I am trying to reclassify a text string by searching for bits of strings and converting those strings to an integer value in a new field within the field calculator. e.g. I want to find all values ...
2
votes
2answers
339 views

Performing Conditional Calculate Field with Many to One using ArcMap?

Anyone have experience calculating a field based on a many to one scenario? I have a feature class in a geodatabase with a field of unique names. Feature Class Table (let's call this "MAINTABLE") ...
0
votes
0answers
43 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. ...
6
votes
1answer
645 views

Classifying time periods in new field using Python Parser of ArcGIS Desktop?

I have a datetime field (Horario) in my feature class, showing only the time. Although the date doesn't appear, it seem to be stored automatically as 30 Dec 1899, I'm not sure why. I want to use ...
6
votes
1answer
3k views

Writing Python code block in field calculator?

I am a novice in Python as well has having minimal experience with ArcMap. Currently I am using a U.S. Census TIGER file, mapping roads in Harris County, TX. I want to add a new field called SPEED, ...
8
votes
2answers
848 views

Performing multiple calculations in ArcGIS Attribute Table?

I have an existing Excel spreadsheet developed to track specific fire hydrant data, this is periodically updated and joined to the spatial hydrant data in ArcGIS. In the spreadsheet there is a number ...
1
vote
1answer
49 views

Getting angle of point generated from DEM in Raster using Field Calculator in ArcGIS Desktop?

I am trying to calculate the angle of some specific points generated from flow direction in ArcMap 10.2. I converted the DEM to flow direction and then to points. I am trying to convert the grid_code ...
0
votes
1answer
61 views

Capitalizing and changing font/color in Label Expression using Python Parser of ArcGIS Pro?

Currently Using ArcGIS Pro 2.3.2 and Python. I am currently trying to label Road names, which are all uppercase in the database. I'm unable to edit the database but would like to Capitalize the road ...
0
votes
1answer
38 views

Auto Incrementing Field based on Selection of Records in Feature Class?

I'm attempting to write a script that will add an incremented value to a field based on a selection of records. For example, the script will select the first 300 records in a feature class and then ...