Strange horizontal lines when transforming base-map shapefile?

13 Views Asked by At

I am currently working on a project where i require a basemap shapefile of the world, but the centre needs to be on the Pacific Ocean. The result from the code i am using below centres the map where i want it, but has strange horizontal lines across it that i cannot get rid of. If anyone has a workround for this it would be appreciated.

# Load required packages
library(sf)

# Load shapefile
countries <- st_read("~/RJack/JackORCA/data/countries/ne_50m_admin_0_countries_lakes.shp")

# Define desired projection (Plate Carrée with Pacific Ocean at center)
desired_proj <- "+proj=eqc +lat_ts=0 +lon_0=-155 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs"

# Transform projection
shapefile_transformed <- st_transform(countries, crs = desired_proj)

# Buffer the geometries slightly
buffered_shapefile <- st_buffer(shapefile_transformed, dist = 0.0001)

# Save transformed and buffered shapefile
st_write(buffered_shapefile, "transformed_buffered_shapefile.shp", append = FALSE)

# Map occurrence records:
new_countries <- vect("transformed_buffered_shapefile.shp")
plot(new_countries, border = "grey")`

img1

img2

I have tried ChatGPT and simplifying the geometries to no result.

0

There are 0 best solutions below