I am using the cshapes package in R as a source of historically accurate country borders. While the default WGS 84 maps plot fine, I would like to reproject the maps. This introduces some distortions that I'm guessing are related to underlying issues in the map data:

  1. How can I correctly reproject and plot a cshapes map in R?
  2. If the distortion issue really is related to underlying map data issue, how can I fix these?

Here is a default WGS 84 map, which looks fine:

enter image description here

But when attempting to plot a Robinson projected map, distortion near 180 longitude:

enter image description here

The associated shapefile is here.

I created these maps in R using the following code:


# Get map data and plot with default CRS (WGS 84)
wmap <- cshp(date=as.Date("2012-06-30"))
wmap_df <- fortify(wmap)

ggplot(wmap_df, aes(long,lat, group=group)) + 
  geom_polygon() + 
  labs(title="World map (longlat)") + 

ggsave("~/Desktop/map1.png", height=4, width=7)

# Reproject to Robinson
wmap_robin <- spTransform(wmap, CRS("+proj=robin"))
wmap_df_robin <- fortify(wmap_robin)
ggplot(wmap_df_robin, aes(long,lat, group=group)) + 
  geom_polygon() + 
  labs(title="World map (robinson)") + 

ggsave("~/Desktop/map2.png", height=4, width=7)

# Export original map data
writeOGR(wmap, ".", "wmap_wgs84", driver="ESRI Shapefile")

Additional info:

  1. Duplicate of original question on SO, someone over there suggested I try to get help here.
  2. I know there are many other sources for country borders, but I'm tied to cshapes for historically accurate maps.
  3. I'm using GDAL 1.11.3, installed via homebrew, and Proj4 4.9.2. I built rgdal from source against these.
  4. Part of my problem is that I don't know what terms to even search for for this issue, any help would be great.

There is a similar question here, which indicates that the problem is that Russia and a Pacific island exceed 180°E. However, the answers provided are either implemented in QGIS, not R, or are based on removing vertices, which is problematic for me because I want to eventually use the maps to make thematic maps (i.e. countries with color fill).

  • 1
    This is related problem, but not a duplicate question. The problem looks the same, but the solution is different. Nov 11, 2015 at 17:53
  • Whether an answer is accepted or not is more or less irrelevant because many users do not learn to accept before leaving the site. Highly upvoted answers are usually far more valuable.
    – PolyGeo
    Nov 12, 2015 at 10:09
  • Ok, thanks for clarifying that, I edited accordingly.
    – andybega
    Nov 12, 2015 at 10:22

1 Answer 1


You can use raster::crop to remove nodes that are just smaller than -180 or larger than 180


wmap <- cshp(date=as.Date("2012-06-30"))
w <- crop(wmap, extent(-180, 180,-90,90))
w_robin <- spTransform(w, CRS("+proj=robin"))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.