Organizing DBF Files (2)

As discussed in the article Organizing DBF Files, the creation of maps using GIS software depends heavily on the proper organization of the DBF file associated with a Shapefile.

In this article, we present an example of DBF optimization using a Shapefile containing oil well data provided by the Exploration and Production Database (BDEP) of Brazil’s National Agency for Petroleum, Natural Gas and Biofuels (ANP).

After downloading the dataset from the ANP website, we observed that the DBF file size was 383,899 KB, considerably larger than the other files that make up the Shapefile (Figure 1). Such an excessive size is often an indication that the DBF structure is not properly configured.

Figure 1 – Oil Well Shapefile

To evaluate the DBF structure, we used LibreOffice. The first row of the file, highlighted in red in Figure 2, contains the DBF field definitions. Some important observations regarding the DBF structure are presented below.

The first field definition, POCO,C,254, is organized as follows:

  • POCO = field name
  • C = character/alphanumeric field type
  • 254 = field length

The second field definition, CADASTRO,N,24,15, means:

  • CADASTRO = field name
  • N = numeric field type
  • 24 = field length
  • 15 = number of decimal places

Figure 2 – DBF opened in LibreOffice

At first glance, it becomes clear that the field definitions were automatically created by the GIS software used to generate the Shapefile.

The POCO field is configured with a length of 254 characters, which is far greater than necessary. The same issue affects all other character fields. For example, the ESTADO (State) field should have a length of only 2 characters, since Brazilian state abbreviations such as RN and AL contain only two letters.

The numeric fields are also configured with unnecessarily large lengths and decimal precision. The CADASTRO field, for instance, is defined as 24 digits with 15 decimal places. A more appropriate configuration would be:

CADASTRO,N,11,0

which represents a field length of 11 digits and no decimal places.

After adjusting the field definitions, the DBF file size was reduced to 63,168 KB (Figure 3).

Figure 3 – DBF size after optimization

Recommendations for Organizing DBF Files

  • When creating a Shapefile, define the configuration of character and numeric fields correctly from the beginning.
  • Whenever you receive a Shapefile, review the field definitions and make adjustments if necessary.
  • Any opportunity to reduce the size of a DBF file should be considered.
  • Modify field lengths and decimal precision whenever they exceed actual data requirements.

Benefits of DBF Optimization

Properly configured DBF files offer several advantages:

  • Improved GIS software performance.
  • Faster data loading and processing.
  • Reduced storage requirements.
  • More efficient data transfer and sharing.
  • Better management of large geographic databases.

In the example presented, reducing the DBF file size by more than 80% can result in significant savings in data storage costs, particularly when managing large datasets on enterprise servers or cloud-based infrastructures.

For additional information on DBF configuration and optimization, see the article Working with DBF Files.


Well-structured DBF files are an essential component of geospatial data quality, contributing to better performance, lower storage costs, and more efficient GIS workflows.