Click the geometric property you want to calculate.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. Right-click the layer and click Open Attribute Table.You can make calculations without being in an editing session however, in that case, there is no way to undo the results. For more information on z-values and feature geometry types, see Feature class basics. If the data does not have a vertical coordinate system defined, the units are listed as unknown. The units listed for z and 3D calculations are planar (miles, meters, and so on) as long as a vertical coordinate system has been defined for the layer. Z-coordinate values and 3D measurements can be calculated regardless of the chosen coordinate system. You can only calculate z-coordinate values or 3D measurements if the feature is z aware. You can use the Calculate Geometry dialog box to update the area, length, or perimeter of shapefile features, since these properties are not automatically updated when you edit features in shapefiles. If you want to calculate Xmin, Xmax, Ymin, or Ymax, you can do so using Python with the field calculator see Calculate Field examples. It is recommended that an equal-area projection be used when calculating areas. If the coordinate system of the data source and data frame are not the same, you may get a different result if you calculate geometry using the data frame's coordinate system than when you calculate using the data source's coordinate system. Keep in mind that different projections have different spatial properties and distortions. You can only calculate the area, length, or perimeter of features if the coordinate system being used is projected. The tool can calculate coordinate values, lengths, and areas, depending on the geometry of the input layer. The Calculate Geometry tool allows you to access the geometry of the features in a layer. It looks like the Add Geometry Attributes expects a different input. The indentation level (two spaces or four spaces) does not matter as long as it is consistent throughout the code block.Calculating area, length, and other geometric properties arcpy CalculateGeometryAttributes and AddGeometryAttributes returning OSError: 'data' does not exist. In Python, proper indentation is part of the syntax. Stop, close, restart AND try on another file. It handles adding the fields, in case there is some issue there. carefully selecting the things your want including you length, area units and the coordinate system. See examples of using the Data Type parameter. Add Geometry AttributesData Management toolbox Documentation. For example, if you use this tool to calculate a distance for use as input to the Buffer Distance parameter of the Buffer tool, specify Linear Unit for the Data Type parameter value. The Data Type parameter is used in ModelBuilder to help chain the output of this tool with other tools. See examples of using the Code Block parameter. To do this, create a function definition in the Code Block parameter and reference the definition in the Expression parameter. These variables must be passed to the code block from the expression. You cannot access model variables in the Code Block parameter. To use a Python function in an expression, double-click a function in the Functions list to add it to the Expression parameter. To use a variable in the expression, enclose the variable name in percent signs (%) or double-click the variable name in the Variables list to add it to the Expression parameter. Variables created in ModelBuilder can be used by this tool, but they cannot be used directly in the Expression parameter. See examples of using the Expression parameter. The Code Block parameter cannot be used on its own it must be used in conjunction with the Expression parameter. If this is not what you want, maybe try Calculate Field with the shape field. Only the selected features will have values calculated in the added fields all other features will have null values. I dont think you need it for calculate field. Use the Code Block parameter for more complicated expressions, such as multiline calculations or logical operations (if, then). Test without the Editor first in case it just works. Use the Expression parameter for short one line expressions. Other scripting languages are not supported. The Expression parameter only supports Python expressions. 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. The tool is not available from the Geoprocessing pane or from Python. This tool is only available from the ModelBuilder ribbon for use in models.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |