affinething {affinity} | R Documentation |
Use affine logic interactively georegister a raster
Description
User clicks are collected in a controlled way for use by domath()
.
Usage
affinething(x, rgb = FALSE)
Arguments
x |
a raster |
rgb |
use RGB plot for a raster with 3 layers |
Details
Obtain control points for the simple affine transform (offset and scale) on an ungeoreferenced image.
Value
matrix of x,y coordinates in the space of the current raster extent
Examples
## 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)
[Package affinity version 0.2.5 Index]