User clicks are collected in a controlled way for use by domath()
.
affinething(x, rgb = FALSE)
x | a raster |
---|---|
rgb | use RGB plot for a raster with 3 layers |
matrix of x,y coordinates in the space of the current raster extent
Obtain control points for the simple affine transform (offset and scale) on an ungeoreferenced image.
# \donttest{ if (FALSE) { library(raster) r <- raster("my_unreferenced_raster.png") xy <- affinething(r) ## click on two points that you know a location of my_x <- c(1000, 2000) my_y <- c(-1000, -500) prj <- "+proj=laea +lon=147 +lat_0=-42" ## use your own map projection, that correspond to my_x/my_y pt <- cbind(my_x, my_y) ## now convert those control points to an extent for your raster ex <- domath(pt, xy, r, prj) ## now we can fix up the data r <- raster::setExtent(r, ex) raster::projection(r) <- prj ## hooray! } # }