# featureservice

> Get all features from an Esri Feature Service

Latest version **1.6.2** (published 2019-11-05) · ISC license · 0 weekly downloads

## Install

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

## 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.6.2 |
| Published | 2019-11-05 |
| First published | 2015-07-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 395.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 22 |
| Author | Chris Helm |
| Maintainers | chelm, dmfenton, rgwozdz, richgwozdz |
| Keywords | esri, featureservice, gis |

## Links

- npm: https://www.npmjs.com/package/featureservice
- Repository: https://github.com/koopjs/featureservice
- Issues: https://github.com/koopjs/featureservice/issues
- npm.io page: https://npm.io/package/featureservice

## Dependencies (2)

- [async](https://npm.io/package/async.md) ^2.1.5
- [xhr-request](https://npm.io/package/xhr-request.md) ^1.0.1

## Recent versions

- 1.6.2 (latest) — 2019-11-05
- 1.6.1 — 2018-11-30
- 1.6.0 — 2018-06-19
- 1.5.13 — 2018-01-31
- 1.5.12 — 2017-12-29
- 1.5.11 — 2016-10-23
- 1.5.10 — 2016-10-23
- 1.5.9 — 2016-10-20
- 1.5.8 — 2016-10-16
- 1.5.7 — 2016-04-07
- 1.5.6 — 2016-04-06
- 1.5.5 — 2016-03-31
- 1.5.4 — 2016-03-30
- 1.5.3 — 2016-03-23
- 1.5.2 — 2016-03-03
- … 28 more at https://npm.io/package/featureservice/versions

## README

# featureservice

*Get all features from an Esri Feature Service*

[![npm][npm-image]][npm-url]
[![travis][travis-image]][travis-url]
[![Greenkeeper badge][greenkeeper-image]][greenkeeper-url]

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

A little module that extracts every feature from an Esri Feature Service. The real power in this module is that it's designed to page over a service and extract every single feature no matter what ArcGIS Server version the data is hosted on.

## Install

```
npm install featureservice
```

## Usage

```javascript
var FeatureService = require('featureservice')

// a url to a feature service
var url = 'http://....../FeatureServer/0'

var service = new FeatureService(url, options)
service.pages(function (err, pages) {
/* will give you links to all pages of data in the service*/
})
```

### Options
An object passed as the second parameter when initializing a service
- layer: the layer index to use
- size: the maximum page size when requesting features
- concurrency: the maximum concurrency for requesting features from a single server
- timeOut: the amount of time to wait with no response before cancelling a request
- logger: An object with a log method that takes a level and a message e.g. a Winston instance

### API

#### info(callback)
Get the information describing the service itself

#### layerIds(callback)
Get all the ids in a feature service layer

#### layerInfo(callback)
Get the json metadata for a service layer

#### statistics(field, stats, callback)
Get statistics for a field and an array of stats.

```javascript
service.statistics('id', ['min', 'max'], function (err, stats) {
  console.log(stats.features)
})
```

#### pages(callback)
Returns an array of page urls that would get every feature in the service

### Browser

A browser ready build of this module is in `dist/featureservice.min.js`.

#### Example

```html
<html>
  <script src="dist/featureservice.min.js"></script>
  <script>
    var service = new FeatureService('http://koop.dc.esri.com/socrata/seattle/2tje-83f6/FeatureServer/0', {})
    service.statistics('id', ['max'], function (err, stats) {
      console.log(err, stats)
    })
  </script>
</html>
```

## License

[Apache 2.0](LICENSE)

<!-- [](Esri Tags: ArcGIS Web Mapping GeoJson FeatureServices) -->
<!-- [](Esri Language: JavaScript) -->

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