Skip to content

sbf_save_plot() should drop geometry column before saving xlsx #185

Description

@StefanoMezzini

Problem:

sbf_save_plot() fails to save the xlsx when the plot has a spatial layer because it can't save the geometry column in an xlsx file.

Steps to reproduce this behaviour:

library(sf)
library(ggplot2)
library(subfoldr2)

shp <- st_as_sf(data.frame(x = c(1, 2), y = c(10, 15)),
                coords = c("x", "y"))

ggplot(shp) + geom_sf()

sbf_save_plot(last_plot(), "plot", caption = "Caption.")
# Error:
# ! writexl cannot write column(s) of these types:
#   'geometry' (column 1): sfc_POINT/sfc (list)

Expected output/desired solution:

Drop the geometry column before saving the plot.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions