Voronoi

Takes a FeatureCollection of points, and a bounding box, and returns a FeatureCollection of Voronoi polygons.

Interactive Example

from turfpy.transformation import voronoi
from ipyleaflet import Map, GeoJSON, LayersControl, Marker

points = [
    [-66.97035175371198, 40.318345269995234],
    [-63.776304623759685, 40.45001590163247],
    [-65.41960483851452, 42.13985310302137],
    [-69.58133775268497, 43.95405461286195],
    [-65.66337553550034, 55.97088945355232],
    [-60.280418548905, 56.240669185466146],
    [-68.5129561347689, 50.12984589640148],
    [-64.2393519226657, 59.66235385923687],
    [-60.90340080176197, 47.319854339485836],
    [-64.013392235184, 47.48505628754743],
    [-63.5901237814622, 56.435271304519375],
    [-65.29273842230272, 40.46532951990474],
    [-64.34074762923518, 44.41467903845307],
    [-62.75238118105902, 50.232555998274044],
    [-66.39216606663494, 42.05774847944996],
    [-69.4747201276131, 43.288490094187104],
    [-60.22111554327566, 53.23070074089705],
    [-68.38456573407701, 58.12528229586756],
    [-60.022015858921954, 57.16751878858943],
    [-67.27241103543064, 46.52814784233641],
    [-68.44640005497628, 49.31604545534581],
    [-63.19928242836677, 40.397501696572654],
    [-69.75867935840617, 45.47856756289996],
    [-61.32766380696367, 58.672721168560955],
    [-67.52671607410451, 55.62959559068972],
    [-64.05030735753337, 56.19827268873002],
    [-65.20026060312107, 52.91890866887687],
    [-63.02174849203104, 45.34033157319018],
    [-62.33913739166953, 43.46950736683852],
    [-68.70183827840249, 51.16845764645581],
    [-66.20557198738521, 45.61818662858589],
    [-67.06923935761512, 56.49552328077417],
    [-68.45745370027925, 53.01501887198211],
    [-61.230713576641044, 56.183690218293776],
    [-61.366266080040376, 45.09667176473487],
    [-68.40160283717302, 51.22288379742737],
    [-65.91059565227219, 46.12828610239469],
    [-69.24685336802877, 58.04159904298512],
    [-67.90746049167338, 51.458754170538626],
    [-64.69458939381633, 43.50862977964408],
    [-69.67707467644576, 55.13014562401008],
    [-67.86563100693668, 44.71454319618893],
    [-67.64200780701925, 45.346156738904824],
    [-62.784041537868234, 44.021481858972024],
    [-69.46030604589015, 50.77927933384373],
    [-67.47301069491814, 57.20749222445842],
    [-63.63826397952049, 43.06756343494853],
    [-65.03421426631598, 58.607691301001665],
    [-61.42694866295021, 44.01728814041832],
    [-65.27780516075711, 49.1577380024088],
    [-63.22809792736968, 54.75459925926561],
    [-65.75164600671681, 50.444095477144174],
    [-66.53391928446148, 46.81946313004039],
    [-61.17532370859516, 56.490308715502884],
    [-62.82596239604844, 47.62933849172895],
    [-67.91427680286654, 50.002068640008446],
    [-68.8281390917315, 41.624594548778255],
    [-62.324565557935586, 54.36070911572615],
    [-67.79789775299722, 54.032762733269294],
    [-69.90721635010229, 42.53005065790635],
    [-64.09218727436058, 44.21747980258202],
    [-65.45745182285232, 41.92888759186806],
    [-64.89743431251524, 56.02354218555687],
    [-62.74330413423213, 49.851812304102474],
    [-69.01724834169485, 43.86098277913519],
    [-65.08442833608343, 49.05799844118643],
    [-60.117926604673414, 42.56576378184112],
    [-63.380264668516965, 58.718930212178506],
    [-69.58981710789907, 56.45741811079546],
    [-69.34434256360679, 55.54353852333105],
    [-68.96303460007613, 58.368441094579225],
    [-60.499978235077876, 58.04095533357255],
    [-64.48228884995504, 52.67791964667544],
    [-63.28389119770206, 51.760879575173384],
    [-67.75617507537125, 43.75912562117327],
    [-68.00927728902863, 45.671594734286614],
    [-63.36784409964047, 44.10569333994948],
    [-65.58756228301353, 54.97295500158505],
    [-67.37277146991484, 56.476728117598626],
    [-68.10830042153275, 55.72080967470162],
    [-69.12830174563588, 45.58632852197277],
    [-64.6315835789136, 51.88413518274077],
    [-67.75853090943711, 58.587494282518776],
    [-61.45846709902253, 53.270601672273],
    [-61.903530354456734, 57.98191726730208],
    [-65.81769750926455, 42.034979844034275],
    [-64.2364381676968, 51.762721823182545],
    [-69.75124251822547, 50.065087854580355],
    [-62.624081650070146, 49.81702630730683],
    [-64.44355690073627, 59.06794579492187],
    [-68.55204564864789, 55.336271363856184],
    [-63.25564507829077, 50.6046345112907],
    [-63.81456104951526, 40.8486627152392],
    [-64.37015352762566, 58.00983759616774],
    [-61.870172642975895, 59.15750997986467],
    [-60.02123672191712, 56.074643702400614],
    [-60.11304594655109, 43.241774996887635],
    [-66.18978478841018, 53.56622582843157],
    [-63.92923317441267, 54.78528722989218],
    [-62.48536066011403, 54.50280730402256],
]
bbox = [-70, 40, -60, 60]
result = voronoi(points, bbox)

m = Map(center=[51.833656018902175, -64.83547210693361], zoom=4)

for point in points:
    marker = Marker(location=[point[1], point[0]])
    m.add_layer(marker)

vor = GeoJSON(name="Original", data=result, style={"color": "green"})
m.add_layer(vor)
m