Closed kaerosen closed 3 years ago
Hi, I was not able to recreate the error with the shapefile from the provided link. I was able to generate a tilemap of Canada using the following code.
library(dplyr)
library(ggplot2)
library(sf)
library(tilemaps)
ca <- st_read('lpr_000a16a_e.shp')
ca <- ca %>%
mutate(tile_map = generate_map(geometry, square = FALSE, flat_topped = TRUE))
ggplot(ca) +
geom_sf(aes(geometry = tile_map)) +
geom_sf_text(aes(geometry = tile_map, label = PREABBR),
fun.geometry = function(x) st_centroid(x)) +
theme_void()
Thank you very much, I was able to create the tile now.
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()
inputtile_map
. x regions are not contiguous i Inputtile_map
is `generate_map(geometry, square = FALSE, flat_topped = TRUE)How can I create a tile map of the Canada provinces?
Originally posted by @silpai in https://github.com/kaerosen/tilemaps/issues/3#issuecomment-751377562