Skip to content

Handle when geometry is not a symbol #4127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

yutannihilation
Copy link
Member

Fix #4122

Currently, LayerSf$setup_layer() uses as_name(self$mapping$geometry) in the assumption that geometry is a quosure of a symbol, which is not always the case. Possible fix would be

  1. actually evaluate it
  2. give up guessing the type nicely

and I chose option 2. because option 1. seems too much for this rare use case.

devtools::load_all("~/repo/ggplot2")
#> Loading ggplot2

nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
ggplot(nc) +
  geom_sf(aes(fill = AREA, geometry = sf::st_centroid(geometry)))
#> Warning in st_centroid.sfc(geometry): st_centroid does not give correct
#> centroids for longitude/latitude data

#> Warning in st_centroid.sfc(geometry): st_centroid does not give correct
#> centroids for longitude/latitude data

Created on 2020-07-10 by the reprex package (v0.3.0)

Copy link
Member

@clauswilke clauswilke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this makes sense.

@yutannihilation yutannihilation merged commit dcad61a into tidyverse:master Jul 10, 2020
@yutannihilation
Copy link
Member Author

Thanks.

@yutannihilation yutannihilation deleted the fix/issue-4122-ingore-non-symbol-geometry-aes branch July 10, 2020 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in geom_sf()? Unable to convert call to string when processing geometry aesthetic at print.
2 participants