Richard:
Do you know the syntax to calculate area in Square Miles? Thanks in advance for your time...
Mark
In the Calculate Field tool, use the following python expression.def find(shape): point = shape.getPart(0) return point.Xfind(!Shape!)
(sub point.Y to get the Y coordinates)
!SHAPE.AREA@SQUAREMILES!
Here is the help topic I am consulting on the topic: Using the Calculate Field tool
I'm trying to use the Calculate Field tool to calculate the 3D Length of an interpolated line and I can't seem to figure out the correct syntax for the expression. I've tried !shape.3Dlength@miles!, !shape.length3D@miles!, !shape.3D_length@miles!, and !shape.3D length@miles! but I keep getting an error. Any thoughts?
I think 3D length is not supported using the field calculator (at least not this syntax). The only listed defined keywords for the shape components are: type, extent, centroid, firstPoint, lastPoint, area, length, isMultipart, and partCount.
I believe you are limited to using the LENGTH_3D option of the Add Z Information tool. Then you would have to apply a unit conversion from your base units to miles.
No guarantee this will work, but since the 3D Analyst tool uses the term LENGTH_3D as the keyword and I don't see that variant listed above, you could try: !shape.length_3D@miles!
On the same field (Double) of a shapefile, I used both the Calculate Geometry (in attribute table) and Calculate Field (in Model Builder) using the !shape.area@acres! to calculate Acres. The goal is to have Acres calculated within a model. My question is, why would I get slightly different results when using the two methods?
Using Field Calculator (in attribute table) and Calculate Field (in Model Builder):
[ATTACH=CONFIG]32745[/ATTACH]
Using Calculate Geometry (in attribute table):
[ATTACH=CONFIG]32746[/ATTACH]
I know the difference is small but it's still a difference that makes me wonder which is correct.
I'm using ArcMap version 10.2.0.3348 64-bit on Windows 8, in case that helps.
Thank you in advance for any knowledge you share!
-Carol
It could have to do with any number of factors. ArcObjects (Geometry Calculator) and Python (Field Calculator) may handle geometry differently, although I would consider that a better candidate if this was a geodatabase with true curves rather than a shapefile with densified curves. The Spatial Reference may be accessed differently by the two methods. Are you sure your data frame is using the coordinate system of the polygons you are calculating for the Geometry Calculator? You could also try specifying the coordinate system explicitly in the environment setting of the Field Calculator tool to see if that made any difference.
It is a black box, so no one but the programmers involved could say for sure how the calculation processes differ and what factors could produce the results you are seeing. Most likely both results are correct according to the method applied. Insufficient information exists to determine which method you would prefer to apply or how to remove the discrepancy in the methods.