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
63 views

Replace attribute value with non NULL values from a joined attribute column [duplicate]

I have a Geodatabase with a column for pipe diameter. I have a secondary data set with field verified data and a column for pipe diameter. I would like to replace the pipe diameter in the Geodatabase ...
1
vote
1answer
32 views

Sort User Defined Features Classes Into Premade Feature Dataset Using ModelBuilder?

I have a large Model where the user selects the text file, it creates the xy file, then decimates the file, thus creating a feature class. I would like this decimated feature class to get sorted ...
1
vote
1answer
49 views

Arcgis Label Expression based Value

I am trying to make election map so I can draw chart and label with same chart color. So I have six election zone and running candidates may be up-to six or less. So if some election zone might have ...
1
vote
1answer
270 views

Syntax Error Label Expression Debug

I'm attempting to debug a code for a conditional label expression. The code is based on one i have previously used and did not have any issues. The python code is as follows. def FindLabel ( [TF], [...
1
vote
1answer
190 views

How to translate VBScript to Python-parser in Field Calculator

How do I translate the following VBScript code in Label Expression to Python using the Python-parser? Function FindLabel ( [MHUNIT], [BLDG_NUM] ) If Not IsNull( [MHUNIT] ) Then FindLabel = [MHUNIT] ...
1
vote
1answer
91 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 ...
1
vote
1answer
110 views

Using an IF statement in Field Calculator

I'm trying to use an if statement in the field calculator: This is what the code looks like in Python: a= 2 FacilityID= !FACILITYID! if a%2==0: MH_ID_Calc=FacilityID[0:6] else: MH_ID_Calc=...
1
vote
1answer
153 views

Field Calculator: extract single cell based on it's OBJECTID?

Is it possible to copy a single value inside a field based on it's OBJECTID from another field? Some sort of if-then-else logic? For example I would like to copy the value in the Area field ...
1
vote
1answer
160 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
1answer
1k views

Error Label with Python: encoding declaration in Unicode string (<string>, line 0)

I get this error using Python while I'm trying to label a shapefile. The strange thing is that for other shapefiles the code works. There is a table (relates.dbf) that has the data to be used for ...
1
vote
2answers
309 views

Checking for values in one column and do something in another using ArcGIS Field Calculator?

I have two columns: "Street1" and "Verified". I need to check all rows in Street1 to see if they are of string "0" or null. I've attempted to come up with something in Field Calculator but it is ...
1
vote
1answer
47 views

Addressing fields in ArcGIS field calculator dynamically?

I am (re-)learning ArcGIS for a new job after couple of years on PostGIS (and QGIS/pyqgis) and can't figure out how I can address a Field within the pre-logic-block of the field calculator. Pre-Logic-...
1
vote
1answer
216 views

String value as a number in modelbuilder

I have got a drop-down list of values in my model. There are word combinations that do not exist in my table. One of the tools in my model should select string data of a field by number of characters ...
1
vote
1answer
165 views

Populating ArcMap column with inputs from other colum, shortening original text? [closed]

I need to keep the first part of all inputs and get rid of the last part, so that i can later make a join based on the new attribute. Edit: found solution by using simple python script !MY_FIELD![:-...
1
vote
1answer
506 views

CalculateField by dividing with a variable that holds a number

I'm trying to calculate a field (using idle python to write my scipt and working with ArcMap 10.3) by dividing two fields then dividing by a variable that holds a number, which the number was ...
1
vote
1answer
94 views

Rearranging display of Date Field in ArcGIS Desktop?

Can you rearrange the text in date field type in ArcGIS? Eg. Map_Date - 05/30/2014 (I want to reformat this to 2014-05-30) I've been trying to use the field calculator on all my records, but cannot ...
1
vote
1answer
759 views

Using python script in ArcGIS field calculator?

I am using ArcGIS 10.3 version in desktop. I wanted to assign landuse names (Landuse_04 column) based on the codes those are in my attribute table as the column ID_MAP. once I am done with editing the ...
1
vote
1answer
49 views

Parsing Attribute Table

I have thousands of records to go through and I need to pull out a specific date. Heres the set up of the fields one field is full of Null values and the second field is an ID field that looks like ...
1
vote
2answers
407 views

Parse multiple field in field calculator using python

I'm trying to fill a blank field depending on the contents of three other fields using python in the field calculator. Sample code is something like: def getClass(Text1,Text2,Text3): if Text1 is ...
1
vote
1answer
30 views

XY_LINK field using Point_X & Point_Y Fields

In the below image, I am trying calculate my XY_LINK field to return the values from Point_X and Point_Y field. Example of final result: {2474785.499662}{376075.063004} My code is as follows: ...
1
vote
1answer
1k views

Extract characters from an existing string field to create a new field

I have a string field named CHESS2016_N94S_FL1_C__20160407230029.562GMT_COLOR-8-BIT.JPG and I would like to select characters 16-18 to populate a new field. I've been trying to use the field ...
1
vote
1answer
74 views

Stacked label with parentheses and exclusion

I'm doing some labeling and have my labels stacked using python by using the following: [field1] + 'n\' + [field2]. But I'd like to keep the label stacked and add parentheses to [field2] as well as ">=...
1
vote
1answer
132 views

Calculate field tool vs Field Calculator

I have successfully populated a field in Arc using the Field Calculator, however I would like to re-create this in python as part of a tool I am making. I was going to do this buy using 'Calculate ...
1
vote
1answer
82 views

failed to Writing conditional (if/then) statements into Field Calculator of ArcGIS for Desktop using Python parser?

I wrote this following several examples but it is still wrong. I need to populate a new field based on 5 ranges of values. def marks(Wards for try.JHRatio ): if (Wards for try.JHRatio <= 50)...
1
vote
1answer
63 views

Creating IDs for multiple features in Python Parser of ArcGIS Field Calculator?

Does anyone know how to create ID numbers for multiple features using python? For example; (IDs being the object ID, Name and object ID being two different fields) Names //// IDs Street 01 River ...
1
vote
2answers
749 views

Using nested If statement in Python parser of ArcGIS Field Calculator?

I'm trying to use field calculator to assign values to a new field I created. I wan't to assign the value from the first field unless that field is empty, if it is empty use field 2, if that is empty ...
1
vote
1answer
161 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
122 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
1k 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
84 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
607 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
348 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
140 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
1answer
68 views

Why does Python if/else statement only return else condition when trying to reclassify field using ArcMap field calculator?

Using arcgis v 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
0answers
31 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
0answers
71 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
84 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
50 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
90 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
90 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
44 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
69 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
40 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
63 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
65 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 ...