Skip to main content
Version: Next

rewind

Description

Rewind (Multi)LineString or (Multi)Polygon outer ring counterclockwise and inner rings clockwise (Uses Shoelace Formula).

Parameters

NameTypeDescription
geojsonGeoJSONinput GeoJSON Polygon
options?ObjectOptional parameters (default {})
options.reverse?booleanenable reverse winding (default false)
options.mutate?booleanallows GeoJSON input to be mutated (significant performance increase if true) (default false)

Returns

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(...);