Allocates each polygon in a shape file to a grid point to create a map of tessellated hexagons. The spatial relationships of areas are preserved while the geographic shape of each area is lost.

create_hexmap(
  shp,
  sf_id,
  hex_size = NULL,
  buffer_dist = NULL,
  hex_filter = 10,
  f_width = 30,
  focal_points = NULL,
  order_sf_id = NULL,
  export_shp = FALSE,
  verbose = FALSE
)

Arguments

shp

a shape file, if class is SPDF, will be converted to sf

sf_id

name of a unique column that distinguishes areas

hex_size

a float value in degrees for the diameter of the hexagons

buffer_dist

distance in degrees to extend beyond the geometry provided

hex_filter

amount of hexagons around centroid to consider

f_width

the angle used to filter the grid points around a centroid

focal_points

a data frame of reference locations when allocating hexagons, capital cities of Australia are used in the example

order_sf_id

a string name of a column to order by for allocating

export_shp

export the simple features set

verbose

a boolean to indicate whether to show function progress

Value

a data set containing longitude and latitude of allocated hexagon points for each non null geometry passed in the shape file

Examples


data(tas_lga)
# Smaller set for faster example
tas_lga_sub <- tas_lga[1:10,] 
data(capital_cities)
hexmap <- create_hexmap(
  shp = tas_lga_sub,
  sf_id = "lga_code_2016",
  hex_filter = 3,
  focal_points = capital_cities, 
  verbose = TRUE)
#> Buffer set to 0.9084 degrees.
#> Converted hexagon size to 0.1717 degrees.
#> Filter set to 0.5152 degrees.
#> Finding closest point in focal_points data set.
#> Allocating centroids, in order of distance to closest focal point.
#> 
#> Filter distance was expanded for  22 area(s).