An implementation of the shapefile (.shp) spatial data format.
npm install shapefile
|56||downloads in the last day|
|393||downloads in the last week|
|1 242||downloads in the last month|
|Version||0.2.0 last updated 6 months ago|
Streaming Shapefile Parser
Caveat emptor: this library is a work in progress and does not currently support all shapefile geometry types (see shp.js for details). It also only supports dBASE III and has no error checking. Please contribute if you want to help!
Reading a Shapefile
The main API for reading a shapefile is shapefile.readStream(filename[, options]). The supported options are:
- encoding - the DBF encoding (defaults to ISO-8859-1)
- ignore-properties - if true, don’t read properties (faster; defaults to false)
This method returns an event emitter which emits three types of events:
- feature - while reading features from the shapefile
- end - when all features have been read
- error - if an error occurs
See index-test for an example converting a shapefile to a GeoJSON feature collection.