@loaders.gl/shapefile
Version:
Loader for the Shapefile Format
37 lines (36 loc) • 1.06 kB
JavaScript
// loaders.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
import { parseDBF, parseDBFInBatches } from "./lib/parsers/parse-dbf.js";
// __VERSION__ is injected by babel-plugin-version-inline
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
const VERSION = typeof "4.3.3" !== 'undefined' ? "4.3.3" : 'latest';
/**
* DBFLoader - DBF files are used to contain non-geometry columns in Shapefiles
*/
export const DBFWorkerLoader = {
name: 'DBF',
dataType: null,
batchType: null,
id: 'dbf',
module: 'shapefile',
version: VERSION,
worker: true,
category: 'table',
extensions: ['dbf'],
mimeTypes: ['application/x-dbf'],
options: {
dbf: {
encoding: 'latin1'
}
}
};
/** DBF file loader */
export const DBFLoader = {
...DBFWorkerLoader,
parse: async (arrayBuffer, options) => parseDBF(arrayBuffer, options),
parseSync: parseDBF,
parseInBatches(arrayBufferIterator, options) {
return parseDBFInBatches(arrayBufferIterator, options);
}
};