#!mathjax#
getOption('mapmiscCachePath')
## [1] "/var/folders/1s/zkmc02qn4k18r6jdtbb459hc0000gn/T//RtmpKFvkws"
getOption('mapmiscCacheReadOnly')
## [1] FALSE
if(testing) {
options(mapmiscVerbose = TRUE)
}
coords = rbind(Alert = c(-62.338889, 82.501389),
Qaanaaq = c(-69.238685,77.466335),
'Alex Fjord' = c(-75.999722, 78.9),
'Hans island' = c(-66.459722, 80.828056)
)
x = vect(coords,
atts=data.frame(name=rownames(coords)),
crs=crsLL)
data('worldMap')
worldMap = unwrap(worldMap)
map = openmap(x, path='osm',
maxTiles=12, buffer=c(30,3), fact=fact)
map.new(map)
plot(map,add=TRUE)
points(x)
text(x, label=x$name, pos=4)
scaleBar(x, 'bottom')
scaleBar(x, 'left', seg.len=0, bty='n')
plot of chunk osm
mapSat = openmap(x, path='opentopomap', maxTiles=4, buffer=c(30,3), fact=fact)
map.new(mapSat)
plot(mapSat,add=TRUE)
points(x)
text(x, label=x$name, pos=4)
scaleBar(x, 'bottom')
scaleBar(x, 'left', seg.len=0, bty='n')
plot of chunk mapquest
mapSat = openmap(x=x[x$name=='Hans island',],
path='esri-satellite', fact=fact,
buffer=c(8,6,1,1.5), zoom=5)
map.new(mapSat)
plot(mapSat,add=TRUE)
points(x, pch=1, col='red', cex=2)
text(x, label=x$name, pos=4)
scaleBar(x, 'bottomright')
plot of chunk satellite
omercCrs = omerc(x)
xMerc = project(x, omercCrs)
mapMerc = openmap(xMerc, path='opentopomap',
zoom=3, fact=fact,
buffer=c(3,2)*100*1000)
map.new(mapMerc)
plot(mapMerc,add=TRUE)
points(xMerc)
plot(wrapPoly(worldMap, omercCrs), add=TRUE)
## Warning: Point outside of projection domain (GDAL error 1)
## Warning: Point outside of projection domain (GDAL error 1)
## Warning: Point outside of projection domain (GDAL error 1)
## Warning: Point outside of projection domain (GDAL error 1)
## Warning: Point outside of projection domain (GDAL error 1)
## Warning: Point outside of projection domain (GDAL error 1)
## Warning: Point outside of projection domain (GDAL error 1)
## Warning: Point outside of projection domain (GDAL error 1)
## Warning: Point outside of projection domain (GDAL error 1)
## Warning: Point outside of projection domain (GDAL error 1)
## Warning: Point outside of projection domain (GDAL error 1)
## Warning: Point outside of projection domain (GDAL error 1)
## Warning: Point outside of projection domain (GDAL error 1)
## Warning: Point outside of projection domain (GDAL error 1)
## Warning: Point outside of projection domain (GDAL error 1)
## Warning: Point outside of projection domain (GDAL error 1)
## Warning: Point outside of projection domain (GDAL error 1)
## Warning: Point outside of projection domain (GDAL error 1)
## Warning: Point outside of projection domain (GDAL error 1)
## Warning: Reprojection failed, err = 2050, further errors will be suppressed on
## the transform object. (GDAL error 1)
text(xMerc, label=xMerc$name, pos=4, halo=TRUE)
scaleBar(xMerc, 'bottom', bty='n')
scaleBar(xMerc, 'left', seg.len=0, bty='n')
plot of chunk omerc
map = openmap(xMerc[grep("Hans", xMerc$name),],
path='opentopomap', fact=fact,
buffer=500, verbose=TRUE)
## zoom is 13 , 9 tiles
## opentopomap
## https://a.tile.opentopomap.org/
## downloading https://a.tile.opentopomap.org/13/2582/805.png
## downloading https://a.tile.opentopomap.org/13/2582/806.png
## downloading https://a.tile.opentopomap.org/13/2582/807.png
## downloading https://a.tile.opentopomap.org/13/2583/805.png
## downloading https://a.tile.opentopomap.org/13/2583/806.png
## downloading https://a.tile.opentopomap.org/13/2583/807.png
## downloading https://a.tile.opentopomap.org/13/2584/805.png
## downloading https://a.tile.opentopomap.org/13/2584/806.png
## downloading https://a.tile.opentopomap.org/13/2584/807.png
## reprojecting
## reprojecting: 6 cycles:1 2 3 4 5 5
map.new(map)
plot(map, add=TRUE)
points(xMerc, pch=4, col='red', cex=2)
text(xMerc, label=xMerc$name, pos=1, col='red', halo=TRUE)
scaleBar(xMerc, 'bottomleft')
plot of chunk hansisland
map = openmap(x[x$name=='Alex Fjord',],
path='opentopomap', zoom=4, fact=fact,
buffer=c(5,7,2,1.5), verbose=TRUE)
## opentopomap
## https://a.tile.opentopomap.org/
## downloading https://a.tile.opentopomap.org/4/4/1.png
## downloading https://a.tile.opentopomap.org/4/4/2.png
## downloading https://a.tile.opentopomap.org/4/5/1.png
## downloading https://a.tile.opentopomap.org/4/5/2.png
## reprojecting
## reprojecting: 2 cycles:1 1
map.new(map)
plot(map, add=TRUE)
points(x, pch=4, col='red', cex=2)
text(x, label=x$name, pos=1, col='red', halo=TRUE)
scaleBar(x, 'bottomleft')
plot of chunk nrcanAlex
crsA = crs("+init=epsg:3573")
theBox = llCropBox(crsA, buffer.width=100*1000, crop.distance = 5e7, crop.poles = FALSE, crop.leftright=TRUE, remove.holes=TRUE, cycles=4)
attributes(crsA)[names(theBox)] = theBox
x2 = project(x, crsA)
map = openmap(x2,
path='opentopomap', zoom=3, fact=fact,
buffer=c(5,7,3,7)*100*1000)
map.new(map)
plot(map, add=TRUE)
plot(wrapPoly(worldMap, crsA), add=TRUE)
gridlinesWrap(crsA,norths = seq(70,90,by=5), easts=0)
## Warning: Point outside of projection domain (GDAL error 1)
points(x2, pch=4, col='red', cex=2)
text(x2, label=x2$name, pos=1, col='red', halo=TRUE)
scaleBar(crsA, 'topleft', bty='n')
scaleBar(crsA, 'bottomright', bty='n')