1r3.out.vtk(1) GRASS GIS User's Manual r3.out.vtk(1)
2
3
4
6 r3.out.vtk - Converts 3D raster maps into the VTK-ASCII format.
7
9 raster3d, export, output, voxel, VTK
10
12 r3.out.vtk
13 r3.out.vtk --help
14 r3.out.vtk [-psmocl] [input=name[,name,...]] [output=name]
15 [null=float] [top=string] [bottom=string]
16 [rgbmaps=name[,name,...]] [vectormaps=name[,name,...]] [zs‐
17 cale=float] [precision=integer] [--overwrite] [--help] [--ver‐
18 bose] [--quiet] [--ui]
19
20 Flags:
21 -p
22 Create VTK pointdata instead of VTK celldata (celldata is default)
23
24 -s
25 Create 3D elevation output with a top and a bottom surface, both
26 raster maps are required.
27
28 -m
29 Use 3D raster mask (if exists) with input maps
30
31 -o
32 Scale factor affects the origin
33
34 -c
35 Correct the coordinates to match the VTK-OpenGL precision
36
37 -l
38 Do not convert the top-bottom resolution in case of lat long pro‐
39 jection to meters
40
41 --overwrite
42 Allow output files to overwrite existing files
43
44 --help
45 Print usage summary
46
47 --verbose
48 Verbose module output
49
50 --quiet
51 Quiet module output
52
53 --ui
54 Force launching GUI dialog
55
56 Parameters:
57 input=name[,name,...]
58 3D raster map(s) to be converted to VTK-ASCII data format
59
60 output=name
61 Name for VTK-ASCII output file
62
63 null=float
64 Float value to represent no data cell/points
65 Default: -99999.99
66
67 top=string
68 Top surface 2D raster map
69
70 bottom=string
71 Bottom surface 2D raster map
72
73 rgbmaps=name[,name,...]
74 Three (R,G,B) 3D raster maps to create RGB values [redmap,green‐
75 map,bluemap]
76
77 vectormaps=name[,name,...]
78 Three (x,y,z) 3D raster maps to create vector values
79 [xmap,ymap,zmap]
80
81 zscale=float
82 Scale factor for elevation
83 Default: 1.0
84
85 precision=integer
86 Number of significant digits (floating point only)
87 Options: 0-20
88 Default: 12
89
91 The module r3.out.vtk outputs 3D raster maps into VTK-ASCII format.
92 Maps are valid 3D raster maps in the current mapset search path. The
93 output parameter is the name of a VTK-ASCII file which will be written
94 in the current working directory. If output is not specified then stan‐
95 dard output (stdout) is used. The module is sensitive to region set‐
96 tings (set with g.region).
97
99 This module generates structured points with celldata (default) or
100 pointdata. If top and bottom surfaces are requested an unstructured
101 grid with celldata or a structured grid with pointdata is generated.
102 This data is put in a simple VTK-ASCII file. Neither XML nor binary
103 output are supported. It is possible to choose more then one 3D raster
104 map to be written in the VTK-ASCII file. Each celldata is named as the
105 3D raster map it represents. The user can visualize this file with the
106 VTK Toolkit, ParaView and MayaVi which are based on VTK. In case of 3D
107 raster map with partially no data, the threshold filter in ParaView can
108 be used to visualize the valid data. Just filter all data which is
109 greater/lesser than the chosen null value in the VTK-ASCII file.
110
111 The top and bottom region values are expected in meters. If a Lati‐
112 tude-Longitude (LL) coordinates are used, the elevation value for each
113 voxel will be converted into degrees.
114
115 The input, rgbmaps and vectormaps parameters are optional, so only the
116 geometry can be exported.
117
118 If the user defines top and bottom and the 2D and 3D region values dif‐
119 fer, the 2D resolution will be adjusted to the 3D resolution. The ele‐
120 vation maps are expected in meters. If Lat/Long coordinates are used,
121 the elevation will automatically converted into degree. If the surface
122 and bottom maps are in a different unit than meters, use the scale pa‐
123 rameter to convert them into meters.
124
125 The RGB voxel data can be created from 2D raster maps (Landsat TM im‐
126 ages) with r.to.rast3. The values of the RGB maps must be within 0 and
127 255. If not, the values are automatically set to 0 and warnings will be
128 printed to stderr.
129
130 The vector data is created from three 3D raster maps. Each map repre‐
131 sents a vector component. So x, y and z components are required in
132 this order. This data can be visualized with Glyph3d or StreamTracer
133 filters within Paraview.
134
135 If the -c flag is used and the data should be visualised together with
136 other data exported via *.out.vtk modules, be sure the -c flag was also
137 set in these modules. But this will only work with data from the SAME
138 location (the reference point for the coordinates transformation is
139 based on the center point of the default region).
140
141 Difference between point- and celldata
142 r3.out.vtk can export 3D raster maps with different representations.
143
144 • pointdata -- the cells/values are represented by the center of
145 the cell. Instead of cells, points are created. Each point can
146 hold different values, but the user can only visualize one
147 value at a time.
148
149 • celldata The cells are created with the same hight, width and
150 depth as in GRASS. Each cell can hold different values, but the
151 user can only visualize one value at a time.
152
154 Simple Spearfish example
155 g.region -d
156 g.region res=150 res3=150 t=80 b=0 tbres=10
157 r.mapcalc "bottom = 1800. - elevation.10m"
158 # synthetic data, could be geological structures:
159 r3.mapcalc "map3d = row()+col()+depth()"
160 #export of volume to VTK:
161 r3.out.vtk -s input=map3d top=elevation.10m bottom=bottom output=/tmp/out.vtk
162 # visualize in paraview or other VTK viewer:
163 paraview --data=/tmp/out.vtk
164
165 Spearfish example with RGB data
166 #set the region
167 g.region -d
168 g.region n=4926970 s=4914857 w=591583 e=607793 res=50 res3=50 t=80 b=0 tbres=10
169 #create a bottom surface
170 r.mapcalc "bottom = 1800. - elevation.10m"
171 # synthetic data, could be geological structures:
172 r3.mapcalc "map3d = row()+col()+depth()"
173 #get some satellite images with r.in.onearth
174 r.in.onearth -l output=Sat tmband=Red
175 r.in.onearth -l output=Sat tmband=IR1
176 r.in.onearth -l output=Sat tmband=IR2
177 #Convert the 2D maps to 3D raster maps with r.to.rast3
178 r.to.rast3 input=SatLandsatTM_Red output=SatLandsatTM_Red
179 r.to.rast3 input=SatLandsatTM_IR1 output=SatLandsatTM_IR1
180 r.to.rast3 input=SatLandsatTM_IR2 output=SatLandsatTM_IR2
181 #export of volume to VTK:
182 r3.out.vtk -s rgbmaps=SatLandsatTM_IR1,SatLandsatTM_IR2,SatLandsatTM_Red
183 input=map3d top=elevation.10m bottom=bottom output=/tmp/out.vtk
184 # visualize in paraview or other VTK viewer:
185 paraview --data=/tmp/out.vtk
186
187 Spearfish example with vector data
188 # set the region
189 g.region -d
190 g.region n=4926970 s=4914857 w=591583 e=607793 res=50 res3=50 t=80 b=0 tbres=10
191 # create a bottom surface
192 r.mapcalc "bottom = 1800. - elevation.10m"
193 # synthetic data, could be geological structures:
194 r3.mapcalc "map3d = row()+col()+depth()"
195 # synthetic vector data, could be groundwater stream vectors
196 r3.mapcalc "x_part = sin(row())"
197 r3.mapcalc "y_part = cos(col())"
198 r3.mapcalc "z_part = sin(depth())"
199 # export the stuff data to VTK:
200 r3.out.vtk -s vectormaps=x_part,y_part,z_part input=map3d top=elevation.10m
201 bottom=bottom output=/tmp/out.vtk
202 # visualize in paraview or other VTK viewer:
203 paraview --data=/tmp/out.vtk
204 # Now use the Glyph and Stream-Trace Filter to get nice vectors and streamlines
205
206 Slovakia3d example
207 #reduce resolution:
208 g.region -dp3 res=1000 res3=1000
209 r.mapcalc "bottom = 100"
210 #export of volume to VTK:
211 r3.out.vtk -s in=precip3d.500z50 top=dem500 bottom=bottom \
212 output=/path/to/slovakia3d.vtk
213 # visualize in paraview or other VTK viewer:
214 paraview --data=/path/to/slovakia3d.vtk
215 # set Display style to ’surface#
216 # set Actor Control z to 10
217
219 r.out.vtk, r3.out.ascii, g.region
220
222 Sören Gebbert
223
225 Available at: r3.out.vtk source code (history)
226
227 Accessed: Saturday Jan 21 20:39:38 2023
228
229 Main index | 3D raster index | Topics index | Keywords index | Graphi‐
230 cal index | Full index
231
232 © 2003-2023 GRASS Development Team, GRASS GIS 8.2.1 Reference Manual
233
234
235
236GRASS 8.2.1 r3.out.vtk(1)