GRASS logo

Note: This document is for an older version of GRASS GIS that will be discontinued soon. You should upgrade, and read the current manual page.


r.out.vtk - Converts raster maps into the VTK-ASCII format.


raster, export, output, VTK


r.out.vtk --help
r.out.vtk [-pstvoc] [input=name[,name,...]] [output=name] [elevation=name] [null=float] [z=float] [rgbmaps=string[,string,...]] [vectormaps=string[,string,...]] [zscale=float] [precision=integer] [--overwrite] [--help] [--verbose] [--quiet] [--ui]


Create VTK point data instead of VTK cell data (if no elevation map is given)
Use structured grid for elevation (not recommended)
Use polydata-trianglestrips for elevation grid creation
Use polydata-vertices for elevation grid creation (to use with vtkDelauny2D)
Scale factor affects the origin (if no elevation map is given)
Correct the coordinates to match the VTK-OpenGL precision
Allow output files to overwrite existing files
Print usage summary
Verbose module output
Quiet module output
Force launching GUI dialog


Raster map(s) to be converted to VTK-ASCII data format
Name for VTK-ASCII output file
Name of input elevation raster map
Value to represent no data cell
Default: -99999.99
Constant elevation (if no elevation map is specified)
Default: 0.0
Three (r,g,b) raster maps to create RGB values [redmap,greenmap,bluemap]
Three (x,y,z) raster maps to create vector values [xmap,ymap,zmap]
Scale factor for elevation
Default: 1.0
Number of significant digits (floating point only)
Options: 0-20
Default: 12

Table of contents


Outputs raster maps in VTK-ASCII format. Map's are valid raster map's in the current mapset. output is the name of an VTK-ASCII file which will be written in the current working directory. If output is not specified then stdout is used. The module is sensitive to region settings (set with g.region).

Elevation, scaling, point/celldata, vector and RGB Data are supported. If the map is in LL projection, the elevation values will automatically scaled to degrees. It is supposed that the elevation values are provided in meters. If the elevation values are in a different unit than meters, use the scale parameter to convert the units.

If no elevation map is given, the user can set the height of the map by one value. Point or cell data are available. Also scaling is supported for this elevation value. The elevation value must be provided in meters.

The RGB input requires three raster maps: red, green, blue - in this order. The maps must have values between 0 and 255, otherwise you will get lots of warnings and the values are set to 0. More than one RGB dataset (3 maps) is not supported.

The vector input requires three raster maps: x, y, z -- defining the vector coordinates - in this order. More than one vector dataset (3 maps) is not supported.


This filter generates: and puts this in a simple VTK-ASCII file. Nor XML or binary output are supported. It is possible to choose more then one raster map to be written to the VTK-ASCII file. Each cell-/pointdata is named like the raster map it represents. You can visualize this file with the VTK Toolkit, Paraview and MayaVi which are based on VTK. If you have a raster map with partly no data, use the threshold filter in paraview to visualize the valid data. Just filter all data which is greater/lesser than the chosen null value in the VTK-ASCII file.
If elevation map is chosen, a polygonal grid is created with quads, but the user can choose also triangle strips or vertices. These dataformats a documented at VTK Toolkit.

If the "-c" flag is used and the data should be visualised together with other data exported via *.out.vtk modules, be sure the "-c" flag was also set in these modules. But this will only work with data from the SAME location (The reference point for the coordinates transformation is based on the center point of the default region).

Difference between point- and celldata

r.out.vtk can export raster cells with different representations.


Simple Spearfish example

# set region
g.region n=4926970 s=4914857 w=591583 e=607793 res=50 -p

# export the data
r.out.vtk input=elevation.10m,slope,aspect elevation=elevation.10m output=/tmp/out.vtk

# visualize in Paraview or other VTK viewer:
paraview --data=/tmp/out.vtk

Spearfish example with RGB data

#set the region
g.region n=4926990 s=4914840 w=591570 e=607800 res=30 -p

# using to create RGB data to get a satellite coverage layers=global_mosaic mapserver= \

# export the data to VTK
r.out.vtk,, \
          elevation=elevation.10m output=/tmp/out.vtk

# visualize in Paraview or other VTK viewer:
paraview --data=/tmp/out.vtk
Paraview RGB visualization notes
To achieve proper RGB overlay:


r3.out.vtk, r.out.ascii, g.region
GRASS and Paraview Wiki page


Soeren Gebbert


Available at: r.out.vtk source code (history)

Latest change: Thursday Feb 03 11:10:06 2022 in commit: 547ff44e6aecfb4c9cbf6a4717fc14e521bec0be

Note: This document is for an older version of GRASS GIS that will be discontinued soon. You should upgrade, and read the current manual page.

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

© 2003-2023 GRASS Development Team, GRASS GIS 8.2.2dev Reference Manual