Compress File Geodatabase Data (Data Management)

Summary

Compresses all the contents in a geodatabase, all the contents in a feature dataset, or an individual stand-alone feature class or table.

Usage

  • 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 in it are also compressed.

  • When you compress a feature dataset, all its feature classes are also compressed.

  • 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 compress a raster catalog or a raster dataset with this tool, but the data does not reduce in size. This support is provided strictly as a means to allow ArcGIS Publisher to package to compressed and locked file geodatabase raster catalogs and datasets.

    Caution:

    A dataset that contains any of the following field data types will not be compressed:

    Learn more about compressing file geodatabase data

  • You cannot compress or uncompress individual feature classes in a feature dataset to produce a mixed state in which 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, 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 nonlossless 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. Nonlossless compression is up to 20 percent smaller than lossless.

Parameters

LabelExplanationData Type
Input file geodatabase data

The geodatabase, feature dataset, feature class, or table that will be compressed.

Feature Dataset; Geometric Network; Raster Layer; Table View; Workspace
Lossless compression

Specifies whether lossless compression will be used.

  • Unchecked—Lossless compression will not be used.
  • Checked—Lossless compression will be used. This is the default.

    Note: For file geodatabases earlier than 10.0, lossless compression is not supported. For those file geodatabases, this parameter cannot be changed and is unchecked and disabled.

Boolean

Derived Output

LabelExplanationData Type
Compressed Input Data

The compressed input data.

Workpsace; Feature Dataset; Table View; Raster Layer; Geometric Network

arcpy.management.CompressFileGeodatabaseData(in_data, lossless)
NameExplanationData Type
in_data

The geodatabase, feature dataset, feature class, or table that will be compressed.

Feature Dataset; Geometric Network; Raster Layer; Table View; Workspace
lossless

Specifies whether lossless compression will be used.

  • Lossless compressionLossless compression will be used. This is the default.
  • Non-lossless compressionLossless compression will not be used.

This parameter is ignored for file geodatabases earlier than 10.0.

Boolean

Derived Output

NameExplanationData Type
out_data

The compressed input data.

Workpsace; Feature Dataset; Table View; Raster Layer; Geometric Network

Code sample

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.management.CompressFileGeodatabaseData("london.gdb", "Lossless compression")
CompressFileGeodatabaseData example 2 (stand-alone 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.management.CompressFileGeodatabaseData(geodatabase, lossless)

Environments

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics