1v.transform(1) GRASS GIS User's Manual v.transform(1)
2
3
4
6 v.transform - Performs an affine transformation (shift, scale and ro‐
7 tate) on vector map.
8
10 vector, transformation, geometry, GCP
11
13 v.transform
14 v.transform --help
15 v.transform [-twxyab] input=name [layer=string] output=name
16 [xshift=float] [yshift=float] [zshift=float] [xscale=float]
17 [yscale=float] [zscale=float] [zrotation=float] [col‐
18 umns=name[,name,...]] [--overwrite] [--help] [--verbose] [--quiet]
19 [--ui]
20
21 Flags:
22 -t
23 Shift all z values to bottom=0
24
25 -w
26 Swap coordinates x, y and then apply other parameters
27
28 -x
29 Swap coordinates x, z and then apply other parameters
30
31 -y
32 Swap coordinates y, z and then apply other parameters
33
34 -a
35 Swap coordinates after the other transformations
36
37 -b
38 Do not build topology
39
40 --overwrite
41 Allow output files to overwrite existing files
42
43 --help
44 Print usage summary
45
46 --verbose
47 Verbose module output
48
49 --quiet
50 Quiet module output
51
52 --ui
53 Force launching GUI dialog
54
55 Parameters:
56 input=name [required]
57 Name of input vector map
58 Or data source for direct OGR access
59
60 layer=string
61 Layer number or name (’-1’ for all layers)
62 A single vector map can be connected to multiple database tables.
63 This number determines which table to use. When used with direct
64 OGR access this is the layer name.
65 Default: -1
66
67 output=name [required]
68 Name for output vector map
69
70 xshift=float
71 Shifting value for x coordinates
72 Default: 0.0
73
74 yshift=float
75 Shifting value for y coordinates
76 Default: 0.0
77
78 zshift=float
79 Shifting value for z coordinates
80 Default: 0.0
81
82 xscale=float
83 Scaling factor for x coordinates
84 Default: 1.0
85
86 yscale=float
87 Scaling factor for y coordinates
88 Default: 1.0
89
90 zscale=float
91 Scaling factor for z coordinates
92 Default: 1.0
93
94 zrotation=float
95 Rotation around z axis in degrees (counter-clockwise)
96 Default: 0.0
97
98 columns=name[,name,...]
99 Name of attribute column(s) used as transformation parameters
100 Format: parameter:column, e.g. xshift:xs,yshift:ys,zrot:zr
101
103 v.transform performs an affine transformation (translate and rotate) of
104 a vector map. An affine transform includes one or several linear trans‐
105 formations (scaling, rotation) and translation (shifting). Several lin‐
106 ear transformations can be combined in a single operation. The command
107 can be used to georeference unreferenced vector maps or to modify ex‐
108 isting geocoded maps.
109
111 Coordinate transformation based on Ground Control Points (GCPs) is done
112 by v.rectify and not supported by v.transform.
113
114 Transformation parameters (i.e. xshift, yshift, etc.) can be fetched
115 from attribute table connected to the vector map. In this case vector
116 objects can be transformed with different parameters based on their
117 category number. If the parameter cannot be fetched from the table, de‐
118 fault value is used instead.
119
120 Note that the transformation matrix can be printed by m.transform.
121
123 DXF/DWG drawings
124 Most DXF/DWG drawings are done within XY coordinate space. To transform
125 them to a national grid, we can use v.transform together with v.rectify
126 and a first-order transformation.
127 v.transform -t in=watertowerXY out=watertower_z zscale=0.04 zshift=1320
128 v.rectify in=watertower_z out=watertowerUTM points=wt.points order=1
129
130 Extrude 2D vector points to 3D based on attribute column values
131 Spearfish example with manual table editing for vertical shift:
132 # work on own map copy:
133 g.copy vect=archsites@PERMANENT,myarchsites
134 # add new ’zs’ column to later store height of each site:
135 v.db.addcolumn myarchsites col="zs double precision"
136 v.db.update myarchsites layer=1 column=zs value="cat * 1000"
137 # perform z transformation:
138 v.transform -t input=archsites output=myarchsites3d column="zshift:zs" table="archsites_t"
139 # drop table containing transformation parameters:
140 echo "drop table archsites_t" | db.execute
141 The resulting map is a 3D vector map.
142
143 Extrude 2D vector points to 3D based on attribute column values
144 Spearfish example with automated elevation extraction for vertical
145 shift:
146 # work on own map copy:
147 g.copy vect=archsites@PERMANENT,myarchsites
148 # add new ’zs’ column to later store height of each site:
149 v.db.addcolumn myarchsites col="zs double precision"
150 # set region to elevation map and fetch individual heights:
151 g.region raster=elevation.10m -p
152 v.what.rast myarchsites rast=elevation.10m col=zs
153 # verify:
154 v.db.select myarchsites
155 # perform transformation to 3D
156 v.transform -t myarchsites output=myarchsites3d column="zshift:zs" layer=1
157 # drop table containing transformation parameters
158 v.db.dropcolumn myarchsites3d col=zs
159 The resulting map is a 3D vector map.
160
162 m.transform, i.rectify, v.rectify, r.region
163
165 Radim Blazek, ITC-irst, Trento, Italy,
166 Column support added by Martin Landa, FBK-irst (formerly ITC-irst),
167 Trento, Italy (2007/09)
168
170 Available at: v.transform source code (history)
171
172 Accessed: Saturday Oct 28 18:18:48 2023
173
174 Main index | Vector index | Topics index | Keywords index | Graphical
175 index | Full index
176
177 © 2003-2023 GRASS Development Team, GRASS GIS 8.3.1 Reference Manual
178
179
180
181GRASS 8.3.1 v.transform(1)