georeference_overlay: Georeference image overlays based on a reference raster

Description Usage Arguments Value See Also Examples

View source: R/georeference_overlay.R

Description

This function georeferences an image overlay based on a reference raster, setting the extent and CRS of the image to those of the raster file. To georeference multiple images and merge them into a single file, see [merge_rasters].

Usage

1
2
3
4
5
georeference_overlay(
  overlay_file,
  reference_raster,
  output_file = tempfile(fileext = ".tif")
)

Arguments

overlay_file

The image overlay to georeference. File format will be detected automatically from file extension; options include 'jpeg/jpg', 'png', and 'tif/tiff'.

reference_raster

The raster file to base georeferencing on. The output image will have the same extent and CRS as the reference raster. Accepts both Raster* objects from the 'raster' package or a file readable by [raster::raster].

output_file

The path to write the georeferenced image file to. Must be a TIFF.

Value

The file path written to, invisibly.

See Also

Other data manipulation functions: combine_overlays(), merge_rasters(), raster_to_raw_tiles(), vector_to_overlay()

Other overlay creation functions: combine_overlays(), vector_to_overlay()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
simulated_data <- data.frame(
  id = seq(1, 100, 1),
  lat = runif(100, 44.1114, 44.1123),
  lng = runif(100, -73.92273, -73.92147)
)

simulated_data <- sf::st_as_sf(simulated_data, coords = c("lng", "lat"))

downloaded_tiles <- get_tiles(simulated_data,
                              services = c("elevation", "ortho"),
                              georeference = FALSE)

georeference_overlay(
  overlay_file = downloaded_tiles[[2]],
  reference_raster = downloaded_tiles[[1]],
  output_file = tempfile(fileext = ".tif")
)

## End(Not run)

terrainr documentation built on Feb. 23, 2021, 9:06 a.m.