Skip to main content
Version: Next

tesselate

Description

Tesselates a Feature<Polygon> into a FeatureCollection<Polygon> of triangles using earcut.

Parameters

NameTypeDescription
polyFeature<Polygon>the polygon to tesselate

Returns

Examples

var poly = turf.polygon([
[
[11, 0],
[22, 4],
[31, 0],
[31, 11],
[21, 15],
[11, 11],
[11, 0],
],
]);
var triangles = turf.tesselate(poly);

Installation

$ npm install @turf/tesselate

import { tesselate } from "@turf/tesselate";
const result = tesselate(...);
$ npm install @turf/turf

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