# esri-to-geojson

> Convert Esri JSON/CSV to GeoJSON

Latest version **1.0.4** (published 2017-12-28) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install esri-to-geojson
pnpm add esri-to-geojson
yarn add esri-to-geojson
bun add esri-to-geojson
```

## 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.0.4 |
| Published | 2017-12-28 |
| First published | 2016-04-13 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Ben Stoltz |
| Maintainers | jgravois, dmfenton, benstoltz |
| Keywords | koop, geojson, csv, esri json, conversion |

## Links

- npm: https://www.npmjs.com/package/esri-to-geojson
- Repository: https://github.com/GeoXForm/esri-to-geojson
- Issues: https://github.com/GeoXForm/esri-to-geojson/issues
- npm.io page: https://npm.io/package/esri-to-geojson

## Dependencies (3)

- [csv](https://npm.io/package/csv.md) ^0.4.6
- [lodash](https://npm.io/package/lodash.md) ^4.3.0
- [@esri/arcgis-to-geojson-utils](https://npm.io/package/@esri/arcgis-to-geojson-utils.md) ^1.0.4

## 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.0.4 (latest) — 2017-12-28
- 1.0.3 — 2017-03-28
- 1.0.2 — 2016-05-09
- 1.0.1 — 2016-04-13
- 1.0.0 — 2016-04-13

## README

[![Build Status](https://travis-ci.org/GeoXForm/esri-to-geojson.svg?branch=master)](https://travis-ci.org/GeoXForm/esri-to-geojson)

# esri-to-geojson

*Converts Esri JSON and CSV to GeoJSON format*

Besides translating geometries this project **make changes** to
actual field values.

* decoding domains
* creating x & y fields from CSVs
* Translate date fields to be human readable text


Example: Convert Esri JSON to GeoJSON
```js
const GeoJSON = require('geojson')
const CSV = require('csv')
const input = '"y","x"\n"-180","90"\n"30","-60"'

const options = [{
        name: 'NAME',
        type: 'esriFieldTypeSmallInteger',
        alias: 'NAME',
        domain: {
            type: 'codedValue',
            name: 'NAME',
            codedValues: [
                {
                    name: 'Name0',
                    code: 0
                },
                {
                    name: 'Name1',
                    code: 1
                }
            ]
        }
    }]
    const esriJSON = {
        features: [{
            attributes: {
                NAME: 0
            }
        }, {
            attributes: {
                NAME: 1
            }
        }]
    }

const geojson = GeoJSON.fromEsri(esriJSON, options)

console.log(geojson)

csv.parse(input, (err, output) => {
    const csvGeoJSON = GeoJSON.fromCSV(output)
    console.log(csvGeoJSON)
})

```

## Set up

esri-to-geojson should be installed as a dependency in a Node.js project like so:

- `npm install esri-to-geojson --save`


## Development

### Install dependencies
- `npm install`

### Transpile to ES5
- `npm compile`

### Test
- `npm test`


## API
### `GeoJSON.fromEsri(esriJSON, options)`
Converts Esri JSON to GeoJSON
- esriJSON: the entire Esri JSON object
- Options:
``` javascript
{
    fields: array // fields object returned from esri json
}

```

### `GeoJSON.fromCSV(csv)`
Converts CSV to GeoJSON
- csv: csv file parsed using https://www.npmjs.com/package/csv

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