You’ll need the new version of the mapmisc package
install.packages("mapmisc",
repos="http://r-forge.r-project.org")
library('mapmisc')
## Loading required package: terra
## terra 1.8.54
## map images will be cached in /var/folders/jg/qlm9ks895mg7y2y27yrl_bqw0000gn/T//RtmpzAZCbN/mapmiscCache
consider the following code.
mycoords = rbind(c(-2.785556, 54.010278), c(-2.736, 53.761 ))
patrick = vect(mycoords,
atts=data.frame(name=c('Work','Home')),
crs='+init=epsg:4326') # long-lat
patrick = project(patrick, mapmisc::omerc(patrick, angle=45))
#patrick = project(patrick, "epsg:27700") # uk national grid
theMap = openmap(patrick, buffer=1000*c(15,15,5,5), fact=2) # 15km extra left,right, 5km north, south
map.new(theMap)
plot(theMap, add=TRUE)
plot(patrick, add=TRUE, col='blue')
mapmisc::scaleBar(crs(patrick), 'topleft', bg='white', cex=2)
forInset = openmap(patrick, buffer=500*1000)
mapmisc::insetMap(crs(patrick), 'topright', map=forInset,
inset=0, width=0.4)
It makes a map showing where I lived during my PhD years, and the location of Lancaster University.
text
function to label the pointsUse your dataset of interest to make a map involving polygons. Or if you prefer do the following.
On the web site sites.wustl.edu/acag/datasets/surface-pm2-5/#V6.GL.02.04 there are images of particulate matter concentrations worldwide. I downloaded the 2020 global image from wustl.app.box.com/s/y143mciw7jz7ft2qe3hccjw65m3xe8f2/folder/327753085334, saved it in my Downloads folder and
myPath = normalizePath('~/Downloads')
x= rast(file.path(myPath, "V6GL02.04.CNNPM25.GL.202001-202012.nc"))
brazil = project(
geodata::gadm("BRA", level=1, path=myPath),
crs(x))
xCrop = crop(x, ext(brazil))
xCrop[xCrop<= 0] <- NA
myCol = mapmisc::colourScale(xCrop, breaks=9, style='equal', col='RdYlGn', rev=TRUE, transform='sqrt',dec=0)
map.new(xCrop)
plot(xCrop, col=myCol$col, breaks=myCol$breaks, legend=FALSE, add=TRUE)
plot(brazil, add=TRUE, border='red')
legendBreaks('bottomright', myCol)
Make a map of a raster related to your project. Or if you prefer use one of the datasets from the following web sites measure nighttime light using satelites.
Choose an interesting part of the planet (your hometown? North
Korea? Tierra del Fuego?) and plot the lights image.
put one or two interesting cities or places on the map