# geojson2shp

> Convert GeoJSON into Shapefile in pure JavaScript

Latest version **0.5.0** (published 2022-02-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install geojson2shp
pnpm add geojson2shp
yarn add geojson2shp
bun add geojson2shp
```

Provides the command `geojson2shp`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2022-02-07 |
| First published | 2018-05-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 12 |
| Dependencies | 8 |
| Unpacked size | 30.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 52 |
| Author | Jérôme Desboeufs |
| Maintainers | jdesboeufs |

## Links

- npm: https://www.npmjs.com/package/geojson2shp
- Repository: https://github.com/jdesboeufs/geojson2shp
- npm.io page: https://npm.io/package/geojson2shp

## Dependencies (8)

- [pump](https://npm.io/package/pump.md) ^3.0.0
- [yazl](https://npm.io/package/yazl.md) ^2.5.1
- [pumpify](https://npm.io/package/pumpify.md) ^2.0.1
- [is-stream](https://npm.io/package/is-stream.md) ^2.0.1
- [reproject](https://npm.io/package/reproject.md) ^1.2.6
- [epsg-index](https://npm.io/package/epsg-index.md) ^1.2.0
- [gunzip-stream](https://npm.io/package/gunzip-stream.md) ^1.0.1
- [geojson-stream](https://npm.io/package/geojson-stream.md) ^0.1.0

## Recent versions

- 0.5.0 (latest) — 2022-02-07
- 0.4.0 — 2021-03-12
- 0.3.2 — 2018-07-13
- 0.3.1 — 2018-05-19
- 0.3.0 — 2018-05-19
- 0.2.0 — 2018-05-18
- 0.1.1 — 2018-05-16
- 0.1.0 — 2018-05-07
- 0.0.1 — 2018-05-03

## README

# geojson2shp
Convert GeoJSON into Shapefile in pure JavaScript

## Prerequisites

* [Node.js](https://nodejs.org/en/download/package-manager/) 12+

## Usage (CLI)

### With global installation

```bash
# Installation
npm install geojson2shp -g

# Conversion
cat my.geojson | geojson2shp > my-shp.zip
```

### With npx (included in Node.js installation)

```bash
# Conversion
cat my.geojson | npx geojson2shp > my-shp.zip
```

## Usage (Node.js)

### Basic

```js
const {convert} = require('geojson2shp')

const options = {
  layer: 'my-layer',
  targetCrs: 2154
}

// Paths
await convert('/path/to/source.geojson', '/path/to/dest-shp.zip', options)

// Streams
await convert(inputGeoJSONStream, outputZippedShapefileStream, options)

// FeatureCollection as input
const featureCollection = {type: 'FeatureCollection', features: [/* */]}
await convert(featureCollection, '/path/to/dest-shp.zip', options)

// Features as input
const features = [
  {type: 'Feature', geometry: {/* */}, properties: {}},
  {type: 'Feature', geometry: {/* */}, properties: {}}
]
await convert(features, '/path/to/dest-shp.zip', options)

// Or mix them ;)
```

### Custom stream

```js
const fs = require('fs')
const {createConvertStream} = require('geojson2shp')


myGeoJSONStream
  .pipe(createConvertStream({
    targetCrs: 2154,
    layer: 'my-layer'
  }))
  .pipe(fs.writeWriteStream('/path/to/my-shapefile.zip'))
```

## License

MIT

---
_Source: https://npm.io/package/geojson2shp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
