Closed mitchelloharawild closed 2 years ago
library(hexmap)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
australia <- ozmaps::abs_ste %>% filter(NAME != "Other Territories")
grid <- hex_grid(australia, n_tiles = 8)
#> Warning: attribute variables are assumed to be spatially constant throughout all
#> geometries
grid <- tile_allocate(australia, grid)
library(ggplot2)
ggplot() +
geom_sf(data = australia) +
geom_sf(data = grid, aes(fill = NAME), alpha = 0.2)
Created on 2022-10-13 by the reprex package (v2.0.1)
Here's what I get from geogrid's hungarian implementation, first step would be making sense of the allocation matrix and using it to join the hexagons onto the original data (
oz_electorates
) so you can plot them with additional info (say colour filling the hexagons by state)Created on 2022-10-07 by the reprex package (v2.0.1)