Web Analytics Made Easy -
StatCounter

Node Dangles

Field Calculator

In the last week, I have looked for multi-part features a couple of times. Today, I was looking for multi-part polygons after dealing with the fall-out of a case of Clip Gone Wild as shown below. I have not found a way to write a query to find these but Field Calculator does allow you to calculate a field’s value to the number of parts. Using the Python parser, just write the formula (note that case matters): !
Seems like a lot of people are finding the ArcMap Field Calculator examples that I have posted useful so I will make an effort to post more of them. Most posts are generated after I do something and think that others might want to know how to do it. (Or so I can go back and remember how I did something without re-inventing it). Something I did today was create a field (!
You may have noticed that this post–ArcMap Field Calculator: Identifying Unique Cases, Single Field–specifies ‘Single Field’. Yes, that was my version of a cliff-hanger post. The basic structure I listed in that post can be expanded on to satisfy your needs. The example in my earlier post was case sensitive for example, you could modify it so it treats ‘a’ the same as ‘A’. Today’s example groups records into different cases based off the values of two fields, !
Apparently, if you post one time about ArcMap field calculator, you’re bound to get additional questions. After my recent post about using field calculator to convert text values to numeric, someone asked about a problem they were having with another calculation they were having. The underlying problem was that python 2.6, which is installed with ArcGIS 10, uses integer division when both the numerator and denominator are integers. The result of integer division is an integer rounded towards negative infinity.
Received a request yesterday asking how to use the ArcMap Calculator to copy values from a Text field to a Double field using python syntax. As any good blogger would do, I immediately thought, ‘Awesome! Someone’s question is the perfect topic for a new blog post’. The python parser is actually pretty good at casting values on the fly so if the values in your text field (!Day! in my example) are valid values that can be converted to a Double value, it is as simple as just setting the formula to be the text field.
One of the standards in our databases is to store dates as 8-digit integer values in the format of yyyymmdd. This requires us to occasionally convert values from date fields into this format. We can do this in the ArcMap Field Calculator using this arcpy function: def datetodouble(inNum): splitList = str(inNum).split("/") return splitList [2] +("0"+ splitList [0])[-2:] +("0"+ splitList [1])[-2:]
One of the common functions I have to do is assign each record in a feature class with a unique identifier–normally just a sequential number from 1 to N. In ArcView 3.x, the formula was simply ‘rec + 1’ if I wanted to start with the number 1. In ArcGIS, the process got a little more complex–you had to write a little VBA in Field Calculator as described by ESRI.
One of the things I had not gotten around to doing in ArcGIS 10 was figure out how to directly manipulate the geometry of a record using the Field Calculator. When I stumbled upon a bug in the way the Extract Values to Points tool handles Null geometries, I figured it was time to figure it out. Setting the X, Y to 0,0 was sufficient for my needs. I set the Parser to Python and the formula was simple once I figured out the syntax:
Menu