Skip to content
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

CRS Out of Date #69

Open
neellab-umd opened this issue Jul 4, 2023 · 0 comments
Open

CRS Out of Date #69

neellab-umd opened this issue Jul 4, 2023 · 0 comments

Comments

@neellab-umd
Copy link

Hi There -

I am getting the following error when I try to use urbnmapr maps as sf objects.
"old-style crs object detected; please recreate object with a recent sf::st_crs()"

The code I used is
counties_sf <- get_urbn_map("counties", sf = TRUE)

counties_sf %>%
ggplot(aes()) +
geom_sf(fill = "grey", color = "#ffffff")

Is there an easy workaround or are there plans to update the map CRSs?

I was trying to bring the map is as an sf object so I could plot a scale bar and north arrow. I don't seem to be able to add those things using ggspatial which works with sf objects. See errors with code below:

counties %>%
filter(state_name =="Florida") %>%
ggplot() +
geom_polygon( aes(long, lat, group = group),
color="black", fill = "gray80",size = 0.2) +
coord_map(projection = "albers", lat0 = 39, lat1 = 45)+
theme_map()+
theme(legend.position = c(0.1,0.6))+
ggspatial::annotation_scale(
location = "bl",
width_hint = 0.3,
height = unit(0.11, "cm"),
pad_x = unit(0.32, "in"),
pad_y = unit(0.15, "in"),
text_cex = 0.5,
text_pad = unit(0.05, "cm")
) +
ggspatial::annotation_north_arrow(
location = "bl",
which_north = "true",
pad_x = unit(0.27, "in"),
pad_y = unit(0.3, "in"),
height = unit(.8, "cm"),
width = unit(.8, "cm"),
style = north_arrow_fancy_orienteering
)

I am using RStudio 2023.06.0 Build 421
R version 4.3.1 "Beagle Scouts"
and urbnmapr 0.0.0.9002 that I installed 4 July 2023 from github

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

No branches or pull requests

1 participant