# geo-xform

> A library for transforming large streams of geojson into csv, kml, shapefile and other formats

Latest version **1.3.0** (published 2016-10-30) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install geo-xform
pnpm add geo-xform
yarn add geo-xform
bun add geo-xform
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2016-10-30 |
| First published | 2015-12-16 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 18 |
| Author | Daniel Fenton |
| Maintainers | dmfenton |
| Keywords | ogr, transform, gis, geojson, csv, kml, shapefile |

## Links

- npm: https://www.npmjs.com/package/geo-xform
- Repository: https://github.com/koopjs/geoxform
- Homepage: https://github.com/koopjs/geoxform#readme
- Issues: https://github.com/koopjs/geoxform/issues
- npm.io page: https://npm.io/package/geo-xform

## Dependencies (7)

- [lodash](https://npm.io/package/lodash.md) ^3.10.1
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [rimraf](https://npm.io/package/rimraf.md) ^2.5.0
- [highland](https://npm.io/package/highland.md) 3.0.0-beta.1
- [randomstring](https://npm.io/package/randomstring.md) ^1.1.3
- [feature-parser](https://npm.io/package/feature-parser.md) ^1.0.1
- [sanitize-filename](https://npm.io/package/sanitize-filename.md) ^1.5.3

## Alternatives

- [csv-to-markdown-table](https://npm.io/package/csv-to-markdown-table.md) — 47.0K weekly downloads
- [@sapphire/ratelimits](https://npm.io/package/@sapphire/ratelimits.md) — 4.4K weekly downloads
- [js-csvparser](https://npm.io/package/js-csvparser.md) — 2.0K weekly downloads
- [@adadapted/js-sdk](https://npm.io/package/@adadapted/js-sdk.md) — 251 weekly downloads
- [@grapecity/spread-sheets-sparklines](https://npm.io/package/@grapecity/spread-sheets-sparklines.md) — 103 weekly downloads

## Recent versions

- 1.3.0 (latest) — 2016-10-30
- 1.2.4 — 2016-04-28
- 1.2.3 — 2016-04-27
- 1.2.2 — 2016-04-23
- 1.2.1 — 2016-04-22
- 1.2.0 — 2016-04-22
- 1.1.5 — 2016-04-18
- 1.1.4 — 2016-04-15
- 1.1.3 — 2016-03-31
- 1.1.2 — 2016-03-24
- 1.1.1 — 2016-03-20
- 1.1.0 — 2016-03-17
- 1.0.15 — 2016-02-02
- 1.0.14 — 2016-01-28
- 1.0.13 — 2016-01-28
- … 12 more at https://npm.io/package/geo-xform/versions

## README

# GeoXForm
 *A library for transforming large streams of geojson into csv, kml, shapefile and other formats*

[![npm][npm-img]][npm-url]
[![travis][travis-image]][travis-url]

### Example
- Get GeoJSON from the web -> transform into csv -> write to disk

``` javascript
const GeoXForm = require('geo-xform')
const request = require('request')
const fs = require('fs')
const id = '593b88391b614123890f54a1db8fbf55_0'
request.get(`http://opendata.arcgis.com/datasets/${id}.geojson`)
.pipe(GeoXForm.createStream('csv'))
.pipe(fs.createWriteStream('./trees.csv'))
.on('finish', () => console.log('File written to trees.csv'))

```

## Set up
### Install [GDAL](http://www.gdal.org/)
- With Homebrew on OSX: `brew install gdal`
- On Ubuntu: `sudo apt-get install gdal-bin`

### Install node dependencies
- `(sudo) npm install`

## Development

### Transpile to ES5
- `npm run compile`

### Test
- `npm test`

## API
### `createStream(format, options)`
Create a stream that takes in geojson of arbitrary size and returns data in the selected format
- Format: the requested output format e.g. csv, zip (shapefile), kml
- Options:
``` javascript
{
      path: string // disk location to write temp files (optional)
      name: string // sets the name file parts (shapefile only)
      metadata: string // and xml string to write to file (shapefile only)
      srs: string // the spatial reference system for projecting transformed data (shapefile only)
}
```

### `GeoJSON.createStream(options)`
Create a stream that takes in individual features and returns a feature collection
- Input: A stream of individual GeoJSON features as strings or objects
- Options:
``` javascript
{
    json: boolean // flags whether the input is JSON or string
}
```

### `VRT.createStream(options)`
Create a steam that takes in geojson and outputs an OGR Virtual Layer
- Options:
``` javascript
{
    size: integer // number of features to write into each GeoJSON part, defaults to 5000
    path: string // output path to write the VRT XML and GeoJSON parts
}
```

### `OGR.createStream(format, options)`
Create a stream that takes in a layer and outputs transformed data
- Format: the requested output format e.g. csv, zip (shapefile), kml
- Options:
``` javascript
{
      geometry: string // on of ['point', 'line', 'polygon']
      fields: array // the names of fields in a given dataset (csv only)
      name: string // sets the name file parts (shapefile only)
      metadata: string // and xml string to write to file (shapefile only)
      srs: string // the spatial reference system for projecting transformed data (shapefile only)
}
```

[npm-img]: https://img.shields.io/npm/v/geo-xform.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/geo-xform
[travis-image]: https://img.shields.io/travis/koopjs/GeoXForm.svg?style=flat-square
[travis-url]: https://travis-ci.org/koopjs/GeoXForm

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