R version 4.4.0 beta (2024-04-10 r86396 ucrt) -- "Puppy Cup" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > #+ setup > options(warn=1) > > library('mapmisc') Loading required package: terra terra 1.7.71 map images will be cached in D:\temp\RtmpmoaOQp/mapmiscCache > > #if(!exists('mapmiscCachePath')) > # mapmiscCachePath = system.file('extdata', package='mapmisc') > > #if(!exists('mapmiscCacheReadOnly')) > # mapmiscCacheReadOnly = TRUE > > #mapmiscCachePath > > #options( > # mapmiscCachePath = mapmiscCachePath, > # mapmiscCacheReadOnly = mapmiscCacheReadOnly, > # mapmiscVerbose=TRUE) > > #getOption("mapmiscCachePath") > #getOption("mapmiscCacheReadOnly") > #' > > #+ themaps, fig.cap='some maps', fig.subcap = c('projectable region', 'projected, with bg','projected, with world countries','projectable madagascar','madagascar') > > > data("worldMap") > worldMap = unwrap(worldMap) > > world = project(worldMap, crsLL) > country='Japan' > x=world[grep(country, world$NAME)] > > myCrsO = moll(x) > if(!interactive()) pdf("worldMap.pdf") > > plot(world, ylim = 90.5*c(-1,1)) > plot(attributes(myCrsO)$crop, + border='red', col='#0000FF10', add=TRUE) > > #x = myCrsO;zoom=1;fact=0.7;path='osm';crs = crs(x);buffer=0;verbose=TRUE;cachePath = tempdir();suffix=NULL > > myMap = openmap(myCrsO, zoom=1, fact=0.7) > > map.new(myMap) > plot(myMap, add=TRUE) > plot(attributes(myCrsO)$ellipse, add=TRUE, border='black') > gridlinesWrap(myCrsO, lty=2, col='orange') > > xTcrop = wrapPoly(x=world, crs=myCrsO) > > DcountryT = grep(country, xTcrop$NAME) > > map.new(xTcrop, buffer=1000*1000) > plot(attributes(myCrsO)$ellipse, add=TRUE, col='lightBlue', border='blue') > plot(xTcrop,add=TRUE, col='grey') > plot(xTcrop[DcountryT,], col='red', lty=0, add=TRUE) > > gridlinesWrap(myCrsO, lty=2, col='orange') > > > country='Madagascar' > Dcountry = grep(country, world$NAME) > x=world[Dcountry,] > > myCrsMoll = moll(x) > > plot(world) > plot(attributes(myCrsMoll)$crop, border='red', col='#0000FF10', add=TRUE) > > > xTcrop = wrapPoly(x=world, crs=myCrsMoll) > plot(attributes(myCrsMoll)$ellipse, col='lightBlue') > plot(xTcrop, add=TRUE, col='white') > > DcountryT = grep(country, xTcrop$NAME) > > map.new(xTcrop) > plot(attributes(myCrsMoll)$ellipse, add=TRUE, col='lightBlue', border='blue') > plot(xTcrop,add=TRUE, col='grey') > plot(xTcrop[DcountryT,], col='green', add=TRUE) > > gridlinesWrap(crs=myCrsMoll, lty=2, col='red') > > > > country='Iceland' > Dcountry = grep(country, world$NAME) > x=world[Dcountry,] > > myCrsMoll = moll(x, angle=10) > xTcrop = wrapPoly(x=world, crs=myCrsMoll) > > plot(attributes(myCrsMoll)$ellipse, col='lightBlue') > plot(xTcrop, add=TRUE, col='white') > > plot(world) > plot(attributes(myCrsMoll)$crop, border='red', col='#0000FF10', add=TRUE) > > DcountryT = grep(country, xTcrop$NAME) > > map.new(myCrsMoll, col='lightBlue') > plot(xTcrop,add=TRUE, col='grey') > gridlinesWrap(crs=xTcrop, lty=2, col='red') > plot(xTcrop[DcountryT,], col='green', add=TRUE) > > > # check openmap > myMap = openmap(myCrsMoll) > plot(myMap) > > if(!interactive()) dev.off() null device 1 > > #' > > > > proc.time() user system elapsed 27.90 2.31 30.31