turf-tesselate
tesselate
Tesselates a Feature<Polygon> into a FeatureCollection<Polygon> of triangles using earcut.
Parameters
polygon
Feature<Polygon> the polygon to tesselate
Examples
var polygon = "type":"Feature""id":"USA-CA""properties":"name":"California""geometry":"type":"Polygon""coordinates":-12323325642006186-12237885342011663-12103700341995232-12000186141995232-11999638440264519-12000186138999346-1187147838101128-1174988993721934-11654043536501861-1158503435970598-1146344593500118-1146344593487521-11447015134710902-11433322834448009-11413605834305608-11425655134174162-11441538234108438-11453587433933176-11449753633697668-1145249213354979-1147275673340739-11466184433034958-11452492133029481-11447015132843265-11452492132755634-1147220932717295-1160475132624187-11712646732536556-1172469632668003-11725243732876127-11732911433122589-11747151533297851-117783733538836-11818351733763391-11826019433703145-11841354833741483-11839164133840068-11856690334042715-11880241133998899-11921865934146777-1192789053426727-11955822934415147-1198758913440967-12013878434475393-12047287834448009-1206481434579455-12060980134858779-12067004834902595-12063170935099764-12089460235247642-12090555635450289-12100414135461243-12116844935636505-12128346535674843-12133275735784382-12171614336195153-12189688236315645-12193522136638785-121858544366114-12178734436803093-12192974436978355-12210500636956447-12233503837115279-12241719237241248-12240076137361741-12251577737520572-12251577737783465-12232956137783465-1224062383815042-12248839238112082-12250482337931343-12270199337893004-12293750138029928-1229758438265436-12312919438451652-12333184138566668-1234413838698114-1237371343895553-12368784239032208-12382476539366301-12376451939552517-1238521539831841-12410956640105688-12436150640259042-12441079840439781-12415885940877937-12410956641025814-1241588594114083-12406575141442061-12414790541715908-12425744441781632-12421362842000709-12323325642006186; var triangles = turf; //=triangles
Returns FeatureCollection<Polygon> a geometrycollection feature
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Installation
Install this module individually:
$ npm install turf-tesselate
Or install the Turf module that includes it as a function:
$ npm install turf