rewind
Description
Rewind (Multi)LineString or (Multi)Polygon outer ring counterclockwise and inner rings clockwise (Uses Shoelace Formula).
Parameters
Name | Type | Description |
---|---|---|
geojson | GeoJSON | input GeoJSON Polygon |
options? | Object | Optional parameters (default {}) |
options.reverse? | boolean | enable reverse winding (default false) |
options.mutate? | boolean | allows GeoJSON input to be mutated (significant performance increase if true) (default false) |
Returns
GeoJSON rewind Polygon
Examples
var polygon = turf.polygon([
[
[121, -29],
[138, -29],
[138, -18],
[121, -18],
[121, -29],
],
]);
var rewind = turf.rewind(polygon);
Installation
$ npm install @turf/rewind
import { rewind } from "@turf/rewind";
const result = rewind(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.rewind(...);