# geocoder-arcgis

> JavaScript wrapper for the ESRI ArcGIS geocoder

Latest version **2.0.5** (published 2019-02-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install geocoder-arcgis
pnpm add geocoder-arcgis
yarn add geocoder-arcgis
bun add geocoder-arcgis
```

## 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 | 2.0.5 |
| Published | 2019-02-26 |
| First published | 2016-02-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 24.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Stephan Georg |
| Maintainers | stephangeorg |
| Keywords | esri, arcgis, geocoder, api, geo, maps, geolocation |

## Links

- npm: https://www.npmjs.com/package/geocoder-arcgis
- Repository: https://github.com/StephanGeorg/geocoder-arcgis
- Homepage: https://github.com/StephanGeorg/geocoder-arcgis#readme
- Issues: https://github.com/StephanGeorg/geocoder-arcgis/issues
- npm.io page: https://npm.io/package/geocoder-arcgis

## Dependencies (6)

- [form-data](https://npm.io/package/form-data.md) ^2.3.1
- [lodash.get](https://npm.io/package/lodash.get.md) ^4.4.2
- [es6-promise](https://npm.io/package/es6-promise.md) ^4.1.1
- [lodash.isobject](https://npm.io/package/lodash.isobject.md) ^3.0.2
- [lodash.isstring](https://npm.io/package/lodash.isstring.md) ^4.0.1
- [fetch-everywhere](https://npm.io/package/fetch-everywhere.md) ^1.0.5

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 2.0.5 (latest) — 2019-02-26
- 2.0.4 — 2018-02-03
- 2.0.3 — 2018-02-02
- 2.0.2 — 2018-02-02
- 2.0.1 — 2018-02-02
- 2.0.0 — 2017-12-01
- 1.2.7 — 2017-08-12
- 1.2.6 — 2017-08-11
- 1.2.5 — 2017-08-05
- 1.2.4 — 2017-07-18
- 1.2.3 — 2017-07-18
- 1.2.2 — 2017-07-18
- 1.2.1 — 2017-03-29
- 1.2.0 — 2017-03-29
- 1.1.2 — 2016-10-19
- … 21 more at https://npm.io/package/geocoder-arcgis/versions

## README

# GeocoderArcGIS [![npm version](https://badge.fury.io/js/geocoder-arcgis.svg)](https://badge.fury.io/js/geocoder-arcgis)

A promises based JavaScript wrapper for the [ArcGIS](https://developers.arcgis.com/features/geocoding/) Geocoder API.
It uses fetch-everywhere to use in

- Node
- Browser
- React-native

## Installation

Installing using npm:

    npm i geocoder-arcgis -S

## Usage

### Initialization
```javascript
const GeocoderArcGIS = require('geocoder-arcgis');

const geocoder = new GeocoderArcGIS({
  client_id: 'YOUR CLIENT ID',         // optional, see below
  client_secret: 'YOUR CLIENT SECRET'  // optional, see below
});
```

The constructor function also takes an optional configuration object:

* client_id: id for OAuth to use with "geocodeAddresses" or "forStorage" option. See [reference](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-free-vs-paid.htm)
* client_secret: secret for OAuth to use with "geocodeAddresses" or "forStorage" option. See [reference](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-free-vs-paid.htm)
* endpoint: custom ArcGIS endpoint

### Geocode (findAddressCandidates)

```javascript
geocoder.findAddressCandidates('380 New York Street, Redlands, CA 92373',{})
    .then((result) =>{
      console.log(result);
    })
    .catch(console.log);
```

You can pass a [SingleLine string or an object](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-find-address-candidates.htm#ESRI_SECTION1_699C8961EDD845CAB84A46409D9E9105) to the geocoder.

Optional parameters:
* you can pass all [request parameters](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-find-address-candidates.htm#ESRI_SECTION1_699C8961EDD845CAB84A46409D9E9105)

### Reverse geocode (reverseGeocode)
```javascript
geocoder.reverse('51.484463,-0.195405',{ // longitude,latitude
  maxLocations: 10,
  distance: 100
}).then((result) => {
  console.log(result);
});
```

Optional parameters:
* you can pass all [request parameters](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-reverse-geocode.htm#ESRI_SECTION1_ABD1AD449DF54FFEB9527A606341714C)

### Suggest (suggest)
```javascript
geocoder.suggest('Glogauer Straße, Berlin',{})
.then((result) => {
  console.log(result);
})
.catch(console.log);
```

Optional parameters:
* you can pass all [request parameters](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm#ESRI_SECTION1_606D93C721874B16844B9AB9CA8083FF)

### geocodeAddresses
```javascript
geocoder.geocodeAddresses([
  "380 New York St., Redlands, CA, 92373",
  {
    "Address": "1 World Way",
    "Neighborhood": "",
    "City": "Los Angeles",
    "Subregion": "",
    "Region": "CA"
  }
  ],{})
    .then((result){
      console.log(result);
    })
    .catch(console.log);
```

You can pass an array of attributes to the geocoder. All required fields will be added/formatted automatically.  If you don't pass in OBJECTIDs for each address, this library will create them for you. You can pass a [SingleLine string or an object](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-find-address-candidates.htm#ESRI_SECTION1_699C8961EDD845CAB84A46409D9E9105) to the geocoder.

Optional parameters:
* you can pass all [request parameters](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-geocode-addresses.htm#ESRI_SECTION1_2F67482E18324994B54C9E93A81AA99D)

### Geocode (find) - [deprecated](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-find-address-candidates.htm)
```javascript
geocoder.geocode('Berlin',{})
    .then((response) => {
        console.log(response);
    })
    .catch(console.log);
```

### Response

All methods return a promise.

## See Also
* [geoservices-js](https://github.com/Esri/geoservices-js/blob/master/docs/Geocoding.md) provides another client for the ArcGIS geocoder, using a callback interface instead of promises.

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