Add Z Information (3D Analyst)

Summary

Adds information about elevation properties of features in a Z-enabled feature class.

Each 3D shape is examined and the selected properties are appended to the attribute table of the input feature class. The output options vary based on the feature's geometry.

Usage

Syntax

AddZInformation_3d (in_feature_class, out_property, {noise_filtering})
ParameterExplanationData Type
in_feature_class

The input feature class.

Feature Layer
out_property
[out_property,...]

The output Z properties that will be added to the attribute table of the input feature class. The following options are available:

  • ZThe elevation of each single-point feature.
  • POINT_COUNTThe number of points in each multipoint array.
  • Z_MINThe lowest elevation found in each multipoint, polyline, polygon, or multipatch feature.
  • Z_MAXThe highest elevation found in each multipoint, polyline, polygon, or multipatch feature.
  • Z_MEANThe average elevation found in each multipoint, polyline, polygon, or multipatch feature.
  • LENGTH_3DThe 3-dimensional length of each polyline or polygon feature.
  • VERTEX_COUNTThe total number of vertices in each polyline or polygon feature.
  • MIN_SLOPEThe lowest slope value calculated for each polyline, polygon, or multipatch feature.
  • MAX_SLOPEThe highest slope value calculated for each polyline, polygon, or multipatch feature.
  • AVG_SLOPEThe average slope value calculated for each polyline, polygon, or multipatch feature.
  • VOLUMEThe volume determined for each closed multipatch feature.
String
noise_filtering
(Optional)

Provides the option to exclude small portions of features from statistical calculations. This option is useful for obtaining good maximum slope estimates, as small portions often exhibit extreme slopes, which may bias the statistical results.

The values given in either the Area or Length options will be used to exclude these portions of features. This parameter does not apply to point and multipoint features.

  • NO_FILTERNo noise filter will be used. This is the default.
  • AREA <…>An area filter will be applied to portions of features in multipatch feature classes. An AREA value of 0.001 indicates that subparts of multipatches with an area less than 0.001 will be ignored.
  • LENGTH <…> A length filter will be applied to portions of features in a line or polygon feature class. A LENGTH value of 0.001 indicates that portions of features with a length less than 0.001 will be ignored.
String

Code Sample

AddZInformation example 1 (Python window)

The following sample demonstrates the use of this tool in the Python window:

import arcpy
from arcpy import env

arcpy.CheckOutExtension('3D')
env.workspace = 'C:/data'
arcpy.AddZInformation_3d('lines_3D.shp', 'Z_MEAN; LENGTH_3D; AVG_SLOPE', 
                        'NO_FILTER')
AddZInformation example 2 (stand-alone script)

The following sample demonstrates the use of this tool in a stand-alone Python script:

'''******************************************************************
Name: AddZInformation Example
Description: This script demonstrates AddZInformation on all 
             z-aware features in a target workspace.
******************************************************************'''
# Import system modules
import arcpy
import exceptions, sys, traceback
from arcpy import env

try:
    arcpy.CheckOutExtension('3D')
    # Set environment settings
    env.workspace = 'C:/data'
    # Create list of feature classes
    fcList = arcpy.ListFeatureClasses()
    if fcList:
        for fc in fcList:
            desc = arcpy.Describe(fc)
            if desc.hasZ:
                # Set Local Variables
                noise = 'No_Filter'
                if desc.shapeType == 'Polygon':
                    Prop = ['Z_MIN', 'Z_MAX', 'VERTEX_COUNT']
                elif desc.shapeType == 'Point':
                    Prop = 'Z'
                elif desc.shapeType == 'Multipoint':
                    Prop = ['Z_MIN', 'Z_MAX', 'Z_MEAN']
                elif desc.shapeType == 'Polyline':
                    Prop = 'LENGTH_3D'
                print 'Completed adding Z information.'
                # Execute AddZInformation
                arcpy.AddZInformation_3d(inFC, Prop, noise)
    arcpy.CheckInExtension('3D')
except arcpy.ExecuteError:
    print arcpy.GetMessages()
except:
    # Get the traceback object
    tb = sys.exc_info()[2]
    tbinfo = traceback.format_tb(tb)[0]
    # Concatenate error information into message string
    pymsg = 'PYTHON ERRORS:\nTraceback info:\n{0}\nError Info:\n{1}'\
          .format(tbinfo, str(sys.exc_info()[1]))
    msgs = 'ArcPy ERRORS:\n {0}\n'.format(arcpy.GetMessages(2))
    # Return python error messages for script tool or Python Window
    arcpy.AddError(pymsg)
    arcpy.AddError(msgs)

Environments

Related Topics

Licensing Information

ArcView: Requires 3D Analyst
ArcEditor: Requires 3D Analyst
ArcInfo: Requires 3D Analyst

6/10/2013