Feature To 3D By Attribute (3D Analyst)
Summary
Creates 3D features using height values derived from the attribute of the input features.
Usage
-
Supports points, multipoints, lines, and polygon geometries.
-
Each feature's elevation will be derived from the value obtained in the specified height field.
-
Line features can optionally provide a second height field. Using two height fields will result in each line feature starting from the Z-value obtained in the first height field and ending at the Z-value from the second height field. The heights for any intermediate vertices will be interpolated based on the slope of the line between the two endpoints.
Syntax
Parameter | Explanation | Data Type |
in_features |
The features that will be used to create 3D features. | Feature Layer |
out_feature_class |
The output feature class. | Feature Class |
height_field |
The field whose values will define the height of the resulting 3D features. | Field |
to_height_field (Optional) |
An optional second height field used for lines. When using two height fields, each line will start at the first height and end at the second (sloped). | Field |
Code Sample
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.FeatureTo3DByAttribute_3d('Points2D.shp', 'Points3D.shp', 'Elevation')
The following sample demonstrates the use of this tool in a stand-alone Python script:
'''**************************************************************************** Name: FeatureTo3DByAttribute Example Description: This script demonstrates how to use the FeatureTo3DByAttribute tool. ****************************************************************************''' # Import system modules import arcpy import exceptions, sys, traceback from arcpy import env try: # Obtain a license for the ArcGIS 3D Analyst extension arcpy.CheckOutExtension('3D') # Set environment settings env.workspace = 'C:/data' # Set Local Variables InFC = 'Points_2D.shp' Height_Field = 'POPULATION' # Ensure output has unique name OutFC = arcpy.CreateUniqueName('Points_3D.shp') # Execute ConstructSightLines arcpy.FeatureTo3DByAttribute_3d(InFC, OutFC, Height_Field) 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)