Home » Data Sources » Image Compression and Encoding for Raster Data

Image Compression and Encoding for Raster Data

Image Compression Techniques

Image Compression in GIS

Raster data is comprised of grid cells. Unlike its vector counterpart which is comprised of vertices and paths. These are the two primary spatial data types in GIS.

Accuracy depends on cell size. Cell size must be small enough to capture the required detail. And as resolution increases, the size of the cell decreases. But this comes at a cost for speed of processing and data storage.

Raster storage, in its raw state, is inefficient because it normally stores values row-by-row from the top left corner.

Have no fear:

The way to improve raster size efficiency is through image compression. And there are several ways to use GIS compression to reduce file size and still maintain the quality of data.

Let’s take a look at some examples of how raster images are compressed:

Run Length Encoding – Grouping Rows of Data

Run-length encoding stores cells on a row-by-row basis. Instead of recording each individual cell’s values, run-length encoding groups cell values by row.

Take this line of data:
AAAAAABBBBCCCCCCCCC

It can be rendered as:
6A4B9C

This image encoding method reduces data volumes because each line is recorded more efficiently. Even though the same information is being held, values that are the same are stored as a string.

Run Length Encoding

In the example above, the first row is blank and is stored as (0,8). This means there are 8 cells and they are all zeros. In the second row, there are 4 consecutive zeros so it gets a value of (0,4). After this, we have three consecutive cells with the value 1 so it gets a value of (1,3). This continues until it reaches the bottom-right cell.

Block Coding – Grouping Blocks of Data

The block coding raster storage technique assigns areas that consist of blocks to reduce redundancy.

The block coding raster image compression method subdivides an entire raster image into hierarchical blocks. It’s an extension of the run-length encoding technique but extends it to two dimensions.

In the example above:

Block Coding

Instead of storing 64 grid cells, all it takes is just 7 blocks. Using block coding, it requires one 3×3 block, two 2×2 blocks, and four 1×1 cell blocks to encode this raster image.

In this block coding example, the top-left corner is used as a reference for each block.

Chain Coding – Defining the Exterior Boundary

Chain coding defines the outer boundary using relative positions from a start point. The sequence of the exterior is stored where the endpoint finishes at the start point.

During the encoding, the direction is stored as an integer. However, in this example, we use cardinal directions for simplicity. For example, the value 0 is north and 1 is east.

Chain Coding

In the example, we start at the position (5,2). From here we define the border using cardinal directions and the number of movements. We move east 3 positions until we hit the edge. At this location, we move south 4 positions. This process continues until the endpoint hits the start point.

Note: Only for this exercise do we use north, east, south, and west as alphabetical values. When encoded, it is a numerical value.

Quadtree Encoding – Subdividing Data Into Quarters

Quadtrees are raster data structures based on the successive reduction of homogeneous cells. It recursively subdivides a raster image into quarters. The subdivision process continues until each cell is classed.

Quadtree

It reduces raster storage requirements. It also is dependent on the complexity of the feature and the resolution of the smallest grid cell.

In the example, the top-left and bottom-right 8×8 grids do not need to be subdivided further because they are homogeneous. The top-right 8×8 grid is subdivided into three 4×4 grids. The remaining 4×4 grid is separated into 4 individual classes.

Image Compression Reduces File size

GIS data is abundant. With satellites acquiring images each day, raster data is the spatial model of choice. But which format will you use?

Deploying efficient raster image compression techniques means reducing storage space. This is the primary benefit of compressing your data.

It can save money and time. You can also improve your network performance because you are working with a reduced amount of data.

We’ve provided you with an overview of raster encoding techniques to help you on your journey to saving valuable disk storage. It’s your turn to experiment with image compression and the benefits it can serve you or your organization.

READ MORE: Unsigned Integer vs Signed Integer for Raster Data

Subscribe to our newsletter:

4 Comments

  1. No mention of Limited Error Raster Compression (LERC)… I was hoping to get some learning on that in comparison to the above. I certainly didn’t know about most of those- thanks for the learning.

Leave a Reply

Your email address will not be published. Required fields are marked *