1v.transform(1) Grass User's Manual v.transform(1)
2
3
4
6 v.transform - Performs an affine transformation (shift, scale and
7 rotate, or GPCs) on vector map.
8
10 vector, transformation
11
13 v.transform
14 v.transform help
15 v.transform [-qtms] input=name output=name [pointsfile=name]
16 [xshift=float] [yshift=float] [zshift=float] [xscale=float]
17 [yscale=float] [zscale=float] [zrot=float] [table=name] [col‐
18 umns=name[,name,...]] [layer=integer] [--overwrite] [--verbose]
19 [--quiet]
20
21 Flags:
22 -q
23 Suppress display of residuals or other information
24
25 -t
26 Shift all z values to bottom=0
27
28 -m
29 Print the transformation matrix to stdout
30
31 -s
32 Instead of points use transformation parameters (xshift, yshift,
33 zshift, xscale, yscale, zscale, zrot)
34
35 --overwrite
36 Allow output files to overwrite existing files
37
38 --verbose
39 Verbose module output
40
41 --quiet
42 Quiet module output
43
44 Parameters:
45 input=name
46 Name of input vector map
47
48 output=name
49 Name for output vector map
50
51 pointsfile=name
52 ASCII file holding transform coordinates
53 If not given, transformation parameters (xshift, yshift, zshift,
54 xscale, yscale, zscale, zrot) are used instead
55
56 xshift=float
57 Shifting value for x coordinates
58 Default: 0.0
59
60 yshift=float
61 Shifting value for y coordinates
62 Default: 0.0
63
64 zshift=float
65 Shifting value for z coordinates
66 Default: 0.0
67
68 xscale=float
69 Scaling factor for x coordinates
70 Default: 1.0
71
72 yscale=float
73 Scaling factor for y coordinates
74 Default: 1.0
75
76 zscale=float
77 Scaling factor for z coordinates
78 Default: 1.0
79
80 zrot=float
81 Rotation around z axis in degrees counterclockwise
82 Default: 0.0
83
84 table=name
85 Name of table containing transformation parameters
86
87 columns=name[,name,...]
88 Name of attribute column(s) used as transformation parameters
89 Format: parameter:column, e.g. xshift:xs,yshift:ys,zrot:zr
90
91 layer=integer
92 Layer number
93 A single vector map can be connected to multiple database tables.
94 This number determines which table to use.
95 Default: 1
96
98 v.transform performs an affine transformation (translate and rotate) of
99 a vector map. An affine transform includes one or several linear trans‐
100 formations (scaling, rotation) and translation (shifting). Several lin‐
101 ear transformations can be combined in a single operation. The command
102 can be used to georeference unreferenced vector maps or to modify
103 existing geocoded maps.
104
106 When using an ASCII table containing source and target coordinate
107 pairs, in each row four coordinate values separated by white space have
108 to be specified. Comments are permitted and have to be indicated by a
109 '#' character.
110
111 Example for a points file of a linear transformation from XY to UTM
112 coordinates (L: left, R: right, U: upper, L: lower, N, S, W, E):
113 # Linear transformation from XY to UTM coordinates:
114 # 4 maps corners defined
115 # UL NW
116 # UR NE
117 # LR SW
118 # LL SE
119 -584 585 598000 4920770
120 580 585 598020 4920770
121 580 -600 598020 4920750
122 -584 -600 598000 4920750
123
124
125 The ground control points may be also (ir)regularly distributed and can
126 be more than four points.
127
128 Transformation parameters (i.e. xshift, yshift, etc.) can be fetched
129 from attribute table connected to the vector map. In this case vector
130 objects can be transformed with different parameters based on their
131 category number. If the parameter cannot be fetched from the table,
132 default value is used instead.
133
134 Affine Transformation Matrix
135 The affine transfomation matrix can optionally be printed with the '-m'
136 flag. The format of the matrix is:
137 | x_offset a b |
138 | y_offset d e |
139 This format can be used in the Affine() function of PostGIS
140 [Affine(geom, a, b, d, e, xoff, yoff)], or directly compared to the
141 output of a similar operation performed in R.
142
144 DXF/DWG drawings
145 Most DXF/DWG drawings are done within XY coordinate space. To transform
146 them to a national grid, we can use 'v.transform' with a 4 point trans‐
147 formation.
148 v.transform -t in=watertowerXY out=watertowerUTM points=wt.points
149 zscale=0.04 zshift=1320
150
151
152 Extrude 2D vector points to 3D based on attribute column values
153 Spearfish example with manual table editing for vertical shift:
154 # create table containing transformation parameters:
155 echo "create table archsites_t (cat int, zs double)" | db.execute
156 # insert transformation parameters for category 1:
157 echo "insert into archsites_t values (1, 1000)" | db.execute
158 # insert transformation parameters for category 2 (and so forth):
159 echo "insert into archsites_t values (2, 2000)" | db.execute
160 # perform z transformation:
161 v.transform -t input=archsites output=myarchsites3d column="zshift:zs"
162 table="archsites_t"
163 # drop table containing transformation parameters:
164 echo "drop table archsites_t" | db.execute
165 The resulting map is a 3D vector map.
166
167 Extrude 2D vector points to 3D based on attribute column values
168 Spearfish example with automated elevation extraction for vertical
169 shift:
170 # work on own map copy:
171 g.copy vect=archsites@PERMANENT,myarchsites
172 # add new 'zs' column to later store height of each site:
173 v.db.addcol myarchsites col="zs double precision"
174 # set region to elevation map and fetch individual heights:
175 g.region rast=elevation.10m -p
176 v.what.rast myarchsites rast=elevation.10m col=zs
177 # verify:
178 v.db.select myarchsites
179 # perform transformation to 3D
180 v.transform -t myarchsites output=myarchsites3d column="zshift:zs" ta‐
181 ble=myarchsites
182 # drop table containing transformation parameters
183 v.db.dropcol myarchsites3d col=zs
184 The resulting map is a 3D vector map.
185
187 v.in.ogr
188
190 Radim Blazek, ITC-irst, Trento, Italy,
191 Column support added by Martin Landa, FBK-irst (formerly ITC-irst),
192 Trento, Italy (2007/09)
193
194 Last changed: $Date: 2007-10-15 11:56:34 +0200 (Mon, 15 Oct 2007) $
195
196 Full index
197
198 © 2003-2008 GRASS Development Team
199
200
201
202GRASS 6.3.0 v.transform(1)