R version 4.4.0 beta (2024-04-14 r86421 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\RtmpsxtkwD/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") [1] "D:\\temp\\RtmpsxtkwD/mapmiscCache" > #' > > #+ 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, verbose=TRUE) http://tile.openstreetmap.org/ http://tile.openstreetmap.org/ downloading http://tile.openstreetmap.org/1/0/0.png trying URL 'http://tile.openstreetmap.org/1/0/0.png' Content type 'image/png' length 8947 bytes ================================================== downloaded 8947 bytes downloading http://tile.openstreetmap.org/1/0/1.png trying URL 'http://tile.openstreetmap.org/1/0/1.png' Content type 'image/png' length 2983 bytes ================================================== downloaded 2983 bytes downloading http://tile.openstreetmap.org/1/1/0.png trying URL 'http://tile.openstreetmap.org/1/1/0.png' Content type 'image/png' length 9489 bytes ================================================== downloaded 9489 bytes downloading http://tile.openstreetmap.org/1/1/1.png trying URL 'http://tile.openstreetmap.org/1/1/1.png' Content type 'image/png' length 3370 bytes ================================================== downloaded 3370 bytes reprojecting reprojecting: 5 cycles:1 2 3 4 4 poles: north poles: south > > plot(myMap) > 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 17.59 1.07 18.89