View source: R/get_pts_coords.R
| get_pts_coords | R Documentation |
Transform target point pixel coordinates into longitude/latitude coordinates using a set of Ground Control Points (GCPs). This function performs direct point-wise coordinate transformation without warping a raster.
get_pts_coords(gcp, target_pts, transform_method = "auto", lambda = 0)
gcp |
A data frame containing the Ground Control Points (GCPs). This
dataframe can be produced with the
|
target_pts |
A data frame containing the target points to transform. This dataframe must contain the following columns (any other column, such as an identifier for each point, is kept in the output):
|
transform_method |
A character string specifying the transformation
method to be used for warping the image. Options are |
lambda |
Numeric smoothing parameter used for thin plate spline
transformations ( |
Polynomial transformations are implemented using native linear models, while
thin plate spline transformations are implemented using
fields::Tps(). For thin plate splines, the x and y pixel coordinates
are rescaled by the same factor, so that distances between points are
proportional to distances in pixels, as in the GDAL thin plate spline used
by georeference_img().
Note that, when using tps as a method, fields::Tps() might print
"Grid searches over lambda (nugget and sill variances) with minima at
the endpoints". This is benign: fields::Tps() always searches for the
best smoothing parameter and reports when the best value is at the edge of
its search range, but the fit uses the value given in lambda.
A data frame containing:
All the columns of target_pts (including the pixel
coordinates).
longitude: Estimated longitude.
latitude: Estimated latitude.
pts_df <- readRDS(system.file(
"extdata/europe_gcp_georef.RDS",
package = "crstools"
))
target_df <- data.frame(pt_id = 1:2, x = c(477, 2014), y = c(554, 1311))
get_pts_coords(pts_df, target_df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.