Chevron DownAPI Reference

DBFLoader

From-v2.3

A sub loader for the .dbf (attributes/properties) file component of a shapefile. This is essentially a loader for the legacy dBase 7 database format.

Note: Most applications will want to use the ShapefileLoader instead of this loader.

LoaderCharacteristic
File Extension.dbf,
File TypeBinary
File FormatShapefiles
Data FormatTable
Supported APIsload, parse, parseSync
Decoder TypeSynchronous
Worker Thread SupportYes

Usage

The DBFLoader parses feature attributes from the Shapefile format.

import {DBFLoader} from '@loaders.gl/shapefile';
import {load} from '@loaders.gl/core';

const options = {
  dbf: {
    encoding: 'utf8'
  }
};
const data = await load(url, DBFLoader, options);
// [{foo: null}, {foo: 'blue'}, {foo: 'green'}];

Options

  • encoding: text encoding of DBF file: usually either utf8, or ascii/windows-1252. For Shapefiles, there's often a .cpg file designating the encoding used.

Format Summary

ESRI Shapefiles are a popular file format for storing geospatial vector data. The format consists of a number of files that must be stored together and with the same file name. Files with extensions .shp, .shx, .dbf must exist; additional files with other extensions such as .prj and .cpg may exist.

References: