Chevron DownCommand-Line Reference
Chevron DownAPI Reference



A "sub loader" for the .shp (geometries) file component of a shapefile.

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

File Extension.shp
File TypeBinary
File FormatShapefiles
Data FormatGeometry
Supported APIsload, parse, parseSync
Decoder TypeSynchronous
Worker Thread SupportYes


import {SHPLoader} from '';
import {load} from '';

const data = await load(url, SHPLoader);


shp._maxDimensionsInteger4Shapefiles can hold up to 4 dimensions (XYZM). By default all dimensions are parsed; when set to 2 only the X and Y dimensions are parsed. Note that for some Shapefiles, the third dimension is M, not Z. header.type in the output designates the stored dimensions.


The ShapefileLoader's output looks like the following. geometries holds an array of features in's binary geometry format. prj contains the Shapefile's projection string. header contains the Shapefile's header values, including a bounding box of the data and the file's geometry type. Consult the Shapefile specification for the meaning of the numeric types.

  geometries: [ { positions: [Object], type: 'Point' } ],
  header: {
    magic: 9994,
    length: 136,
    version: 1000,
    type: 11,
    bbox: {
      minX: 1,
      minY: 2,
      minZ: 3,
      minM: 0,
      maxX: 1,
      maxY: 2,
      maxZ: 3,
      maxM: 0
  progress: { bytesUsed: 0, bytesTotal: 136, rows: 1 },
  currentIndex: 2

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.