# NOT RUN {
useWest=FALSE
useVers=c("2.2.0","2.2.3","2.3.0","2.3.4") # GSHHG versions
mapswitch = 5
for (i in c("land","rivers","borders"))
if (exists(i)) eval(parse(text=paste0("rm(",i,")")))
switch( mapswitch,
# 1. Canada------------------------------------------------
{vN=4; useWest=T; xlim=c(-150,-50)+360;ylim=c(40,75)},
# 2. NW Canada & America-----------------------------------
{vN=4; useWest=T;xlim=c(-136,-100)+360;ylim=c(40,75)},
# 3. Black Sea (user Ivailo)-------------------------------
{vN=4; xlim=c(27.5, 34.3); ylim=c(40.9, 46.7)},
# 4. W Europe, NW Africa (user Uli)------------------------
{vN=4; xlim=c(-20,10); ylim=c(20,50)},
# 5. W Europe + Iceland------------------------------------
{vN=4; xlim=c(-25, 20); ylim=c(40, 68)},
# 6. New Zealand-------------------------------------------
{vN=4; xlim=c(163, 182); ylim=c(-48,-34)},
# 7. Australia---------------------------------------------
{vN=4; xlim=c(112,155); ylim=c(-44,-10)},
# 8. Japan-------------------------------------------------
{vN=4; xlim=c(127,148); ylim=c(30,47)},
# 9. Central America---------------------------------------
{vN=4; useWest=T; xlim=c(-95,-60)+360;ylim=c(-10,25)},
#10. North Pacific-----------------------------------------
{vN=4; useWest=T; xlim=c(150,220); ylim=c(45,80)},
#11. Pacific Ocean-----------------------------------------
{vN=4; xlim=c(112,240); ylim=c(-48,80)},
#12. North Atlantic (world coordinates)--------------------
{vN=4; xlim=c(285,360); ylim=c(40,68)},
#13. North Atlantic (western hemisphere coordinates)-------
{vN=4; xlim=c(-75,0); ylim=c(40,68)},
#14. Atlantic Ocean----------------------------------------
{vN=4; xlim=c(285,380); ylim=c(-50,68)},
#15. Northern hemisphere-----------------------------------
{vN=4; xlim=c(-180,180); ylim=c(0,85)},
#16. Asia--------------------------------------------------
{vN=4; xlim=c(0,180); ylim=c(0,80)},
#17. North America-----------------------------------------
{vN=4; xlim=c(-180,0); ylim=c(0,80)},
#18. International date line-------------------------------
{vN=4; xlim=c(45,315); ylim=c(0,80)},
#19. Indian Ocean------------------------------------------
{vN=4; xlim=c(20,130); ylim=c(-40,40)},
#20. Moose County ("400 miles north of everywhere")--------
{vN=4; xlim=c(272.5,280.5); ylim=c(43,47.5)}
)
db=paste0("gshhg-bin-",useVers[vN]) # database version folder
gshhg = paste0("C:/Ruser/GSHHG/",db,"/") # directory with binary files
land = importGSHHS(paste0(gshhg,"gshhs_i.b"),
xlim=xlim,ylim=ylim,maxLevel=4,useWest=useWest)
rivers = importGSHHS(paste0(gshhg,"wdb_rivers_i.b"),
xlim=xlim,ylim=ylim,useWest=useWest)
borders = importGSHHS(paste0(gshhg,"wdb_borders_i.b"),
xlim=xlim,ylim=ylim,useWest=useWest,maxLevel=1)
if(exists("land")){
plotMap(land,xlim=xlim-ifelse(useWest,360,0),ylim=ylim,
col="lemonchiffon",bg="aliceblue")
if(!is.null(rivers)) addLines(rivers,col="blue")
if(!is.null(borders)) addLines(borders,col="red",lwd=2)
}
# }
Run the code above in your browser using DataLab