I would like to use the worldMap from rworldMap, but need this in UTM projection rather than long/lat. I first clip the map to my area of interest. How do I then convert this to UTM projection? My code below does not seem to work:
library(rworldmap)
library(rgeos)
library(raster)
# load land
worldMap <- getMap(resolution = "high")
# polygon holding area of interest in lat/long
CP <- as(extent(-70, -55, -60, -38), "SpatialPolygons")
projection(CP) <- "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"
# clip world map to area of interest
map.cp <- crop(worldMap, CP, byid = TRUE)
plot(map.cp)
# polygon holding area of interest in utm
CP.utm <- as(extent(-1000, 1500000, -6500000, -5000000), "SpatialPolygons")
projection(CP.utm) <- "+proj=utm +zone=20 +datum=WGS84 +units=m +no_defs"
projection(CP.utm)
# make projection of map.cp same as CP.utm
map.cp.utm <- map.cp
projection(map.cp.utm) <- CRS(proj4string(CP.utm))
projection(map.cp.utm)
# this shows that something is not right
plot(CP.utm)
plot(map.cp.utm, add = T)