titan stack¶
Create multi-band rasters from multiple files.
titan stack [-h] [-l path] [--te xmin ymin xmax ymax]
[--tr xres [yres ...]] [--t_srs output_projection]
[-r RESAMPLING [RESAMPLING ...]]
[--overlay {intersection,union}] [--ot data_type]
[--of raster_format] [--dstnodata value]
[--blocksize xsize ysize]
input_files) [input_file(s ...] output_file
positional arguments:
input_file(s) Input file(s)
output_file The output raster path.
optional arguments:
-h, --help show this help message and exit
-l path, --like path Raster or vector template for the output stack.
Exclusive with --te and --t_srs.
--te xmin ymin xmax ymax
Geographic extent
--tr xres [yres ...] Output resolution
--t_srs output_projection
Spatial reference of the output file
-r RESAMPLING [RESAMPLING ...], --resampling RESAMPLING [RESAMPLING ...]
Per-dataset resampling type. If only one value is
passed, it is used for all datasets.
--overlay {intersection,union}
Method for determining bounds for overlapping
datasets.
--co creation_option [creation_option ...]
GDAL creation option arguments
--ot data_type GDAL data type
--of raster_format GDAL driver format
--dstnodata value Output nodata value
--blocksize xsize ysize
The raster processing block size.
This tool generalizes a common geoprocessing task: stacking multiple raster datasets into a single multi-band file. It includes utilities to modify the output spatial extent and resolution of the stacked data, which distinguishes it from general tools like rio stack
that assume matching extents and resolutions.
Stacking methods¶
Raster files often have different geographic extents, projections, and resolutions. titan-stack.py
handles these difference via three primary modes for stacking data.
Using a template dataset with --like
¶
The --like
option allows you to pass a raster or vector file to define the output dimensions of the data. For raster templates, it will use the extent, resolution, and projection verbatim.
For vector templates, it will use the extent and projection verbatim, then infer the output resolution based on the vector's projection. You can override this behavior by explicitly setting the --tr
option.
Specifying the output dimensions¶
You can control the output dimensions by setting the target extent (--te
), the target projection (--t_srs
) and the target resolution (--tr
). This allows fine-scale geographic control over the output dimensions.
Inferring parameters from the input data¶
titan-stack.py
gets the extent, projection, resolution and nodata from the first input file if these options aren't passed. These can all be specified explicitly using the appropriate command line flags.
There are two methods that to infer the output spatial extent, which are controlled by --overlay
.
Use "intersection" to use the intersecting spatial extents of the data, and "union" to use the full spatial extent of overlap between data. nodata
will be written to areas of overlap where the input rasters don't intersect.
Resampling¶
You can specify multiple resampling options to handle different input datasets differently. You can do this with -r average nearest
to resample two input files using different options. If you just specify a single resampling option, it will use that for all input rasters. The default uses nearest neighbor resampling for all inputs.