![]() I feel like there's probably a better way to create/access the geometries object rather than CopyFeatures, but that's for another day. Multiple features selected: geometries = arcpy.CopyFeatures_management("YOUR_LAYER",arcpy.Geometry()) Print geometries.getArea("GEODESIC","ACRES") Single feature selected: geometries = arcpy.CopyFeatures_management("YOUR_LAYER",arcpy.Geometry()) For example, you can write the following: UPDATE: If you want a quick-and-dirty solution, you can also use the arcpy Geometry object, and get the Area using the getArea method of the Geometry object within the ArcGIS Python window. If you really wanted to get fancy (and have one-size-fits-all reusable code), you could even write the function to accept an option for output units, and then have a whole bunch of conversion routines that could be called for various Rows = arcpy.SearchCursor(OriginalPolygon) Units = arcpy.Describe(OriginalPolygon).spatialReference.linearUnitName # Get the units Video 130In this video, you will see how to extract geometry properties from your features and store them in your layer.Using 'Calculate Geometry' in the At. So you could just add the following into your code (amending your code from above). And if you find that you need to add another conversion, you just add one more conversion line to it. ShapeName = arcpy.Describe(OriginalPolygon).shapeFieldNameĪs stated, in lieu of an ESRI provided solution, it's pretty easy to just write a function that will calculate acres for units of your datasource. ![]() Click the geometric property you want to. Optionally, you can press CTRL+SHIFT+G to open the Calculate Geometry dialog box. Right-click the field heading for which you want to make a calculation and click Calculate Geometry. You can only perform geometric calculations on attribute tables. As you mentioned Joshua Bixby the docuemnt for ArcGIS 10.6 should not exist. Right-click the layer and click Open Attribute Table. So: Is there any way to calculate geometry in such a way that the value is only a numerical output that I can display as the script runs, or am I stuck with making an attribute field, calculating geometry, reading the field value to tell the user, and then deleting the field? rows = arcpy.SearchCursor(OriginalPolygon) They have had a bug logged to remove the documentation of this bug, its details are below: BUG-000119004: For ArcMap 10.6- remove Calculate Geometry Attributes GP tool documentation from the overview of the Features toolset web page. This question implies that unless I'm actually calculating geometry, the units of the shape area measurement are tied to the projection and therefore fixed. If I was calculating geometry to store in a field, then I could use - but I don't need this stored as an attribute, I just need it as a temporary variable to tell the user. But, I'd like it in acres regardless of the original units of the polygon.(Data is coming into this script in a range of projections, but we're always interested in "acreage.") Give it a try or export the script from the toolbox and modify.I am trying to find the area of a particular polygon ( OriginalPolygon, below), and I can do that.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |