ropensci / rnaturalearth

An R package to hold and facilitate interaction with natural earth map data :earth_africa:
http://ropensci.github.io/rnaturalearth/
Other
217 stars 23 forks source link

Coastline rendering with World Robinson (etc) projection #53

Closed AndyBunn closed 1 year ago

AndyBunn commented 2 years ago

Not sure if this is a bug exactly. But I'm wondering about getting a clean coastline plot with the 110 scale. E.g., this looks fine:

coastlines <- rnaturalearth::ne_coastline(scale = 100, returnclass = "sf")
ggplot() + geom_sf(data = coastlines)  +
  cowplot::theme_minimal_grid()

Whereas these do not because of the scale and the wrapping at the edges.

ggplot() + geom_sf(data = coastlines) + 
  coord_sf(crs = sf::st_crs("ESRI:54030")) +
  cowplot::theme_minimal_grid()

ggplot() + geom_sf(data = coastlines) + 
  coord_sf(crs = sf::st_crs("ESRI:54009")) +
  cowplot::theme_minimal_grid()

These render fine at scale=50. Any tips for a clean plot at scale=110 and crs 54030 appreciated.

mps9506 commented 2 years ago

See: https://github.com/r-spatial/sf/issues/1372

This worked for me.

ggplot() + 
  geom_sf(data = st_wrap_dateline(coastlines))  +
  coord_sf(crs = st_crs('ESRI:54030')) +
  cowplot::theme_minimal_grid()