Skip to contents

Gives a single BV for each point

Usage

decouplage_ptsBv(
  sfelecteurs,
  com,
  var_bv = "id_brut_bv_reu",
  var_geo_score = "geo_score",
  var_nbaddress = "nb_adresses",
  epsg
)

Arguments

sfelecteurs

table of addresses (sf object)

com

city contour (sf object)

var_bv

name for bv code variable in address table

var_geo_score

name for geo_score variable in address table

var_nbaddress

name for number of addresses for each point in address table

epsg

epsg code

Value

passing table between BVs and points

Details

  • when several addresses geolocalized on the same point, and those addresses are related with different BVs :

    • If possible : Take the BV with a maximum number of addresses geolocalized on that point

    • If as many number of addresses for several BVs : take the BV related to the best geolocalized points

    • Else, random choice (rare)

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"
var_geo_score <- "geo_score"
var_nbaddress <- "nb_adresses"
epsg <- 2154
mapvotr:::decouplage_ptsBv(sfelecteurs, com, var_bv, var_geo_score, var_nbaddress, epsg)
#> [1] "Launch : decouplage_ptsBv"
#> Log is not open.
#> Simple feature collection with 267 features and 1 field
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: 183062.1 ymin: 6774688 xmax: 184500.1 ymax: 6777707
#> Projected CRS: RGF93 v1 / Lambert-93
#> # A tibble: 267 × 2
#>    id_brut_bv_reu           geometry
#>  * <chr>                 <POINT [m]>
#>  1 29039_1        (183062.1 6774983)
#>  2 29039_1          (183075 6774976)
#>  3 29039_1          (183094 6774983)
#>  4 29039_1        (183095.3 6774994)
#>  5 29039_1        (183100.1 6774995)
#>  6 29039_1        (183104.8 6774997)
#>  7 29039_1        (183109.8 6774988)
#>  8 29039_1          (183116 6775017)
#>  9 29039_1        (183138.1 6775008)
#> 10 29039_1        (183139.2 6775000)
#> # ℹ 257 more rows