Skip to main content
Version: 6.5.0

polygonToLine

Description

Converts a Polygon to (Multi)LineString or MultiPolygon to a FeatureCollection of (Multi)LineString.

Parameters

NameTypeDescription
polyFeature<Polygon | MultiPolygon>Feature to convert
options?ObjectOptional parameters (default {})
options.properties?Objecttranslates GeoJSON properties to Feature (default {})

Returns

Examples

var poly = turf.polygon([
[
[125, -30],
[145, -30],
[145, -20],
[125, -20],
[125, -30],
],
]);

var line = turf.polygonToLine(poly);

Installation

$ npm install @turf/polygon-to-line

import { polygonToLine } from "@turf/polygon-to-line";
const result = polygonToLine(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.polygonToLine(...);