Questions tagged [python-parser]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
130 views

Referencing external CSV file within ArcMap field calculator using python codeblock?

I would like to know if there is a way to incorporate an external csv file into a custom made python script in ArcMap field calculator. I am inputting fields from the current layer, but need to access ...
1
vote
1answer
119 views

A script to populate a numeric field in Arcgis based on some content of a string field?

I have field in an attribute table populated with expressions like "6S2Olch1E", "10S1B", "9B3S2Olch" and so on. I need to make a numeric filed populated with only numbers associeted with letter S from ...
1
vote
1answer
947 views

Single label for multiple features with different values in ArcGIS Desktop?

I have several sample locations, that have been sampled several times at the same location. I want to label each location with stacked data from each location. So it would hopefully look like this "...
1
vote
1answer
2k views

Adding a sequential number using ArcGIS field calculator to string file and keeping the 0 in front of the number? [duplicate]

I want to know if anyone has a code to count +1 starting at a certain number for Field Calc. ArcGIS. (I.e. 04312, 04313) It also must keep the 0 in front. rec=0 def autoIncrement(): global rec ...
1
vote
1answer
83 views

Trying to use a python script to manipulate a value from attribute table

I am using ArcGIS ArcMap 10.2 and I am trying to learn how to write a python script to use a value from an attribute table and perform some checks to it and assign an output value. At this moment all ...
1
vote
1answer
1k views

Delete empty feature class in modelbuilder - “Calculate Value” Expression problems

I am trying to delete empty feature classes created in the process of intersecting layers with a set-up in modelbuilder. By using Calculate Value tool i have written a code that should do the trick. ...
1
vote
2answers
604 views

Autoincrementing Python Script is over writing all fields versus just fields that are null

Using ArcMap and the Field Calculator I have a python script that should autoincrement the FacilityID field if it is null. It works the first time through but the second run causes it to overwrite ...
1
vote
1answer
1k views

Getting Null value error with Python Parser in field calculator?

I'm trying to calculate the angle between two line segments in ArcMap 10.0. I have a point shapefile, so I'm using the xy coordinates of 3 successive points to calculate the angle. I'm trying to use ...
1
vote
1answer
332 views

ArcGIS Python Field Calculation says failure during processing?

I have a problem with the field calculator in ArcGIS: I have: A complete table of several states of the world with their specific life expectancies. A world map (not yet joined) What i have to do: ...
1
vote
1answer
139 views

Reaching field value of record in ArcGIS field calculator?

I have two fields showing number of people in two age groups "young" and "old". these people also live in a cell (point) whose distance to a specific facility is calculated. then I categorized these ...
1
vote
2answers
126 views

Importing text only out of string field to new field for labelling in ArcMap?

I want to import data out of a string field in my shapefile to a new field for labeling. The string field contains river names and codes and I just want to display the text i.e river names
1
vote
0answers
24 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
1answer
45 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 ...
1
vote
0answers
35 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
0answers
58 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
36 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 ...
1
vote
0answers
55 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
0answers
41 views

Is there a way to use the project layout if using a plug in that creates batch maps through QGIS?

There is a plugin for biological records which creates batch maps for each taxon but it bypasses the premade project layout with a legend, picture of a logo and the copyright for each of them. Is ...
1
vote
1answer
56 views

Python Group by attribute range

I have about 6000 points that I need to run a computationally intensive analysis on. My thought process is to break this point layer up into six groups of 1000 points each. I'm trying to do this in ...
1
vote
0answers
204 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
0answers
42 views

ArcGIS field calculator pythons script value transfer between columns [closed]

In the picture below I can transfer values from one field(FID) to another(Id) using ArcGIS. The issue is that I will end up with some duplicated values in field "Id" (example number 12 and 17). My ...
1
vote
0answers
58 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
0answers
38 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
0answers
61 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
0answers
47 views

Create sequential numbers based on field value using Python in the Field Calculator [duplicate]

I'm trying to modify the autoIncrement() python script to auto number based on another field. For example, I need the autoincrement to restart when the field "STD_ID" changes value. This is my attempt ...
1
vote
0answers
55 views

Creating sequential numbers in sorted field using ArcGIS Field Calculator? [duplicate]

I have a sorted field that I would like to populate with sequential numbers. They are not in order of OID. Is there any way to do this?
1
vote
0answers
124 views

If/Else Statement in Python ArcGIS Field Calculator [duplicate]

I have a shapefile and want to calculate a field based on another field. The two fields are "DURATION" and "STATUS". I need "STATUS" to display three different outputs based on "DURATION". I want "...
1
vote
1answer
142 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 ...
1
vote
0answers
19 views

Creating updated field in ArcGIS for desktop? [duplicate]

This is my attribute table: the field "hight" is short type. the field "text" is string type. I try to find how can i connect between those two field with python phrase (i know how to do it with ...
1
vote
0answers
113 views

Removing Duplicates Labels in ArcMap? [closed]

I have seen few posts here that shows you how to remove duplicate labels by adding new field. Also saw posts that talks about using Maplex tools that will remove duplicate values based on the buffer. ...
1
vote
0answers
69 views

Calculating distance between consecutive points using ArcGIS Desktop? [duplicate]

I am not able to get the answer to the question below to work for me using the information provided: Finding distance between consecutive points using ArcGIS Desktop? Could someone post a screenshot?...
1
vote
2answers
86 views

Python script in Field Calculator

I am looking for a hand writing a python script in the Field calc, as it looks like I am stuck. Here is a screen shot of my table: What I need to do is populate the "status" field by parsing through ...
1
vote
1answer
137 views

Date different in field calculator using python method

I would like to calculate date different between two fields of date format. The idea is to know if Field_1 is greater than Field_2. My calculate code is something like this: def date(f1,f2): if f1 ...
1
vote
0answers
874 views

Cumulative field calculation using Python in ArcGIS for Desktop? [closed]

I am using the following Python code to sum cumulatively but I need the summation to take place while the other field is equal to 1 and then again start the summation when it's equal to 2. I need the ...
0
votes
4answers
129 views

Copying/replacing first letter in column of attribute table in ArcMap with field calculator and Python Parser? [closed]

How to copy / replace the first letter in a column if that letter is "N" and replace with "C" in the field name "DISTRICT" inside the attribute table in ArcMap using Python inside the field calculator?...
0
votes
3answers
296 views

Python code help for ArcGIS Field Calculator tool (Model Builder)

Is there any python code that: 1st, sort a column (example name by alphabet) 2nd, grab the first cell of sorted column and assigned it to a variable like A=.. I need all of this to be done in field ...
0
votes
1answer
235 views

If-then-else Statements and string errors?

I'm defining a string field based on contents of another string field. Simply put, if the contents of field A contain this value, then fill field B with this text. It throws a string related error ...
0
votes
2answers
863 views

Using ArcPy to multiply fields in attribute table?

I am trying to identify a method to multiply 2 fields in the same attribute table and write the product of the calculation into an added field. The code creates the empty fields, now I just want to ...
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 == "...
0
votes
2answers
80 views

Concatenate fields (double and string) to create address using arcpy

fields: STNUM = double STRDIR = string STRNAME = string STRTYPE = string Tuple and s.format I have tried: arcpy.CalculateField_management (newparcelsUTM, "SiteAddress","{0} {1} {2} {3} ".format('!...
0
votes
3answers
391 views

Sequential IDs with field calculator: Pad a prefixed field to specific length

I have an ID field that is a text datatype. The IDs in the field have a prefix, and are padded with zeros to always be a specific length. Examples: INSP000098 INSP000099 INSP000100 INSP000101 I ...
0
votes
1answer
668 views

Writing expression for field calculator in Python?

I have a script where I calculate a couple of variables, add a new field then need to do a field calculation that field. Once I get everything set up, it's the expression that I have a hard time ...
0
votes
1answer
3k views

Splitting field in ArcGIS field calculator using Python Parser?

I'm using field calculator in ArcGIS Desktop 10.2.1. I have field1 which has a values of "A_B" (example). I created two fields out of this, values to the left of the underscore go in fielda and to ...
0
votes
1answer
30 views

Adding two to every value of field using ArcMap Field Calculator

I am working on a road network and each section is assigned a certain value and increases by 1 each section until it gets to around 500 which is the end. A change I had to make was adding two ...
0
votes
1answer
52 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
173 views

Using arcpy to set a Python expression for Label Expression

I have a python script that I input into the label expression by hand which assigns different labels depending on the attribute data, see: def FindLabel ( [a], [b] ): if [b] != 'ok' and [b] != '...
0
votes
1answer
585 views

Replacing text in label expression of ArcMap?

I'm trying to replace the text in a field to build a label expression. The field I'm using is called [Organizatio] and it holds the school's name. What I want is to tell ArcMap that when that name ...
0
votes
1answer
424 views

Field Calculator GUID remove curly brackets from GUID string

I'm attempting to Field Calculate the GlobalID field into a text-equivalent version of it, named GlobalID_T. This new text field will have the exact values for records calculated into it, except for ...
0
votes
1answer
179 views

Using Python for Field calculator?

I have problem with Field Calculator, using ArcGIS 10.2. I tried to write a statement but I don't know what is wrong. I have two columns: The first contains a number code. Every code represents ...
0
votes
2answers
38 views

Splitting string ID code into various parts

I have a series of identification codes that I need to split out. The format of these codes is [region(letter)][district(number)] - [place(number)][subdistrict(letter)]. An example of some codes ...