I'm trying to get some voronoi polygons from a set of coordinates distributed within a country, I don't need said polygons to extend out of the country, I tried using extend_to from voronoi_polygons documentation and downloaded an shp file from gadm and reading it with fiona as a geometry, but when passing it as argument it won't take it in count and the voronoi polygons will extend out of the country.
with fiona.open("./gadm41_BOL_0.shp") as file:
country_shape = shape(file[0]["geometry"])
data = pd.read_csv('data.csv')
points = MultiPoint(data[['long', 'lat']].values)
vor_polygons = voronoi_polygons(points, extend_to=country_shape)
It's worth noting that when displaying country_shape on a jupyter notebook it'll show a small contour / silhouette of the country properly, might as well add that the type of country_shape is shapely.geometry.multipolygon.MultiPolygon
, I'm also sure with a high degree of confidence that none of the coordinates in data.csv is outside the country, hence extend_to shouldn't fail.