walkerke / mapboxapi

R interface to Mapbox web services
https://walker-data.com/mapboxapi/
Other
110 stars 8 forks source link

layer_spatial() method for static tiles results in error "... cannot transform sfc object with missing crs" #41

Closed jdsher closed 1 year ago

jdsher commented 1 year ago

Hi, and once again thank you for your work on all your packages, Kyle. A new error has cropped up, possibly rooted in some new update to ggplot2 or ggspatial, but I figured I would post here since it seems at this point to be isolated to mapbox tiles, but the layer_spatial() method of plotting my static basemaps (as well as when I attempt to use the toy example from the get_static_tiles() reference page) now results in this new error:

ggplot() +
    layer_spatial(ny_tiles) +
    geom_sf(data = ny_tracts, fill = "navy", alpha = 0.5) +
    theme_void() +
    labs(caption = "Basemap (c) Mapbox, (c) OpenStreetMap")

Error in st_transform.sfc(X[[i]], ...) : 
  cannot transform sfc object with missing crs
elipousson commented 1 year ago

@jdsher It looks like updating {ggspatial} should fix this issue. I was able to reproduce your error but after updating {ggspatial} it was resolved.