flsgen_generate {rflsgen} | R Documentation |
Landscape raster generator
Description
Generate landscape raster from landscape structure
Usage
flsgen_generate(
structure_str,
structure_file,
terrain_file = NULL,
roughness = 0.5,
terrain_dependency = 0.5,
min_distance = 2,
min_max_distance = NULL,
connectivity = 4,
x = 0,
y = 0,
resolution_x = 1e-04,
resolution_y = NULL,
epsg = "EPSG:4326",
max_try = 2,
max_try_patch = 10,
verbose = TRUE
)
Arguments
structure_str |
JSON-formatted string describing the landscape structure to generate |
structure_file |
JSON file containing the landscape structure to generate |
terrain_file |
Path of input terrain raster file, or terra::rast object. If NULL a terrain is generated with the diamond-square algorithm |
roughness |
Roughness factor (or H), between 0 and 1 (only need when terrain_file is NULL) |
terrain_dependency |
Terrain dependency factor for landscape generation, between 0 and 1 |
min_distance |
Minimum distance between patches of a same class |
min_max_distance |
If defined, the minimum distance beween patches of a same class is defined by a variable buffer of width between min_distance and min_max_distance |
connectivity |
Connectivity definition in the regular square grid (4 or 8)." |
x |
X position (geographical coordinates) of the top-left output raster pixel |
y |
Y position (geographical coordinates) of the top-left output raster pixel |
resolution_x |
x spatial resolution (geographical units) of the output raster (i.e. pixel width) |
resolution_y |
y-spatial resolution (geographical units) of the output raster (i.e. pixel height), if null, resolution_x is used |
epsg |
EPSG identifier of the output projection |
max_try |
Maximum number of trials for landscape generation |
max_try_patch |
Maximum number of trials for patch generation |
verbose |
if TRUE print information about generation |
Details
The input landscape structure must be either specified as a JSON-formatted string (structure_str parameter) or as a JSON file (structure_file parameter)
Value
A terra::rast object
Examples
## Not run:
json <- "{
\"nbRows\" : 200,
\"nbCols\" : 200,
\"classes\" : [
{
\"name\" : \"Class A\",
\"NP\" : [1, 10],
\"AREA\" : [300, 4000],
\"CA\" : [1000, 5000],
\"MESH\" : [225, 225]
},
{
\"name\" : \"Class B\",
\"NP\" : [2, 8],
\"AREA\" : [200, 4000],
\"PLAND\" : [40, 40]
},
{
\"name\" : \"Class C\",
\"NP\" : [5, 7],
\"AREA\" : [800, 1200]
}
]
}"
structure <- flsgen_structure(targets_str = json)
landscape <- flsgen_generate(structure_str = structure)
## End(Not run)