3
votes
3answers
28 views

Calculate field using variables as fields

When I calculate a field like this: field_0="field_name0" arcpy.CalculateField_management("Layer", field_0, '!field_name1! / !field_name2!', "PYTHON_9.3") It works! The field "field_name0" in the ...
0
votes
1answer
31 views

Painfully slow performance with Join and Calculate Field

I have a point layer and a table with approximately 100 fields. I need to join the table to the point layer based on a key field and create a new shapefile / feature class. This script has been ...
1
vote
2answers
131 views

Calculate Fields with Null Values using arcpy.da.UpdateCursor of ArcGIS for Desktop?

How do you calculate fields with null values? I have multiple fields that may have null values, that aren't being calculated in the third field. import arcpy with ...
7
votes
1answer
94 views

Meaning of exclamation mark in Python parser of ArcGIS Field Calculator?

In the following line, I don't understand what those exclamation marks mean? And why put everything in quotation? I don't understand the purpose of the variable expression, please explain to me as I'm ...
1
vote
2answers
85 views

Concatenating text and string in Field Calculator expression (python)

I'm trying to copy an attribute value from one field to another (sum of raster values), but I'm having issues in writing a functioning expression for a Calculate Field script. I'm adding a field ...
1
vote
1answer
62 views

Calculation of a text value, The value of which is separated by a special character

How can I calculate a text value, the value of which is separated by a special character? For example: dog | duck, I would like to keep the first value: dog or elephant | cat, I want to keep ...
2
votes
1answer
155 views

Python Syntax Error when running Python Snippet of successful geoprocess

I am having an issue with a simple python snippet. Here's the background: I wanted to include an additional step in a nightly update script that replaces characters in a field that simply do not play ...
1
vote
0answers
71 views

Cause of Field Calculator UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 5: ordinal not in range(128)? [closed]

def Befahrung(value1,value2): if value1 is ' ': return ' ' else: return "G:\\Example\\" + str(value1) + "\\File_" + str(value2) + ".pdf" I try to create a field with a hyperlink. It works ...
2
votes
1answer
61 views

Problem with Python codeblock recognizing a field

'<'First Post Alert> I've been through multiple iterations / gyrations, and while there may be multiple problems here (and I'll appreciate feedback on all of them), the recurring issue is that the ...
3
votes
2answers
102 views

Calculate Field Syntax: If statement over many fields

Apologies if this has already being asked but I couldn't find a page pointing to this problem. I'm struggling with the python syntax in the Calculate Field so that, in the table above: if b, c, d, ...
4
votes
1answer
115 views

How to SUM field and then insert into NULL column?

I am only in the beginning stages of learning Python. I have a column, 'QUANTITY_SOLID', that I want to take the sum of all of its rows. I understand I can do this with 'SUMMARY_STATISTICS', but i'm ...
2
votes
2answers
77 views

Call field from zip() into Field Calculator expression ArcGIS

I've been trying to find a way to call in field names from a zip(). Basically I have 12 fields called "Flw_days1", "Flw_days2" etc and corresponding "Depth" fields that need to be calculated using the ...
2
votes
1answer
1k views

Getting ValueError: max() arg is an empty sequence on a Python Script in the Field Calculator in ArcMap

I have a script that populates a FacilityID Field on a Attribute table in the Field Calculator but when I run the script below I am getting a error. EDIT: Python Script: def autoInc(): import ...
2
votes
1answer
177 views

ESRI File Geodatabase with a field calculator with an incrementing number

I've got a python script that runs on the Field Calculator of a ESRI File Database. Right now it runs correctly in that it will increment the last three digits of the value. But this is a script ...
1
vote
1answer
101 views

Error when dividing a field with a number

Using arcpy CalculateField_management i want to divide a field with a spacific number: arcpy.CalculateField_management(EZG_shp, "IDX_AT_PK", "(!EURO_SUM!/!Anz_Pers!)/1668,4","PYTHON") This works in ...
0
votes
2answers
546 views

ArcGis Python Script, Calculate Field

Sorry for my English. I am trying to write a Python Script for ArcGis 10.2. #import system modules import arcpy import math from arcpy import env #Set environment options ...
1
vote
1answer
142 views

How to create sequential field based on sorted data? (or extract pop-up data?)

I downloaded a kmz field and converted it to a GDB fc on arcmap. However, the field I need to label the layer by is stored in the pop-up html field... It looks like this: <html ...
2
votes
2answers
98 views

python add fields that may have NULL values

I would like to use python to calculate a field (short integer) using other fields (short integer) present in the table. In some cases these fields may have NULL values for one or more of the fields. ...
3
votes
3answers
1k views

Calculating X and Y of line start and line end using ArcPy?

I have a series of polyline shapefiles and I am trying to automate the process of calculating the X and Y coordinates of the line start and line end using Python. I have added the 4 fields (startx, ...
2
votes
1answer
67 views

Arcpy Calculate Field Formatting Syntax

I am trying to field calculate a double field (PID) to a new string field (PIN). Using: qry = '"139-{}".format(!PID!)' arcpy.CalculateField_management(out, "PIN", qry, "PYTHON") Given a PID = ...
1
vote
2answers
109 views

Calculate field based on most frequently occuring text/value in other fields in attribute table (ArcGIS)

I was wondering if anyone knows if it is possible to calculate a field based on the most frequently occurring value in other fields. What I have is 5 fields with crop information over 5 consecutive ...
2
votes
1answer
263 views

How to copy values from field to another using arcpy?

Can some one please let me know how I can do simple field calculation like Copying From "A" to "B" in ArcPy? I have found lots os example on web which they all used extra expression and they were ...
3
votes
3answers
427 views

How to create button that calculates acres on selected polygon features?

I'm looking to create a simple button that calculates acres on selected polygons and can't quite find what I'm looking for. I read through this thread: automating a python script..., but found it ...
1
vote
1answer
179 views

Cursor Update Python Script for Multiplying Several Fields against a Ratio (Real) in ArcGis

Disclaimer: Python Neophyte, Uber-reliant on GUI, working to wean... I have a Python script for replacing multiple Field values with another table value that was graciously provided by the inimitable ...
2
votes
3answers
95 views

How to write FIDs of points within each polygon to polygon field?

I have two feature classes one with points one with polygons (in ArcGis 10.2). Now, I want to write into a String Field of the polygon layer a list of all the Point-FIDs that are within each polygon ...
0
votes
1answer
225 views

Arcpy CalculateField using formatting syntax

I have 2 feature classes (FC) that I am merging together and then performing some field calculations on. The 1st FC has 100k+ records in it, and the second FC is a blank FC that I'm using as a ...
1
vote
1answer
254 views

Python Field Calc for Document Hyperlink

I am trying to create a script that will hyperlink to a .tiff or .pdf. These files are stored in one folder on a shared server. I want the script to look in a field: 'PLAT_IMAGE', which has the plat ...
2
votes
1answer
348 views

Generating sequential numbering for duplicate values in a field sorted by ObjectID

I am trying to figure out a solution to an field calculation problem. What I'm trying to do is automatically (using either ArcPy or the Field Calculator) generate sequential numbers, beginning at 1, ...
1
vote
1answer
171 views

Stuck updating one field based on the condition of another using Acrpy or Field Calculator

I have a shapefile with 5,000 city points. I need to populate a new field, "cls_pop", based on each cities population, so that cities with a population > 2,000,000 will have "cls_pop" = 1, cites with ...
0
votes
1answer
207 views

Python: using CalculateField_management for duplicating attributes with a double quotation mark

I am writing a python script which duplicates a field. The field contains names of pipelines but some of these names has double quotation (ex. 8" NGL PIPELINE). I have created a new field and trying ...
2
votes
1answer
150 views

Using Sum() or something similar with CalculateField_management and FieldLists

I need some help with using variables with CalculateField_management tool. I've tried several different scenarios but don't seem to have any luck. What I have is a list of fields containing water ...
2
votes
1answer
182 views

Using update cursor on a field with a domain

I have been replacing field calculations with python update cursors in many of my work flows and today I ran into a problem. The fields being updated have an attribute domain. so now, when I ...
0
votes
3answers
286 views

Why does CalculateField set values to <Null> when output extent is in a different coordinate system?

I'm quite new to ArcGIS, and now I have to work on a script that goes through a list of feature classes to: add a field to their attribute table and fill that field with a number that I retrieve ...
0
votes
1answer
119 views

Trying (+ failing) to use a Function in Field Calculator

I'm trying to populate a field using a function. When I run this in Pyscripter, it works fine: d = {} # Function # def find_dups(val): d[val] = d.setdefault(val, -1) + 1 return d[val] # ...
1
vote
2answers
422 views

ArcPy Field Calculation with special characters

I'm trying to calculate a string field, using "┬ÁSv/h". Running this in the manual field calculator works just fine, but I've tried this in the Python window in ArcMap as well as the IDLE, but both ...
0
votes
0answers
211 views

python script to calculate and return values based on several conditions

I need to calculate and return the value "continuous" to those records in a polygon feature class with species records aggregated to a UTM grid considering the attributes are species name, grid code, ...
2
votes
1answer
262 views

Calculate field result is float with Arc tool, integer with arcpy script

I am trying to calculate a field for some points within a python script using arcpy functions. (This is calculating the percentage visibility from a cumulative viewshed, if that matters.) # Process: ...
0
votes
1answer
723 views

How to use VBA in the field calculator, to copy the last 7 characters to a new field?

Im using ArcMap 9.3. Im looking for a VBA code to use in the field calculator to make a new field of the last 7 digits of a "pin" field. For example. my pin is 00-00-999-999 and i want it to ...
4
votes
1answer
688 views

Why can't I multiply two string fields in the Field Calculator by converting them to int() and float()

I'm using ArcGIS 10 and new at python scripting. I have a string field that I need to calculate by multiplying two other string fields. I can do it in python using two arbitrary values... CINPT1 = ...
1
vote
1answer
467 views

How to calculate field as cursor name?

First time dealing with cursor. I have lines intersecting polygons, I want to get a table with all attributes of the lines, add a field and calculate the field as the name of the polygon. I was able ...
2
votes
1answer
415 views

Field Calculator Runs In IDLE (2.6.5) but not ArcGIS 10 SP3

just wondering if anyone else is having issues with the field calculator in ArcGIS 10 SP3. In the following code I do a pretty simple field calculation with a variable (an array) as one of the ...
4
votes
2answers
1k views

Field calculation- Arcpy

I am developing a script to calculate the values of two fields (C and D) based on value of field A (It is a Point feature): A C D 0.2 1 1 0.2 1 2 0.2 1 3 0.4 2 1 0.5 3 1 0.5 3 2 So the idea is n ...
1
vote
1answer
230 views

Small issue with field calculator

What am I doing wrong in this field calculator logic? Pre-logic def re_score(elev_t,f2, contour): f2=contour if elev_t.endswith('.5'): f2 = "Midi" return f2 Expression for field "Contourtyp" ...
4
votes
1answer
587 views

Iterative position within Field Calculator/Python

I'm not great with Python or programming in general, so I'm not even sure how to ask this question. Basically what I've got is in the left column, and what I want is in the right column. UniqueID ...
4
votes
2answers
1k views

arcpy: check for same record in cell above and below

After using the find duplicates in arcmap 10, I want to check if the feat sequence ("find duplicates" marks all records with the same attributes with the same number [in "feat_seq"] and creates a ...
6
votes
1answer
1k views

Get shape filename in attribute field using field calculator

I apologize for crossposting against the ESRI geoprocessing forum, but it seems like this one gets answers. I'd like to have a modified append tool (ArcToolbox) that takes multiple shapefiles with ...
4
votes
3answers
4k views

ArcGIS 10/arcpy: Help needed with syntax for CalculateField_management in Python script

I need to use CalculateField_management in a Python script, and the calc expression needs to concatenate a runtime variable, a string, and a field (string) value. I have searched all over for ...