Build Pyramids And Statistics (Data Management)
Summary
Traverses a folder structure, building pyramids and calculating statistics for all the raster datasets it contains. It can also build pyramids and calculate statistics for all the items in a raster catalog or mosaic dataset.
Usage
-
Building pyramids improves the display performance of raster datasets.
-
Calculating statistics allows ArcGIS applications to properly stretch and symbolize raster data for display.
-
All supported raster formats will be processed.
-
Raster catalogs and mosaic datasets must be specified as the input workspace. If the workspace includes a raster catalog or mosaic dataset, then these items will not be included when the tool runs.
-
It does not calculate statistics on the mosaic dataset itself, just the rasters contained within. To calculate statistics on the mosaic dataset, use the Calculate Statistics tool.
-
Wavelet compressed raster datasets, such as ECW, and MrSID, do not need to have pyramids built. These formats have internal pyramids that are created upon encoding.
-
Skip factors and pyramid resampling can be set in the geoprocessing environment Raster Storage Settings.
Syntax
Parameter | Explanation | Data Type |
in_workspace |
The workspace that contains all the raster datasets to be processed. Raster catalogs and mosaic datasets must be specified as the input workspace. If the workspace includes a raster catalog or mosaic dataset, then these items will not be included when the tool runs. | Mosaic Dataset; Raster Catalog Layer; Raster Dataset; Workspace |
include_subdirectories (Optional) |
Specify whether to include subdirectories.
Raster catalogs and mosaic datasets must be specified as the input workspace. If the workspace includes a raster catalog or mosaic dataset, then these items will not be included when the tool runs. | Boolean |
build_pyramids (Optional) |
Specify whether to build pyramids.
| Boolean |
calculate_statistics (Optional) |
Specify whether to calculate statistics.
| Boolean |
build_on_source (Optional) | Specify whether to build pyramids and calculate statistics on the source raster datasets or calculate statistics on the raster items in a mosaic dataset. This option only applies to mosaic datasets.
| Boolean |
Code Sample
This is a Python sample for the BuildPyramidsandStatistics tool.
import arcpy from arcpy import env env.workspace = "c:/data" arcpy.env.pyramid = "PYRAMIDS 3 BILINEAR JPEG" arcpy.env.rasterStatistics = "STATISTICS 4 6 (0)" arcpy.BuildPyramidsAndStatistics_management("folder", "INCLUDE_SUBDIRECTORIES", "BUILD_PYRAMIDS", "CALCULATE_STATISTICS")
This is a Python script sample for the BuildPyramidsandStatistics tool.
##==================================== ##Build Pyramids and Statistics ##Usage: BuildPyramidsAndStatistics_management in_workspace {INCLUDE_SUBDIRECTORIES ## | NONE} {BUILD_PYRAMIDS | NONE} ## {CALCULATE_STATISTICS | NONE} try: import arcpy arcpy.env.workspace = r"C:/Workspace" ##Define parameters for build pyramids and calculate statitics in environment setting arcpy.env.pyramid = "PYRAMIDS 3 BILINEAR JPEG" arcpy.env.rasterStatistics = "STATISTICS 4 6 (0)" ##Build pyramids and calculate statistics for all raster in a folder arcpy.BuildPyramidsAndStatistics_management("folder", "INCLUDE_SUBDIRECTORIES", "BUILD_PYRAMIDS", "CALCULATE_STATISTICS") ##Build pyramids and calculate statistics for all raster in a GDB arcpy.BuildPyramidsAndStatistics_management("fgdb.gdb", "INCLUDE_SUBDIRECTORIES", "BUILD_PYRAMIDS", "CALCULATE_STATISTICS") ##Build pyramids and calculate statistics for all raster in a Mosaic Dataset arcpy.BuildPyramidsAndStatistics_management("fgdb.gdb/md", "INCLUDE_SUBDIRECTORIES", "BUILD_PYRAMIDS", "CALCULATE_STATISTICS") except: print "Build Pyramids and Statistics example failed." print arcpy.GetMessages()