1

I am trying to plot Russia from a shp-file, but Russia always comes up as in two parts. How do I get Russia back together in one piece?

I have tried several shp-files e.g. http://www.naturalearthdata.com/downloads/10m-cultural-vectors/ Admin 1 – States, Provinces ; Download without large lakes (14.11 MB) version 3.0.0

 shp <- readOGR("ne_10m_admin_1_states_provinces_lakes.shp")

Subset to Russia

names(shp)
rus <- shp[shp$admin == "Russia" , ]

x11()
plot(rus)

enter image description here

Stedy
  • 7,359
  • 14
  • 57
  • 77
Dr. Flow
  • 456
  • 5
  • 19
  • This is a known issues with Russia due to its size and crossing 180°. Perhaps this question can be of help: https://gis.stackexchange.com/questions/72621/how-to-render-area-that-crosses-180%C2%B0 – Stedy Sep 04 '17 at 06:01
  • Thank you Stedy. Would be interesting to have a R solution to the problem.. I don’t really know any GIS-programs. And sorry that the problem is not reproducible – Dr. Flow Sep 04 '17 at 10:54

1 Answers1

5

Since you want to plot it, you can fortify the shapefile to data frame, modify the longitude coordinates in the -180 region, & plot the result in ggplot:

library(rgdal); library(ggplot2)

# read in the shapefile & subset to Russia
shp <- readOGR(dsn = "ne_10m", layer = "ne_10m_admin_1_states_provinces_lakes")
rus <- shp[shp$admin == "Russia", ]

# fortify to data frame & modify longitude coordinates in the -180 region.
rus.fortify <- fortify(rus) %>%
  mutate(long = ifelse(long < -100, long + 180*2, long))

# plot to verify
ggplot(rus.fortify,
       aes(x = long, y = lat, group = group)) +
  geom_polygon(fill = "white", col = "black") +
  coord_map() #default projection is mercator

plot1: default mercator projection

I've also just learned from this post that you can specify different projection systems. Given how large Russia is, this ought to be relevant:

ggplot(rus.fortify,
       aes(x = long, y = lat, group = group)) +
  geom_polygon(fill = "white", col = "black") +
  coord_map("azequalarea")

plot2: equal area projection

Z.Lin
  • 28,055
  • 6
  • 54
  • 94
  • Perfect!! Thank you wery much Z.Lin. Erectly what I wanted. And the “coord_map("azequalarea")” was a great tip. – Dr. Flow Sep 04 '17 at 11:02