r.out.vtk(1)

r.out.vtk πŸ’…

okay bestie, welcome to the GRASS GIS User's Manual page for r.out.vtk β€” the lil module that turns your raster maps into VTK-ASCII so you can go absolutely feral in Paraview. let's get into it πŸ¦‹


✨ NAME ✨

r.out.vtk β€” converts raster maps into the VTK-ASCII format. that's it, that's the whole job, and it eats every time πŸ’–


🌸 KEYWORDS 🌸

raster, export, output, VTK


πŸŽ€ SYNOPSIS πŸŽ€

r.out.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]

Flags 🚩

  • -p β€” make VTK point data instead of VTK cell data (only if you're not giving it an elevation map, iykyk)
  • -s β€” use a structured grid for elevation (ngl, not recommended πŸ™ˆ)
  • -t β€” use polydata-trianglestrips for elevation grid creation
  • -v β€” use polydata-vertices for elevation grid creation (this is the one you pair with vtkDelauny2D)
  • -o β€” the scale factor also affects the origin (again: only when there's no elevation map)
  • -c β€” correct the coordinates to match the VTK-OpenGL precision ✨
  • --overwrite β€” allow output files to overwrite existing files (chaotic, but go off)
  • --help β€” print usage summary
  • --verbose β€” verbose module output
  • --quiet β€” quiet module output
  • --ui β€” force launching GUI dialog

Parameters 🧚

  • input=name[,name,...] β€” raster map(s) to be converted to VTK-ASCII data format
  • output=name β€” name for the VTK-ASCII output file
  • elevation=name β€” name of input elevation raster map
  • null=float β€” value to represent a no-data cell. Default: -99999.99
  • z=float β€” constant elevation (when no elevation map is specified). Default: 0.0
  • rgbmaps=string[,string,...] β€” three (r,g,b) raster maps to create RGB values, as [redmap,greenmap,bluemap]
  • vectormaps=string[,string,...] β€” three (x,y,z) raster maps to create vector values, as [xmap,ymap,zmap]
  • zscale=float β€” scale factor for elevation. Default: 1.0
  • precision=integer β€” number of significant digits (floating point only). Options: 0-20. Default: 12

πŸ’œ DESCRIPTION πŸ’œ

so it outputs raster maps in VTK-ASCII format. the maps have to be valid raster maps in the current mapset, no exceptions bestie. output is the name of the VTK-ASCII file it writes, and it lands in the current working directory. if you don't specify output, then stdout gets used instead. this module is sensitive to region settings β€” set with g.region, periodt.

Elevation, scaling, point/celldata, vector and RGB data are all supported πŸ’–. if the map is in LL projection, the elevation values get automatically scaled to degrees. it's assumed the elevation values come in meters. if your elevation values are in some other unit than meters, use the scale parameter to convert the units.

if no elevation map is given, you can set the height of the map with one single value. point data or cell data, your choice. scaling is supported for that elevation value too. and the elevation value must be provided in meters 🌈.

the RGB input needs three raster maps: red, green, blue β€” in that order. the maps must have values between 0 and 255, otherwise you'll get lots of warnings and the values get set to 0 😭. more than one RGB dataset (3 maps) is not supported.

the vector input needs three raster maps: x, y, z β€” defining the vector coordinates β€” in that order. more than one vector dataset (3 maps) is not supported.


🌈 NOTES 🌈

this filter generates:

  • structured points with celldata or pointdata if no elevationfile is given
  • structured grid (not recommendet) with pointdata if an elevationfile is given
  • polydataset with pointdata if an elevationfile is given (default)

and it puts this all in a simple VTK-ASCII file. Nor XML or binary output are supported (fr fr, don't ask). it's 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 all 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 an elevation map is chosen, a polygonal grid is created with quads, but you can also choose triangle strips or vertices. these dataformats are 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). don't say I didn't warn you 🫢

Difference between point- and celldata πŸ”

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

  • pointdata β€” the cells/values are represented by the center of the cell. Instead of cells, points are created. Each point can hold different values, but the user can only visualize one value at a time. These points can be connected in different ways.
  • celldata β€” is only provided if no elevation map is given. The cells are created with the same height and width as in GRASS. Each cell can hold different values, but the user can only visualize one value at a time.

⭐ EXAMPLE ⭐

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 r.in.wms to create RGB data to get a satellite coverage
r.in.wms layers=global_mosaic mapserver=http://wms.jpl.nasa.gov/wms.cgi \
         output=wms_global_mosaic
# export the data to VTK
r.out.vtk rgbmaps=wms_global_mosaic.red,wms_global_mosaic.green,wms_global_mosaic.blue \
          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:

  • In Paraview, click "Apply"
  • Select the "Display" tab and choose "Color by" to switch from input scalars to rgb scalars
  • Disable the "Map Scalars" check button in the display tab to avoid the use of a lookup table

πŸ¦‹ SEE ALSO πŸ¦‹

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

πŸ‘‘ AUTHOR πŸ‘‘

Soeren Gebbert


πŸ’– SOURCE CODE πŸ’–

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

Accessed: Saturday Jan 17 05:40:53 2026

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


and that's the whole page bestie, you ate that 🫢 ok so the cute lil sign-off: this is from the GRASS GIS 8.4.2 Reference Manual, Β© 2003-2025 GRASS Development Team, and the source/version footer was GRASS 8.4.2 with r.out.vtk(1). slay, go export some rasters βœ¨πŸŒΈπŸ’…

πŸ“¦ where this page comes from