Adjust 3D Z (Data Management)
Summary
Allows the modification of all Z-values in a Z-enabled feature class.
Usage
-
Bathymetry data often has positive Z-values. You may wish to reverse the signs of all the data in the feature class to make the Z-values negative.
-
Z-enabled data could be referenced to a vertical datum that is not appropriate for your geoprocessing needs. This tool could apply a bulk-shift of all the Z-values in the feature class to adjust the data either up or down vertically.
-
The Convert From Units and Convert To Units parameters allow you to convert your Z-values from one common unit of measure to another.
Caution:This tool modifies the input data. See Tools with no outputs for more information and strategies to avoid undesired data changes.
Syntax
| Parameter | Explanation | Data 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.
| 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.
| String |
to_units (Optional) |
The units to convert to.
| String |
Code Sample
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")
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