oswaldosantos / ggsn

R package to add north symbols and scale bars to maps created with ggplot or ggmap
http://oswaldosantos.github.io/ggsn/
GNU General Public License v2.0
161 stars 9 forks source link

Error in `st_geometry<-.data.frame`(`*tmp*`, value = NULL) : inherits(value, "sfc") || is.character(value) is not TRUE #45

Closed benscarlson closed 5 years ago

benscarlson commented 5 years ago

I updated to the latest development version ggsn (0.5.1) and I get this error.

Error inst_geometry<-.data.frame(tmp, value = NULL) : inherits(value, "sfc") || is.character(value) is not TRUE

The error is the same as the one described in this stack exchange post. It seems there is some issue with the line st_geometry(legend2) <- NULL.

https://stackoverflow.com/questions/55943227/new-error-when-fitting-a-ggsn-scale-bar-to-ggmap-object

Also, I believe that the sf library should be prefixed to the st_geometry call, so that users don't need to load sf library themselves. e.g. sf:st_geometry(legend2). After loading the sf library, I get the above message.

oswaldosantos commented 5 years ago

If version 0.5.2 solved the problem, close the issue please.

benscarlson commented 5 years ago

Problem fixed in 0.5.2. Thank you!