Compresses all the contents in a geodatabase, all the contents in a feature dataset, or an individual stand-alone feature class or table.
Once compressed, a feature class or table is read-only and cannot be edited. Compression is ideally suited to mature datasets that do not require further editing. However, if required, a compressed dataset can always be uncompressed to return it to its original, read-write format.
When you compress a geodatabase, all feature classes and tables within it compress.
When you compress a feature dataset, all its feature classes compress.
When you specify a geodatabase as input, this tool compresses all vector feature classes and tables in the geodatabase. It does not compress raster catalogs or raster datasets. If it encounters these in the specified geodatabase, it skips over them. You can individually compress a raster catalog or raster dataset with this tool; however, it makes little sense since the data does not reduce in size. This support is provided strictly as a means to allow ArcPublisher to package to compressed and locked file geodatabase raster catalogs and datasets.
You cannot individually compress or uncompress a feature class in a feature dataset to produce a mixed state where some feature classes are compressed and others are not. Compressed feature datasets allow you to add an uncompressed feature class through operations such as creating a new, empty feature class, copying and pasting, and importing. However, you cannot edit the uncompressed feature class if there are compressed feature classes in the same feature dataset. Once you've finished adding one or more uncompressed feature classes, you can recompress or uncompress the feature dataset so all its feature classes are either compressed or uncompressed.
When you display compressed feature class records in ArcCatalog or ArcMap, they may not display in the same order as they did before you compressed the data. The records display in the order in which they are compressed and stored.
When using lossless compression, floating-point values will be preserved, but compression will not be as effective. With non-lossless compression, floating-point values will be changed, but not below the limit of adequate precision. For example, state boundaries do not usually need to be measured to nanometer precision. Non-lossless compression is up to 20 percent smaller than lossless.
CompressFileGeodatabaseData_management (in_data, lossless)
The geodatabase, feature dataset, feature class, or table to compress.
|Feature Dataset; Geometric Network; Raster Layer; Table View; Workspace|
Indicates whether lossless compression will be used.
This parameter is ignored for pre-10.0 file geodatabases.
CompressFileGeodatabaseData example 1 (Python window)
The following example demonstrates how to use the CompressFileGeodatabaseData function in the Python window.
import arcpy arcpy.env.workspace = "C:/data" arcpy.CompressFileGeodatabaseData_management("london.gdb","Lossless compression")
CompressFileGeodatabaseData example 2 (stand-alone Python script)
The following example demonstrates how to use the CompressFileGeodatabaseData function in a stand-alone Python script.
# Name: CompressFileGeodatabaseData.py # Description: Use the CompressFileGeodatabaseData tool to compress a geodatabase # import system modules import arcpy # Set environment settings arcpy.env.workspace = "C:/data" # Set local variables geodatabase = "london.gdb" lossless = "Lossless compression" # Process: Compress the data arcpy.CompressFileGeodatabaseData_management(geodatabase, lossless)
- ArcGIS for Desktop Basic: Yes
- ArcGIS for Desktop Standard: Yes
- ArcGIS for Desktop Advanced: Yes