I have created polygons with CRS = UTM (see here), which I need to transform to latitude/longitude. Some of my polygons cross the dateline, which causes the transformation to create a polygon that crosses the entire globe.
library(sp)
library(rgeos)
points <- data.frame(x = c(-179.5, 0), y = c(-50, -30))
coordinates(points) <- ~x+y
proj4string(points) <- '+init=epsg:4326'
points_sp <- spTransform(points, CRS('+init=epsg:32621')) # wrong zone, but ignored for example
# expand point to circle
circles <- gBuffer(points_sp, width = 1e+5)
# transform back to WGS84
circles_latlon <- spTransform(circles, CRS(proj4string(points)))
par(mfrow = c(1, 2))
plot(circles, axes = TRUE, main = 'UTM')
plot(circles_latlon, axes = TRUE, main = 'WGS84')
Is there a solution to split the polygons? Or and alternative solution that takes care of the dateline issue?