Skip to content

spatialpack raster

Terminal window
spatialpack raster <command> [options]

Raster processing commands.

Convert rasters to COG format and compute DEM derivatives.

CommandDescription
raster aspectCompute aspect from a Digital Elevation Model.
raster cogConvert raster to Cloud Optimized GeoTIFF (COG).
raster hillshadeCompute hillshade from a Digital Elevation Model.
raster slopeCompute slope from a Digital Elevation Model.
raster vrtCreate VRT (Virtual Raster) mosaic from multiple rasters.
Terminal window
# Create VRT mosaic from multiple rasters
spatialpack raster vrt zone50.tif zone51.tif -o wa_dem.vrt
# Convert to Cloud Optimized GeoTIFF
spatialpack raster cog input.tif -o output.tif
# Convert with bounding box clip
spatialpack raster cog large.tif -o clipped.tif --bbox "115.5,-33.5,117.5,-31.0"
# Compute slope from DEM
spatialpack raster slope dem.tif -o slope.tif
# Compute aspect from DEM
spatialpack raster aspect dem.tif -o aspect.tif

Compute aspect from a Digital Elevation Model.

Outputs aspect in degrees from north (0-360) as a Cloud Optimized GeoTIFF. North = 0/360, East = 90, South = 180, West = 270.

Terminal window
spatialpack raster aspect DEM_PATH [options]

DEM_PATH — path (required)

Options:

OptionTypeDefaultDescription
-o, --outputpath-Output file path
--nodatafloat-9999NoData value for flat areas (default: -9999)
--compressiondeflate | lzw | zstddeflateCompression codec (default: deflate)
Terminal window
# Compute aspect
spatialpack raster aspect dem.tif -o aspect.tif

Convert raster to Cloud Optimized GeoTIFF (COG).

Creates an optimized GeoTIFF with internal tiling and overviews for efficient cloud streaming and visualization.

Terminal window
spatialpack raster cog INPUT_PATH [options]

INPUT_PATH — path (required)

Options:

OptionTypeDefaultDescription
-o, --outputpath-Output file path
--bboxtext-Bounding box for clipping: ‘minx,miny,maxx,maxy’ (e.g., ‘115.5,-33.5,117.5,-31.0’)
--crstextEPSG:4326Target CRS (default: EPSG:4326)
--compressiondeflate | lzw | zstddeflateCompression codec (default: deflate)
--blocksizeinteger512Internal tile size (default: 512)
--nodatafloat-NoData value to set
Terminal window
# Basic conversion
spatialpack raster cog input.tif -o output.tif
# Clip large raster to Perth region
spatialpack raster cog waz50.tif -o perth_dem.tif \
--bbox "115.5,-33.5,117.5,-31.0"
# Use ZSTD compression for smaller files
spatialpack raster cog input.tif -o output.tif --compression zstd

Compute hillshade from a Digital Elevation Model.

Creates a shaded relief visualization as a Cloud Optimized GeoTIFF.

Terminal window
spatialpack raster hillshade DEM_PATH [options]

DEM_PATH — path (required)

Options:

OptionTypeDefaultDescription
-o, --outputpath-Output file path
--azimuthfloat315.0Light source azimuth in degrees (default: 315 = NW)
--altitudefloat45.0Light source altitude in degrees (default: 45)
--z-factorfloat1.0Vertical exaggeration factor (default: 1.0)
--compressiondeflate | lzw | zstddeflateCompression codec (default: deflate)
Terminal window
# Default hillshade (NW illumination)
spatialpack raster hillshade dem.tif -o hillshade.tif
# Custom illumination angle
spatialpack raster hillshade dem.tif -o hillshade.tif --azimuth 45 --altitude 30

Compute slope from a Digital Elevation Model.

Outputs slope in percent (default) or degrees as a Cloud Optimized GeoTIFF.

Terminal window
spatialpack raster slope DEM_PATH [options]

DEM_PATH — path (required)

Options:

OptionTypeDefaultDescription
-o, --outputpath-Output file path
--unitspercent | degreespercentOutput units (default: percent)
--scalefloat1.0Ratio of vertical to horizontal units (default: 1.0)
--nodatafloat-9999NoData value (default: -9999)
--compressiondeflate | lzw | zstddeflateCompression codec (default: deflate)
Terminal window
# Compute slope in percent
spatialpack raster slope dem.tif -o slope.tif
# Compute slope in degrees
spatialpack raster slope dem.tif -o slope.tif --units degrees

Create VRT (Virtual Raster) mosaic from multiple rasters.

A VRT is a lightweight XML file that references the original rasters and presents them as a single virtual dataset, without copying data. This is efficient for combining large DEMs across multiple zones.

Terminal window
spatialpack raster vrt INPUT_PATHS [options]

INPUT_PATHS (one or more) — path (required)

Options:

OptionTypeDefaultDescription
-o, --outputpath-Output VRT file path
--resolutionfloat-Target resolution (uses highest resolution input if not specified)
--resamplingnearest | bilinear | cubic | lanczos | averagebilinearResampling method (default: bilinear)
--nodatafloat-NoData value to use
--separateflagfalsePlace each input in a separate band
Terminal window
# Create VRT from multiple DEMs
spatialpack raster vrt waz50.tif waz51.tif -o wa_dem.vrt
# Create VRT with specific resolution
spatialpack raster vrt *.tif -o mosaic.vrt --resolution 30
# Create multi-band VRT (each input as separate band)
spatialpack raster vrt red.tif green.tif blue.tif -o rgb.vrt --separate