Interpolate Shape (3D Analyst)
Resumen
Interpolates z-values for a feature class based on elevation derived from a raster, triangulated irregular network (TIN), or terrain dataset.
Ilustración
Uso
-
When using the natural neighbors interpolation option, make sure to specify a reasonable sample distance. This usually falls between 0.5 and 1.0 times the average point spacing of the data used to build the TIN or terrain dataset.
-
When using the Interpolate Vertices Only option, input features with vertices that fall outside the data area of the surface will be ignored and not output. Clip features prior to running Interpolate Shape to ensure the features are completely on the surface.
The Z factor parameter only affects results for rasters and TINs, not terrain datasets. To apply a z factor to features made from a terrain dataset use the Adjust 3D Z tool.
Sintaxis
Parámetro | Explicación | Tipo de datos |
in_surface |
The raster, TIN, or terrain surface used for interpolating z-values. | Raster Layer; Terrain Layer; TIN Layer |
in_feature_class |
The input feature class. | Feature Layer |
out_feature_class |
The output feature class. | Feature Class |
sample_distance (Opcional) |
The spacing at which z-values will be interpolated. By default, this is a raster's cell size or a TIN's natural densification. | Double |
z_factor (Opcional) |
The factor by which elevation values will be multiplied. This is typically used to convert Z linear units that match those of the XY linear units. The default is 1, which leaves elevation values unchanged. | Double |
method (Opcional) |
Interpolation method used to determine elevation values for the output features. The available options depend on the surface type being used. BILINEAR interpolation is available for a raster surface, where a query point obtains its elevation from the values found in the four nearest cells. Terrain and TIN datasets provide the following options:
| String |
vertices_only (Opcional) |
Specifies whether the interpolation will only occur along the vertices of an input feature, thereby ignoring the sample distance option.
| Boolean |
pyramid_level_resolution (Opcional) |
The z-tolerance or window size resolution of the terrain pyramid level that will be used by this tool. The default is 0, or full resolution. | Double |
Ejemplo de código
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.InterpolateShape_3d("my_tin", "roads.shp", "roads_interp.shp")
The following sample demonstrates the use of this tool in a stand-alone Python script:
'''********************************************************************* Name: InterpolateShape Example Description: This script demonstrates how to use InterpolateShape on all 2D features in a target workspace. *********************************************************************''' # Import system modules import arcpy from arcpy import env import exceptions, sys, traceback # Set local variables inWorkspace = arcpy.GetParameterAsText(0) surface = arcpy.GetParameterAsText(1) try: arcpy.CheckOutExtension("3D") # Set default workspace env.workspace = inWorkspace # Create list of feature classes in target workspace fcList = arcpy.ListFeatureClasses() if fcList: for fc in fcList: desc = arcpy.Describe(fc) # Find 2D features if not desc.hasZ: # Set Local Variables outFC = "{0}_3D.shp".format(desc.basename) method = "BILINEAR" # Execute InterpolateShape arcpy.ddd.InterpolateShape(surface, fc, outFC, 10, 1, method, True) else: print "{0} is not a 2D feature.".format(fc) else: print "No feature classes were found in {0}.".format(env.workspace) 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)