
Make Voronoï polygons
voronoi_com.Rd
Partition a city into voronoi polygons :
Use sf::st_voronoi with
envelope
parameter (= city contour)Cast the result and intersects with the city contour
Examples
sfelecteurs <- mapvotr::sf_input_voronoi
com <- mapvotr::contours_com_sample %>%
dplyr::filter(code_insee == "29039") %>%
sf::st_transform(2154)
var_bv <- "id_brut_bv_reu"
mapvotr:::voronoi_com(sfelecteurs, com, var_bv)
#> [1] "Launch voronoi_com"
#> Log is not open.
#> [1] "2 points with addresses related to different vote offices"
#> Log is not open.
#> Simple feature collection with 267 features and 1 field
#> Geometry type: GEOMETRY
#> Dimension: XY
#> Bounding box: xmin: 181289.4 ymin: 6772363 xmax: 188708.9 ymax: 6783302
#> Projected CRS: RGF93 v1 / Lambert-93
#> First 10 features:
#> geometry id_voronoi
#> 1 POLYGON ((182950.4 6778987,... 1
#> 2 MULTIPOLYGON (((183059.1 67... 2
#> 3 MULTIPOLYGON (((183105.6 67... 3
#> 4 POLYGON ((183081 6774990, 1... 4
#> 5 POLYGON ((183076.5 6774995,... 5
#> 6 POLYGON ((183117 6774908, 1... 6
#> 7 POLYGON ((183145.8 6774925,... 7
#> 8 POLYGON ((183081 6774990, 1... 8
#> 9 POLYGON ((183136.9 6774963,... 9
#> 10 POLYGON ((183139.7 6774966,... 10