spatialpack raster
Synopsis
Section titled “Synopsis”spatialpack raster <command> [options]Description
Section titled “Description”Raster processing commands.
Convert rasters to COG format and compute DEM derivatives.
Commands
Section titled “Commands”| Command | Description |
|---|---|
raster aspect | Compute aspect from a Digital Elevation Model. |
raster cog | Convert raster to Cloud Optimized GeoTIFF (COG). |
raster hillshade | Compute hillshade from a Digital Elevation Model. |
raster slope | Compute slope from a Digital Elevation Model. |
raster vrt | Create VRT (Virtual Raster) mosaic from multiple rasters. |
Examples
Section titled “Examples”# Create VRT mosaic from multiple rastersspatialpack raster vrt zone50.tif zone51.tif -o wa_dem.vrt
# Convert to Cloud Optimized GeoTIFFspatialpack raster cog input.tif -o output.tif
# Convert with bounding box clipspatialpack raster cog large.tif -o clipped.tif --bbox "115.5,-33.5,117.5,-31.0"
# Compute slope from DEMspatialpack raster slope dem.tif -o slope.tif
# Compute aspect from DEMspatialpack raster aspect dem.tif -o aspect.tifCommand Details
Section titled “Command Details”raster aspect
Section titled “raster aspect”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.
spatialpack raster aspect DEM_PATH [options]Arguments
Section titled “Arguments”DEM_PATH — path (required)
Options:
| Option | Type | Default | Description |
|---|---|---|---|
-o, --output | path | - | Output file path |
--nodata | float | -9999 | NoData value for flat areas (default: -9999) |
--compression | deflate | lzw | zstd | deflate | Compression codec (default: deflate) |
# Compute aspectspatialpack raster aspect dem.tif -o aspect.tifraster cog
Section titled “raster cog”Convert raster to Cloud Optimized GeoTIFF (COG).
Creates an optimized GeoTIFF with internal tiling and overviews for efficient cloud streaming and visualization.
spatialpack raster cog INPUT_PATH [options]Arguments
Section titled “Arguments”INPUT_PATH — path (required)
Options:
| Option | Type | Default | Description |
|---|---|---|---|
-o, --output | path | - | Output file path |
--bbox | text | - | Bounding box for clipping: ‘minx,miny,maxx,maxy’ (e.g., ‘115.5,-33.5,117.5,-31.0’) |
--crs | text | EPSG:4326 | Target CRS (default: EPSG:4326) |
--compression | deflate | lzw | zstd | deflate | Compression codec (default: deflate) |
--blocksize | integer | 512 | Internal tile size (default: 512) |
--nodata | float | - | NoData value to set |
# Basic conversionspatialpack raster cog input.tif -o output.tif
# Clip large raster to Perth regionspatialpack raster cog waz50.tif -o perth_dem.tif \ --bbox "115.5,-33.5,117.5,-31.0"
# Use ZSTD compression for smaller filesspatialpack raster cog input.tif -o output.tif --compression zstdraster hillshade
Section titled “raster hillshade”Compute hillshade from a Digital Elevation Model.
Creates a shaded relief visualization as a Cloud Optimized GeoTIFF.
spatialpack raster hillshade DEM_PATH [options]Arguments
Section titled “Arguments”DEM_PATH — path (required)
Options:
| Option | Type | Default | Description |
|---|---|---|---|
-o, --output | path | - | Output file path |
--azimuth | float | 315.0 | Light source azimuth in degrees (default: 315 = NW) |
--altitude | float | 45.0 | Light source altitude in degrees (default: 45) |
--z-factor | float | 1.0 | Vertical exaggeration factor (default: 1.0) |
--compression | deflate | lzw | zstd | deflate | Compression codec (default: deflate) |
# Default hillshade (NW illumination)spatialpack raster hillshade dem.tif -o hillshade.tif
# Custom illumination anglespatialpack raster hillshade dem.tif -o hillshade.tif --azimuth 45 --altitude 30raster slope
Section titled “raster slope”Compute slope from a Digital Elevation Model.
Outputs slope in percent (default) or degrees as a Cloud Optimized GeoTIFF.
spatialpack raster slope DEM_PATH [options]Arguments
Section titled “Arguments”DEM_PATH — path (required)
Options:
| Option | Type | Default | Description |
|---|---|---|---|
-o, --output | path | - | Output file path |
--units | percent | degrees | percent | Output units (default: percent) |
--scale | float | 1.0 | Ratio of vertical to horizontal units (default: 1.0) |
--nodata | float | -9999 | NoData value (default: -9999) |
--compression | deflate | lzw | zstd | deflate | Compression codec (default: deflate) |
# Compute slope in percentspatialpack raster slope dem.tif -o slope.tif
# Compute slope in degreesspatialpack raster slope dem.tif -o slope.tif --units degreesraster vrt
Section titled “raster vrt”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.
spatialpack raster vrt INPUT_PATHS [options]Arguments
Section titled “Arguments”INPUT_PATHS (one or more) — path (required)
Options:
| Option | Type | Default | Description |
|---|---|---|---|
-o, --output | path | - | Output VRT file path |
--resolution | float | - | Target resolution (uses highest resolution input if not specified) |
--resampling | nearest | bilinear | cubic | lanczos | average | bilinear | Resampling method (default: bilinear) |
--nodata | float | - | NoData value to use |
--separate | flag | false | Place each input in a separate band |
# Create VRT from multiple DEMsspatialpack raster vrt waz50.tif waz51.tif -o wa_dem.vrt
# Create VRT with specific resolutionspatialpack 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