GRASS logo

NAME

r.buildvrt.gdal - Build GDAL Virtual Rasters (VRT) over GRASS GIS raster maps

KEYWORDS

raster, virtual, gdal, patch

SYNOPSIS

r.buildvrt.gdal
r.buildvrt.gdal --help
r.buildvrt.gdal [-mr] [input=name[,name,...]] [file=name] [vrt_directory=name] output=name [--overwrite] [--help] [--verbose] [--quiet] [--ui]

Flags:

-m
Read data range from metadata
WARNING: metadata are sometimes approximations with wrong data range
-r
Create fast link without data range
WARNING: some modules do not work correctly without known data range
--overwrite
Allow output files to overwrite existing files
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--ui
Force launching GUI dialog

Parameters:

input=name[,name,...]
Name of input raster map(s)
file=name
Name of input file
vrt_directory=name
Directory to store GDAL VRT files in. Default is: $GISDBASE/$PROJECT/$MAPSET/gdal
output=name [required]
Name for output raster map

Table of contents

DESCRIPTION

r.buildvrt.gdal builds GDAL virtual rasters over GRASS GIS raster maps and links them to the mapset with r.external. The module is written as a workaround for a limitation in GRASS GIS Virtual Rasters (VRT) format with GDAL-linked raster maps (through r.external / r.external.out. In that case GRASS GIS Virtual Rasters currently show performance issues. See: #4345

For the resulting maps GDAL VRT text files are created either in a directory named "gdal" in the current mapset or in a user-defined vrt_directory. Those files are not removed when the raster map is removed and the user is responsible for removing them when needed.

REQUIREMENTS

r.buildvrt.gdal uses the Python bindings for GDAL and requires the GDAL-GRASS driver to include raster maps in native GRASS format in GDAL VRTs.

EXAMPLES

# Create external example data
regs='s,0,1000
n,500,1500'

eval `g.gisenv`
external_path="${GISDBASE}/${LOCATION}/${MAPSET}/.tmp/vrt"
mkdir -p "$external_path"
for reg in $regs
do
  r=$(echo $reg | cut -f1 -d",")
  s=$(echo $reg | cut -f2 -d",")
  n=$(echo $reg | cut -f3 -d",")

  g.region -g n=$n s=$s w=0 e=1000 res=1
  r.external.out format=GTiff options="compress=LZW,PREDICTOR=3" \
    directory="$external_path"
  r.mapcalc --o --v expression="${r}_${s}_gtiff_ntfs=float(x()*y())"
done

# Run performance tests
g.region -g n=1500 s=0 w=0 e=1000 res=1
format_type=gtiff_ntfs
rmaps=$(g.list type=raster pattern="*_*_${format_type}", sep=",")

# Using GRASS GIS VRT
r.buildvrt --o --v input="$rmaps" output=vrt_${format_type}
time r.univar map=vrt_${format_type}

# Using GDAL VRT
r.buildvrt.gdal --o --v input="$rmaps" output=vrt_${format_type}_gdal
time r.univar map=vrt_${format_type}_gdal

SEE ALSO

r.buildvrt, r.patch, r.external, r.external.out

AUTHORS

Stefan Blumentrath

SOURCE CODE

Available at: r.buildvrt.gdal source code (history)

Latest change: Wednesday Oct 16 13:27:01 2024 in commit: 261b8fa424db397d138705b6ae6ab8a016cded69


Main index | Raster index | Topics index | Keywords index | Graphical index | Full index

© 2003-2024 GRASS Development Team, GRASS GIS 8.5.0dev Reference Manual