# @mapbox/geojson-rewind

> enforce winding order for geojson

Latest version **0.5.2** (published 2022-05-18) · ISC license · 2.4M weekly downloads

## Install

```sh
npm install @mapbox/geojson-rewind
pnpm add @mapbox/geojson-rewind
yarn add @mapbox/geojson-rewind
bun add @mapbox/geojson-rewind
```

Provides the command `geojson-rewind`.

## Health

**Score 53/100 (C)** — status: abandoned.

Positive: high downloads; has types package; no vulnerabilities; high quality score.

Warnings: no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.5.2 |
| Published | 2022-05-18 |
| First published | 2018-11-21 |
| Weekly downloads | 2.4M |
| License | ISC |
| TypeScript types | separate (@types/mapbox__geojson-rewind) |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 133 |
| Author | Tom MacWright |
| Maintainers | mapbox-npm-01, mapbox-npm-02, mapbox-npm-07, mapbox-npm-03, mapbox-npm-04, mapbox-npm-09, mapbox-npm-05, mapbox-npm-06, mapbox-npm-08, mapbox-npm-advanced-actions, mapbox-npm-ci, mapbox-npm, mapbox-admin, mapbox-machine-user |
| Keywords | geojson, winding, order, rendering, coordinates |

## Links

- npm: https://www.npmjs.com/package/@mapbox/geojson-rewind
- Repository: https://github.com/mapbox/geojson-rewind
- Issues: https://github.com/mapbox/geojson-rewind/issues
- npm.io page: https://npm.io/package/@mapbox/geojson-rewind

## Dependencies (2)

- [minimist](https://npm.io/package/minimist.md) ^1.2.6
- [get-stream](https://npm.io/package/get-stream.md) ^6.0.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads
- [@turf/center-mean](https://npm.io/package/@turf/center-mean.md) — 1.3M weekly downloads

## Recent versions

- 0.5.2 (latest) — 2022-05-18
- 0.5.1 — 2021-05-19
- 0.5.0 — 2020-03-25
- 0.4.1 — 2020-03-17
- 0.4.0 — 2018-11-21

## README

[![Build Status](https://travis-ci.org/mapbox/geojson-rewind.png)](https://travis-ci.org/mapbox/geojson-rewind)

# geojson-rewind

The [GeoJSON](https://tools.ietf.org/html/rfc7946) specification is [picky about winding order](https://tools.ietf.org/html/rfc7946#section-3.1.6).

This helps you generate compliant Polygon and MultiPolygon geometries. Furthermore it lets you use [Canvas](http://www.bit-101.com/blog/?p=3702) and other drawing libraries's default behavior to color the interior rings of Polygon and MultiPolygon features.

## Usage

As NPM module:

    npm install --save @mapbox/geojson-rewind

As a console utility:

    # install
    npm install -g @mapbox/geojson-rewind
    # use
    geojson-rewind foo.geojson

As a browser library: [geojson-rewind.js](https://bundle.run/geojson-rewind)

## API

`rewind(geojson, clockwise)`

Given a GeoJSON FeatureCollection, Feature, or Geometry, return a version
with inner and outer rings of different winding orders.

If `clockwise` is `true`, the outer ring is clockwise, otherwise
it is counterclockwise.

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