using this as R code:
install.packages(c("tilemaps", "sf"))
library(tilemaps)
library(sf)
library(dplyr)
library(ggplot2)
governors <- governors %>%
mutate(tile_map = generate_map(geometry, square = FALSE, flat_topped = TRUE))
head(governors)
ggplot(governors) +
geom_sf(aes(geometry = tile_map)) +
geom_sf_text(aes(geometry = tile_map, label = abbreviation),
fun.geometry = function(x) st_centroid(x)) +
theme_void()
I am trying to build a Canadian Tile map. I got the geometry (lpr_000b16a_e.shp found https://open.canada.ca/data/en/dataset/47bd4f2e-1c77-49f8-8406-dc4dca64ee6b) from statistics Canada.
when I am using the R code above, I am getting this error:
Error: Problem with mutate()
input tile_map
.
x regions are not contiguous i Input tile_map
is `generate_map(geometry, square = FALSE, flat_topped = TRUE)
How can I create a tile map of the Canada provinces?