The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
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 ...
6
votes
2answers
5k views

Performing advanced labeling using Python in ArcMap?

I am attempting to write a Python label expression that would involve multiple label definitions. Here is what I am trying to do using ArcMap 10.1. I have a point shapefile representing Monitoring ...
4
votes
1answer
12k views

Deleting first two letters from string field usimng Python Parser of ArcGIS Field Calculator?

I'm looking for a field calculator Python statement to delete only the first two letters of string entries. For Ex: !Name!.strip([0:2]) I know this syntax is incorrect.
2
votes
1answer
2k views

Using Python if/then/else to return value from either of two fields based on value of third using ArcGIS Field Calculator?

I'm trying to avoid manually inputting Begin and End engineering station values already inputted into a seperate field. I'm dealing with(4) fields: Begin_Sta End_Sta Beg_End and Station. The ...
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 ...
14
votes
8answers
35k views

Removing return/newline (\n) character from Field using Python and Field Calculator?

I have a geodatabase table with a field that I'm trying to remove return characters (new line). I found this post (How can I remove (chomp) a newline in Python?) of how to do it, however it is not ...
3
votes
3answers
12k views

Calculating incidence angle of polyline?

How can I calculate the angle of each polyline in ArcGIS?
1
vote
2answers
1k views

Parsing field values using ArcGIS Field Calculator?

I am using 10.0 ArcView and am trying to get the "R" in R12345678910 to drop. The numbers are in a column in the attribute table and i've always used VB scripting. I was using Field Calculator.
4
votes
4answers
6k views

Concatenating numbers and adding in leading zeros?

I have three text fields populated as follows: 1, 9, 1 that I need to concatenate into a field that looks like 01.09.01. Getting to 1.9.1 is easy but can anyone help out with how to formulate it so ...
4
votes
1answer
2k views

Python syntax error from raster calculator in ArcGIS ModelBuilder?

I am experiencing a problem with the raster calculator in the ModelBuilder under ArcMap 10. I need to combine two layers: a drainage map (issued from a series of previous operations on a DEM) and ...
5
votes
2answers
572 views

FindLabel not Defined in ArcMap labeling with Python Parser?

I'm trying to make an advanced label expression using the python parser and I keep getting the following error: The expression contains an error. Modify the expression and try again. Error 0 on ...
3
votes
1answer
5k views

Receiving error 000539 from CalculateField_management?

I am trying to add (ie "Author", "LastUpdated") to feature classes within a gdb and then populate each of those fields. I have been able to get my code to run properly for the numerical field but I ...
4
votes
3answers
1k views

ArcGIS Field Calculator Python numbering rows of fishnet

I have a grid of 100*100 cells. I want to add to each cell a number representing the row it is in (like in excel). I added a field and want try to solve that with field calculator: The code is ...
7
votes
3answers
6k views

Calculating Field based on name of shapefile

I have multiple shapefiles to which I have added a field called "gname1". For each shapefile, I want "gname1" to be set to the name of that particular shapefile, for every feature within the shapefile....
7
votes
1answer
14k views

Adding automated values to attribute field?

I have parcel and buildings layers. In their attribute tables I want to replace "NULL" values with numbers from 1 to 2000, in "Parcel ID", or "Building ID" field. How can I do this in ArcGIS ...
3
votes
1answer
1k views

Field Calculate Degree Minute Second in Different Format?

I have a field that is in degree minutes seconds, populated from ET Geowizards COGO Inverse tool. It populates the values as 90-12-28.15 where 90 is the degree, 12 is the minutes and 28.15 is the ...
3
votes
2answers
722 views

Python find string with two decimal characters in ArcGIS field calculator?

I have two columns in a personal geodatabase table that I'm trying to add up (to a third field) using a python function in field calculator, however some of the string values are not real numbers. e....
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
3answers
5k views

Replacing NULL values in geodatabase table?

How do you update NULL values within a geodatabase table using the ArcGIS Field Calculator (service pack 4) without changing other values to NULL? I've tried the suggestions on this previous question:...
15
votes
7answers
9k views

Find/Replace Double Quotes using Python Parser of ArcGIS Field Calculator?

I'm trying to use the Field Calculator (ArcMap 10.0) to strip out double quotes in an address field (I didn't put them in there, believe me). I've tried many incantations but am still unable to even ...
11
votes
2answers
1k views

Computing new attribute based on changes in another attribute using ArcGIS Desktop with Python?

I am attempting to classify a set of gps time-encoded point data into behaviors based on different attributes. I have created an attribute that is 0 for home and 1 for away based on location, and ...
7
votes
2answers
3k views

Fnding wildcard string using Field Calculator script code?

I'm trying to find part of a text string in the CLASS_NAME field and return a text string to the Abrv_Name field using the Field Calculator in ArcGIS 10 via a Python parser. Here is what I have tried ...
4
votes
2answers
244 views

Updating new field from existing field using ArcGIS Desktop?

I need to update my new field/column (Property Type) with either "detached", "semi", or "terrace" depending on an existing column (Property Count): where the count = 1 I need to populate Property ...
2
votes
1answer
644 views

Debugging error 000539 from ArcGIS 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
2answers
11k views

Using conditional statements in ArcGIS Field Calculator?

I have two fields, "P_Area" and "PC_Area", whose sizes I'd like to compare in a third field, "Areas_Equal". The "Areas_Equal" field should contain a "Yes" if the other two are equal and a "No" if they ...
6
votes
2answers
19k views

Splitting string in Python parser of ArcGIS Field Calculator?

I am trying to use Python to split a string field into three new fields at the separator " - ". The field is in the format "a - b - c". So I initially had this in the field calculator for newFieldA: !...
1
vote
1answer
830 views

Null output from field calculator code block

I have a simple calculation to compare two columns and populate a new column with the lower value but I am getting null output...any ideas? expression re_score(!Signal_Strength!,!Signal_Strength_1!,...
0
votes
1answer
471 views

Error 999999 when using .isalnum in ArcGIS field calculator?

ArcGIS keeps throwing an error when I use the following script in the field calculator, using Python: pre-logic script code: y= () if !fieldx!.isalnum(): y= 1 else: y= 0 Fieldy= y The ...
9
votes
4answers
7k views

Removing numeric characters from alphanumeric value in field calculation?

I have a field containing alphanumeric values in the following format: A-AA00 Sometimes they are also A-AAA0 I need a Python script I can put in the field calculator in ArcMap 10 that will at ...
16
votes
3answers
29k views

Rounding column in attribute table using ArcGIS Field Calculator?

I want to use the Field Calculator in ArcMap to round an existing column to two decimals. Currently I have a column that is 6 decimal places long and would like to simply round it down to 2 decimals. ...
7
votes
1answer
2k views

Summing Attributes from a Related Table?

I have a line feature class representing road segments, with each road segment having a unique ID. This feature class has an attribute of average observed daily traffic counts. I have another table ...
6
votes
3answers
6k views

Doing If/Then over multiple data columns in Python Parser of ArcGIS Field Calculator?

I have some VB code saved that looks at two columns of data, and populates a third with the low value. Pre-logic Script Code: Dim output as double if [MIN_LEFT] < [MIN_RIGHT] Then output = [...
8
votes
2answers
19k views

Sorting feature class to calculate sequential ID field using ArcGIS Field Calculator?

I am in ArcMap and I want to sort the records based on a field and then do a Calculate Field with an auto-incrementing value with the sort in-place. Any ideas? It looks like I could get an update ...
12
votes
2answers
9k views

Converting from DMS to DD using Python in Field Calculator?

I need to convert lat/long that is expressed as degrees, minutes, and seconds in the data into decimal degrees. For example, in the data, they are listed as N335042.06 in the Latitude column, and ...
5
votes
1answer
5k views

Converting state name abbreviations to full names using ArcGIS Field Calculator?

I have a data table with columns that includes city names (ex: San Jose) and state name abbreviations (ex: CA). Is there a way to define the state names as their full names (i.e., CA = California) and ...
4
votes
2answers
8k views

Using nested if statements in Python Parser of ArcGIS Field Calculator?

The solution in VB for the base process is at If/then VBScript/Python code equivalent to SQL IN ('x','y',z') expression in ArcGIS Field Calculator? works great but I was trying to ...
1
vote
1answer
370 views

How to tranform a column field into a list using Field Calculator

I'm trying to make a simple field calculation with ArcGIS 9.3: New field = Old field - Old field(first value) which in Calculate Field with python code should be Expression: !Old field! - first ...
4
votes
2answers
3k views

Populating field with max M value of feature using Python in ArcGIS Field Calculator?

I need to calculate the max M value for a line feature using Python in ArcGIS 10 Field Calculator but I cannot figure it out. In 9.3 I used the follow VBA expression… **Pre-Logic VBA Script Code:** ...
6
votes
1answer
3k views

ArcMap Field Calculator syntax (again)

I'm trying to string together a field calculator script that will populate all the records of a field at once based upon values in a number of fields. I can't even get the first part of the command ...
6
votes
1answer
4k views

Using Range in Python expression of ArcGIS Field Calculator?

what is the python expression for defining a range of numbers? I have tried numerous combinations but cannot get a simple range of angles (100 -200) to compute correctly. Screen shot :
8
votes
2answers
6k views

Troubleshooting ERROR 000989 Python syntax error from ArcGIS Field Calculator?

I'm trying to used the Python syntax in ArcGIS 10's field calculator and am thoroughly confused. So far the most basic calculations are failing me, and I don't understand why. I'm trying to create a ...
2
votes
1answer
1k views

Putting multiple lines of Python into ArcGIS 10's Field Calculator

Entering these lines of Python one at a time works like a charm... Just need one more seemingly simply issue solved... How do we place multiple lines of Python code into ArcGIS's Field Calculator ...
5
votes
2answers
6k views

If/then VBScript/Python code equivalent to SQL IN ('x','y',z') expression in ArcGIS Field Calculator?

we need just like the following, only with multiple records selected... have tried the "xyz" in (1,2,3,4,5) SQL code but of course VB Script wants something else. dim f2 if [field1] = "foo" then f2 ...
3
votes
1answer
2k views

calculate value using maximum value from different feature class

I'm trying to get the maximum numeric value from one feature class and use that value in an expression to calculate values of a different feature class. fc2.bldg_id = max(fc1.bldg_id)+1 Can this ...