View source: R/ll_find_pop_centre.R
ll_find_pop_centre | R Documentation |
Find the population-weighted centre of a municipality
ll_find_pop_centre(
sf_location,
sf_population_grid,
power = 2,
join = sf::st_intersects,
adjusted = FALSE
)
power |
Defaults to 2. To give more weight to cells with higher population density, raise the number of residents by the power of. |
join |
Defaults to sf::st_intersects. |
adjusted |
If adjusted is set to TRUE, join is ignored. The population of cells along the boundary line are weighted by the share of the cell included within the border. |
ll_set_folder("~/R/")
name <- "Pinzolo"
sf_location <- ll_get_nuts_it(name = name, level = "lau", resolution = "high")
lau_grid_name_temp <- stringr::str_c(name, "_lau_high-st_intersects")
sf_location_grid <- ll_get_population_grid(
match_sf = sf_location,
match_name = lau_grid_name_temp,
match_country = "IT",
join = sf::st_intersects
)
pop_centre <- ll_find_pop_centre(
sf_location = sf_location,
sf_population_grid = sf_location_grid,
power = 2
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.