[GIS] Lines on reprojected sp objects with Mollweide projection

coordinate systemrsp

I'm having an odd problem such that when I reproject maps to a Mollweide projection in R using sp, I get additional lines stretching across the globe. What is going on here, and do you have any suggestions to fix it. Here's a reproductible example:

library(sp)
library(maps)
library(maptools)

worldmap <- map("world", plot=F)
plot(worldmap, type="l)

So far, so good. I get
worldmap

So now I reproject. This is a CRS I'm using to be compatible with some other projects. Note how world-spanning lines then crop up.

worldmapLines <- map2SpatialLines(worldmap,
                                  proj4string=CRS("+proj=longlat +datum=WGS84"))

worldM <- spTransform(worldmapLines,  
                      CRS("+proj=moll +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs"))

plot(worldM)

enter image description here

Best Answer

Your data exceeds the 180°E limit in eastern russia and some pacific island. If you want a good looking map in degrees, you have to cut your source data at 179.9°E/W.

See my answer here (though it deals with a pacific centered view)

QGIS display world country shape files centered on pacific ocean using Robinson, Miller Cylindrical or other projection