Adjust 3D Z (Data Management)

Summary

Allows the modification of all Z-values in a Z-enabled feature class.

Usage

Syntax

Adjust3DZ_management (in_features, {reverse_sign}, {adjust_value}, {from_units}, {to_units})
ParameterExplanationData Type
in_features

The input feature class containing Z-values in the SHAPE field.

Feature Layer
reverse_sign
(Optional)

Flips the sign of all the Z-values in the feature class.

  • REVERSEReverse (negate) the Z-values.
  • NO_REVERSEDo not reverse (negate) the Z-values.
String
adjust_value
(Optional)

A value to apply to all Z-values. To decrease the Z-values for the entire feature class, enter a negative number. To increase, enter a positive value.

Double
from_units
(Optional)

The existing units of the Z-values. This parameter is used in conjunction with the Convert To Units parameter.

  • MILIMETERS
  • CENTIMETERS
  • METERS
  • INCHES
  • FEET
  • YARDS
  • FATHOMS
String
to_units
(Optional)

The units to convert to.

  • MILIMETERS
  • CENTIMETERS
  • METERS
  • INCHES
  • FEET
  • YARDS
  • FATHOMS
String

Code Sample

Adjust3DZ Example 1 (Python window)

The following Python Window script demonstrates how to use the Adjust3DZ function in immediate mode.

import arcpy
from arcpy import env

arcpy.CheckOutExtension("3D")
env.workspace = "C:/data"
arcpy.Adjust3DZ_management("subsurface_pts.shp", "REVERSE", 0, "METERS", "FEET")
Adjust3DZ Example 2 (stand-alone script)

The following Python script demonstrates how to use the Adjust3DZ function in a stand-alone script.

# Name:         Adjust3DZ Example
# Description:  The following stand-alone script demonstrates how to use the
#   Adjust3DZ tool to modify the z-values of points, lines, and
#   polygons in the specified workspace.
# Requirements: 3D Analyst extension
# Author: ESRI

# Import system modules
import arcpy
from arcpy import env

# Obtain a license for the 3D Analyst extension
arcpy.CheckOutExtension("3D")

# Set environment settings
env.workspace = "C:/data"

try:
    # Create a list of feature classes in the workspace
    fcList = arcpy.ListFeatureClasses()
    # Determine if the list contains any feature classes
    if len(fcList) > 0:
        # Loop through each feature class
        for fc in fcList:
            # Describe the feature class
            desc = arcpy.Describe(fc)
            # Evaluate if the feature class is z-aware
            if desc.hasZ is True:
                # Evaluate the geometry of the feature
                # Convert polyline z values from meters to feet
                if desc.shapeType is "Polyline":
                    # Set Local Variables
                    rev = "NO_REVERSE"
                    startUnits = "Meters"
                    endUnits = "Feet"
                    arcpy.AddMessage("Converting units of " + fc + " from meters to feet.")
                    #Execute Adjust3DZ
                    arcpy.Adjust3DZ_management(fc, 0, startUnits, endUnits)
                # Shift polygon z-values by a value of 3
                if desc.shapeType is "Polygon":
                    # Set Local Variables
                    rev = "NO_REVERSE"
                    arcpy.AddMessage("Shifting the z-value of " + fc +".")
                    #Execute Adjust3DZ
                    arcpy.Adjust3DZ_management(fc, rev)
            del desc, rev
    else:
        arcpy.AddMessage("There are no feature classes in the workspace.")
    del fcList
except Exception as e:
    # Returns any other error messages
    print e.message

del arcpy

Environments

Related Topics

Licensing Information

ArcView: Yes
ArcEditor: Yes
ArcInfo: Yes

10/27/2014