UNPKG

@loaders.gl/shapefile

Version:

Loader for the Shapefile Format

38 lines 1.24 kB
// loaders.gl // SPDX-License-Identifier: MIT // Copyright (c) vis.gl contributors import { parseSHP, parseSHPInBatches } from "./lib/parsers/parse-shp.js"; // __VERSION__ is injected by babel-plugin-version-inline // @ts-ignore TS2304: Cannot find name '__VERSION__'. const VERSION = typeof "4.4.4" !== 'undefined' ? "4.4.4" : 'latest'; export const SHP_MAGIC_NUMBER = [0x00, 0x00, 0x27, 0x0a]; /** * SHP file loader */ export const SHPWorkerLoader = { dataType: null, batchType: null, name: 'SHP', id: 'shp', module: 'shapefile', version: VERSION, worker: true, category: 'geometry', extensions: ['shp'], mimeTypes: ['application/octet-stream'], // ISSUE: This also identifies SHX files, which are identical to SHP for the first 100 bytes... tests: [new Uint8Array(SHP_MAGIC_NUMBER).buffer], options: { shp: { _maxDimensions: 4 } } }; /** SHP file loader */ export const SHPLoader = { ...SHPWorkerLoader, parse: async (arrayBuffer, options) => parseSHP(arrayBuffer, options), parseSync: parseSHP, parseInBatches: (arrayBufferIterator, options) => parseSHPInBatches(arrayBufferIterator, options) }; //# sourceMappingURL=shp-loader.js.map