Description Usage Arguments Details Value Examples
User clicks are collected in a controlled way for use by domath()
.
1 | affinething(x, rgb = FALSE)
|
x |
a raster |
rgb |
use RGB plot for a raster with 3 layers |
Obtain control points for the simple affine transform (offset and scale) on an ungeoreferenced image.
matrix of x,y coordinates in the space of the current raster extent
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Not run:
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!
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.