English

Bug: Failure to build pyramids with JPEG2000, *.jp2. compression type

Description

When building pyramids using ArcCatalog with JPEG2000, the process terminates and the following error message is displayed:
 

Error:   
"An error was encountered while executing BuildPyramids, Operation Fails, Failed to Execute BuildPyramids"

The following error message is displayed when using the ArcSDE 'sderaster -o pyramid'command:
 
Error:   
"Updating Pyramids, Error: SE_stream_execute (-1), Operation failed Incomplete..."

Cause

This is a known limitation.

The JPEG2000 compression requires quality value ranging 0 to 255. When ArcCatalog is used to build pyramids using JPEG2000 compression type (right-click on the raster dataset and click Build Pyramids option), it asks for the parameters, such as compression quality. If no value is specified, '0' is used as the compression quality and the pyramid building process bails out with -1 error.

In ArcGIS 9.2, the range of compression quality for JPEG2000 type is modified from 0-255 to 1-100. This prevents the issue while building pyramids using ArcCatalog. However it can appear when using 'sderaster' command and not providing '-q' option.

Note:
The default for jp2 compression is 0 or a lossless compression. 

The compression quality ranges in value between 0 and 255. Values greater than 0 compute a lossy compression. A value of 1 produces the most lossy compression, meaning it has the lowest quality and smallest file possible. A value of 255 produces the least lossy compression, meaning it has the highest lossy quality possible and a larger file size. A quality value set to 0 computes a lossless compression.

 

Workaround

Calculate how many pyramid levels are needed and then build the pyramids one level at a time using 'sderaster -o pyramid' command, i.e., -L 1; -L 2; -L 3, ...) instead of using the '-L -1' option. Make sure to provide '-q' option for each level with the compression quality value (between 1-255). If a '-q' option is missed for any level, it will default to '0' and the process will fail with -1 error.

  1. Calculate how many pyramid levels are needed by taking the X and Y image dimensions, divide them by the X and Y tile dimensions, rounding up to nearest integer, and continue dividing the results by 2 until both are 1.

    For example:
     
    MOSAIC_TEST : 4129 X 1652 
    Tile Size : 128 X 128 
    Tiles at level 0: 32 x 12 
    Tiles at level 1: 16 x 6 
    Tiles at level 2: 8 x 3 - rounded to 4 
    Tiles at level 3: 4 x 2 
    Tiles at level 4: 2 x 1 
    Tiles at level 5: 1 x 1
  2. Drop any existing pyramids.
     
    Code:
    C:\>sderaster -o pyramid -l mosaic_test,raster -i 5151 -u test -p test -D test -L 0 -v 1 
    
    Connecting to server buccaneers, port 5151, as user test 
    
    Updating pyramid... 
    raster ID : 1 
    
    Total Time: 00:00:04 
    
    Complete...
  3. Build pyramids level by level.
     
    Code:
    C:\>sderaster -o pyramid -l mosaic_test,raster -i 5151 -u test -p test10g -L 1 -q 130 -I bilinear -v 1 
    
    Connecting to server buccaneers, port 5151, as user test 
    
    Updating pyramid... 
    raster ID : 1 
    
    Total Time: 00:00:05
  4. Continue the above step for 'L 2', 'L 3', 'L 4' until the last level is completed as calculated in step 1.