2017-09-04 90 views
1

我想從一個shp文件繪製俄羅斯,但俄羅斯總是出現在兩部分。我如何將俄羅斯整合到一起?俄羅斯劇情分裂爲兩個

我試過了幾個shp文件,例如 http://www.naturalearthdata.com/downloads/10m-cultural-vectors/ 管理員1 - 州,省;下載沒有大的湖泊(14.11 MB)版本3.0.0

shp <- readOGR("ne_10m_admin_1_states_provinces_lakes.shp") 

子集到俄羅斯

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

x11() 
plot(rus) 

enter image description here

+0

這是一個已知的問題與俄羅斯由於其規模和跨越180°。也許這個問題可以幫助:https://gis.stackexchange.com/questions/72621/how-to-render-area-that-c​​rosses-180%C2%B0 – Stedy

+0

謝謝你Stedy。對於這個問題有一個R解決方案會很有趣..我真的不知道任何GIS程序。對不起,這個問題是不可複製的 –

回答

2

既然要繪製它,可以鞏固shape文件到數據幀,修改-180區域的經度座標,&繪製結果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

我也剛剛從this post瞭解到,您可以指定不同的投影系統。鑑於大俄羅斯是怎麼了,這應該是相關的:

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

plot2: equal area projection

+0

完美!謝謝你很多Z.Lin。正確地我想要的。而「coord_map(」azequalarea「)」是一個很棒的提示。 –