2017-03-08 15 views
1

海岸国境を強調して国を描​​きたい。私はほぼが働く以下のテクニックを持っています。国のために沿岸国境を描く方法

library(rworldmap) 
library(rgeos) 
library(maps) 

data("countriesCoarseLessIslands") 
data("coastsCoarse") 

country <- "Argentina" 

countryOutline <- countriesCoarseLessIslands[countriesCoarseLessIslands$NAME %in% country,] 
maps::map(countryOutline,col="light grey",fill=TRUE,border=0) 
coastalBorder <- gIntersection(coastsCoarse,countryOutline) 
plot(coastalBorder, col="blue",lwd=2,add=TRUE) 

出力:

enter image description here

私は改善したい二つの側面があります。

まず、海岸の不連続を取り除くにはどうすればよいですか(アルゼンチンの画像を参照)。オーバーラップを決定する際に曖昧さを許容する関数またはメソッド(rgeosまたはどこに)がありますか?

第2に、高解像度の地図ポリゴンと同様のことをどうすればいいですか?

答えて

0

あなたのアプローチは、あなただけのより寛容であることをgIntersectionためsetScaleを使用して規模を縮小する必要があり、非常に細かいです:

library(rworldmap) 
library(rgeos) 
library(maps) 

data("countriesCoarseLessIslands") 
data("coastsCoarse") 

country <- "Argentina" 

countryOutline <- countriesCoarseLessIslands[countriesCoarseLessIslands$NAME %in% country,] 
maps::map(countryOutline,col="light grey",fill=TRUE,border=0) 

setScale(1e+04) # Change Tolerance to avoid dicontinuities 

coastalBorder <- gIntersection(coastsCoarse,countryOutline) 
plot(coastalBorder, col="blue",lwd=2,add=TRUE) 

enter image description here

+0

おかげで多くの。許容誤差のためのスケールを設定する能力には注意を払わなかった。 – avsmith