r.out.vtk(1grass)
π r.out.vtk β the girlies' guide to yeeting rasters into VTK-ASCII π
okay bestie, buckle up, because r.out.vtk is a GRASS User's Manual icon and we're about to make it make sense β¨ (it lives in the 1grass section, iykyk π)
πΈ NAME πΈ
r.out.vtk β turns raster maps into the VTK-ASCII format. that's it, that's the whole job, and it does it gorgeously π
π 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 when you didn't hand it an elevation map)-sβ use a structured grid for elevation (and bestieβ¦ it is not recommended, so take the hint π)-tβ use polydata-trianglestrips for building the elevation grid-vβ use polydata-vertices for building the elevation grid (this is the one you pair withvtkDelauny2D)-oβ the scale factor also messes with the origin (again: only if no elevation map was given)-cβ correct the coordinates so they match VTK-OpenGL precision--overwriteβ let output files overwrite files that already exist (chaos mode: unlocked π₯)--helpβ print the usage summary--verboseβ verbose module output (it will talk, a lot)--quietβ quiet module output (it will say nothing, iconic)--uiβ force the GUI dialog to launch
π Parameters:
input=name[,name,...]β the raster map(s) you wanna convert into VTK-ASCII data formatoutput=nameβ the name for your VTK-ASCII output fileelevation=nameβ name of the input elevation raster mapnull=floatβ the value that stands in for a no-data cell. Default:-99999.99z=floatβ a constant elevation, for when you're not specifying an elevation map. Default:0.0rgbmaps=string[,string,...]β three (r,g,b) raster maps to build RGB values:[redmap,greenmap,bluemap]vectormaps=string[,string,...]β three (x,y,z) raster maps to build vector values:[xmap,ymap,zmap]zscale=floatβ the scale factor for elevation. Default:1.0precision=integerβ how many significant digits you get (floating point only). Options:0-20. Default:12
π DESCRIPTION π
So like β this module outputs raster maps in VTK-ASCII format. The maps have to be valid raster maps that live in your current mapset. output is the name of the VTK-ASCII file, and it gets written into your current working directory. And if you never specify output? No stress, stdout gets used instead π«Ά Oh and heads up: this module is sensitive to region settings (the ones you set with g.region), so set your region first, bestie, don't skip that step.
Elevation, scaling, point/celldata, and vector and RGB Data are all supported. Here's the tea: if your map is in LL projection, the elevation values get automatically scaled to degrees. The module assumes your elevation values are given in meters. But 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 get to set the height of the map with just one value. Point data or cell data are both available. Scaling is supported for this elevation value too. And that elevation value must be provided in meters, mmkay?
The RGB input wants three raster maps: red, green, blue β in that order. The maps must have values between 0 and 255, otherwise you will get lots of warnings and the values get set to 0 π (fr fr, watch your ranges). And more than one RGB dataset (3 maps) is not supported. Periodt.
The vector input wants three raster maps: x, y, z β which define the vector coordinates β in that order. And same deal: 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 β this one is the default π
β¦and it puts all of that into a simple VTK-ASCII file. Nor XML or binary output are supported, so don't even ask. 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. easy.
If an elevation map is chosen, a polygonal grid is created with quads β but you can also choose 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). So don't mix locations and then act surprised, bestie π
π¦ 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 β 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
no cap, if the RGB overlay looks cursed, it's almost always that "Map Scalars" checkbox. go turn it off, queen π
π 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)
Latest change: Friday Apr 17 01:04:26 2026 in commit: 32a143358df26b2e518b03c7e0d79541e8d1e5b1
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
okay that's the whole page, you're officially a VTK-ASCII export girlie now π go make something pretty in Paraview and remember: this was brought to you by the GRASS Development Team, Β© 2003-2026, from the GRASS 8.5.0 Reference Manual β and this manual page itself is r.out.vtk, part of GRASS 8.5.0. slay π«Άβ¨
π¦ where this page comes from
- alpine 3.24: grass-gis-doc 8.5.0-r1 Β· GPL-2.0-or-later
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms