geojson-rewind

enforce winding order for geojson

npm install geojson-rewind
4 downloads in the last day
45 downloads in the last week
149 downloads in the last month

Build Status

geojson-rewind

The GeoJSON specification is not picky about winding order, but this is.

This lets you use Canvas and other drawing libraries's default behavior to color the interior rings of Polygon and MultiPolygon features.

usage

as npm module:

npm install --save geojson-rewind

as console utility

# install
npm install -g geojson-rewind
# use
geojson-rewind foo.geojson

as browser library

copy geojson-rewind.js

api

rewind(geojson, counterclockwise)

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

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

npm loves you