Resumen
Creates a raster object for contour lines by joining points with the same value from a raster dataset. The contours are isolines created as rasters for visualization.
Debate
For more information about how this function works, see the Contour raster function.
The referenced raster dataset for the raster object is temporary. To make it permanent, you can call the raster object's save method.
Sintaxis
Contour (raster, {adaptive_smoothing}, {contour_type}, {z_base}, {number_of_contours}, {contour_interval}, {nth_contour_line_in_bold}, {z_factor})
Parámetro | Explicación | Tipo de datos |
raster | The input raster. | Raster |
adaptive_smoothing | The amount of smoothing to apply to the contour line. A lower value produces a contour line with more granularity and less smoothing, while a higher value produces a contour line with more smoothing that appears less jagged. (El valor predeterminado es 2.5) | Double |
contour_type | The type of contour to be created.
(El valor predeterminado es contour lines) | String |
z_base | The base contour value. Contours are generated above and below this value as needed to cover the entire value range of the input raster. A value of 0 often represents mean sea level, depending on the source elevation dataset. (El valor predeterminado es 0) | Double |
number_of_contours | The number of contours to be generated. This dynamically adjusts the contour interval to fit the terrain in the display while maintaining standardized intervals such as 1, 5, 10, and so on. (El valor predeterminado es 0) | Integer |
contour_interval | The difference in altitude between contour lines. A small contour interval is used in relatively flat areas, while larger contour intervals are used in variable or mountainous terrain. (El valor predeterminado es 100) | Double |
nth_contour_line_in_bold | The index contour, which is represented as a bold line. (El valor predeterminado es 5) | Integer |
z_factor | The z-factor is a scaling factor used to convert the elevation values for the following purposes:
If the x,y units and z units are in the same units of measure, the z-factor should be set to 1. The z-values of the input surface are multiplied by the z-factor when calculating the final output surface. (El valor predeterminado es 1) | Double |
Tipo de datos | Explicación |
Raster | The output raster. |
Muestra de código
This example creates the contours for a given dataset.
from arcpy.ia import *
out_contour_raster = Contour("contour_input.tif", "", "smooth surface only", "", "", 150, 10, 2)
out_contour_raster.save("C:/arcpyexamples/outputs/contour_surface.tif")
This example creates the contours for a given dataset.
# Import system modules
import arcpy
from arcpy.ia import *
# Set the analysis environments
arcpy.env.workspace = "C:/arcpyExamples/data"
# Set the local variables
in_raster = "contour_input.tif"
# Execute Contour function
out_contour_raster = Contour(in_raster, 3, "contour fill", 10, 20, 10, 3)
# Save the output
out_contour_raster.save("C:/arcpyExamples/outputs/contour_fill.tif")