Skip to contents

This function has been deprecated as of terrainr 0.5.0 in favor of the new function, make_manifest. While it will be continued to be exported until at least 2022, improvements and bug fixes will only be made to the new function. Please open an issue if any features you relied upon is missing from the new function!


raster_to_raw_tiles(input_file, output_prefix, side_length = 4097, raw = TRUE)



File path to the input TIFF file to convert.


The file path to prefix output tiles with.


The side length, in pixels, for the .raw tiles.


Logical: Convert the cropped tiles to .raw? When FALSE returns a .png.


Invisibly, a character vector containing the file paths that were written to.


This function crops input raster files into smaller square tiles and then converts them into either .png or .raw files which are ready to be imported into the Unity game engine.

See also

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

Other visualization functions: combine_overlays(), geom_spatial_rgb(), vector_to_overlay()


if (FALSE) {
if (!isTRUE(as.logical(Sys.getenv("CI")))) {
  simulated_data <- data.frame(
    id = seq(1, 100, 1),
    lat = runif(100, 44.04905, 44.17609),
    lng = runif(100, -74.01188, -73.83493)
  simulated_data <- sf::st_as_sf(simulated_data, coords = c("lng", "lat"))
  output_files <- get_tiles(simulated_data)
  temptiff <- tempfile(fileext = ".tif")
  merge_rasters(output_files["elevation"][[1]], temptiff)
  raster_to_raw_tiles(temptiff, tempfile())