make_manifest | R Documentation |
These functions crop 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. make_manifest also writes a "manifest" file and importer script which may be used to automatically import the tiles into Unity.
make_manifest(
heightmap,
overlay = NULL,
output_prefix = "import",
manifest_path = "terrainr.manifest",
importer_path = "import_terrain.cs"
)
transform_elevation(heightmap, side_length = 4097, output_prefix = "import")
transform_overlay(overlay, side_length = 4097, output_prefix = "import")
heightmap |
File path to the heightmap to transform. |
overlay |
File path to the image overlay to transform. Optional for make_manifest. |
output_prefix |
The file path to prefix output tiles with. |
manifest_path |
File path to write the manifest file to. |
importer_path |
File name to write the importer script to. Set to NULL to not copy the importer script. Will overwrite any file at the same path. |
side_length |
Side length, in pixels, of each output tile. If the raster
has dimensions not evenly divisible by |
manifest_path
, invisibly.
## Not run:
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)
make_manifest(temptiff, output_prefix = tempfile(), importer_path = NULL)
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.