![GRASS logo](grass_logo.png)
NAME
v.transform - Performs an affine transformation (shift, scale and rotate, or GPCs) on vector map.
KEYWORDS
vector, transformation
SYNOPSIS
v.transform
v.transform help
v.transform [-qtms] input=name [layer=integer] output=name [pointsfile=name] [xshift=float] [yshift=float] [zshift=float] [xscale=float] [yscale=float] [zscale=float] [zrot=float] [table=name] [columns=string] [--overwrite] [--verbose] [--quiet]
Flags:
- -q
- Suppress display of residuals or other information
- -t
- Shift all z values to bottom=0
- -m
- Print the transformation matrix to stdout
- -s
- Instead of points use transformation parameters (xshift, yshift, zshift, xscale, yscale, zscale, zrot)
- --overwrite
- Allow output files to overwrite existing files
- --verbose
- Verbose module output
- --quiet
- Quiet module output
Parameters:
- input=name
- Name of input vector map
- layer=integer
- Layer number
- A single vector map can be connected to multiple database tables. This number determines which table to use.
- Default: 1
- output=name
- Name for output vector map
- pointsfile=name
- ASCII file holding transform coordinates
- If not given, transformation parameters (xshift, yshift, zshift, xscale, yscale, zscale, zrot) are used instead
- xshift=float
- Shifting value for x coordinates
- Default: 0.0
- yshift=float
- Shifting value for y coordinates
- Default: 0.0
- zshift=float
- Shifting value for z coordinates
- Default: 0.0
- xscale=float
- Scaling factor for x coordinates
- Default: 1.0
- yscale=float
- Scaling factor for y coordinates
- Default: 1.0
- zscale=float
- Scaling factor for z coordinates
- Default: 1.0
- zrot=float
- Rotation around z axis in degrees counterclockwise
- Default: 0.0
- table=name
- Name of table containing transformation parameters
- columns=string
- Name of attribute column(s) used as transformation parameters
- Format: parameter:column, e.g. xshift:xs,yshift:ys,zrot:zr
DESCRIPTION
v.transform performs an affine transformation (translate and rotate) of a
vector map. An affine transform includes one or several linear transformations
(scaling, rotation) and translation (shifting). Several linear transformations
can be combined in a single operation. The command can be used to georeference
unreferenced vector maps or to modify existing geocoded maps.
NOTES
When using an ASCII table containing source and target coordinate pairs,
in each row four coordinate values separated by white space have to be specified.
Comments are permitted and have to be indicated by a '#' character.
Example for a points file of a linear transformation from XY to UTM coordinates
(L: left, R: right, U: upper, L: lower, N, S, W, E):
# Linear transformation from XY to UTM coordinates:
# 4 maps corners defined
# UL NW
# UR NE
# LR SW
# LL SE
-584 585 598000 4920770
580 585 598020 4920770
580 -600 598020 4920750
-584 -600 598000 4920750
The ground control points may be also (ir)regularly distributed
and can be more than four points.
Transformation parameters (i.e. xshift, yshift,
etc.) can be fetched from attribute table connected to the vector
map. In this case vector objects can be transformed with different
parameters based on their category number. If the parameter cannot be
fetched from the table, default value is used instead.
Affine Transformation Matrix
The affine transfomation matrix can optionally be printed with the '-m'
flag. The format of the matrix is:
| x_offset a b |
| y_offset d e |
This format can be used in the Affine() function of PostGIS
[Affine(geom, a, b, d, e, xoff, yoff)], or directly compared to the
output of a similar operation performed in R.
EXAMPLE
DXF/DWG drawings
Most DXF/DWG drawings are done within XY coordinate space. To transform
them to a national grid, we can use 'v.transform' with a 4 point
transformation.
v.transform -t in=watertowerXY out=watertowerUTM points=wt.points zscale=0.04 zshift=1320
Extrude 2D vector points to 3D based on attribute column values
Spearfish example with manual table editing for vertical shift:
# create table containing transformation parameters:
echo "create table archsites_t (cat int, zs double)" | db.execute
# insert transformation parameters for category 1:
echo "insert into archsites_t values (1, 1000)" | db.execute
# insert transformation parameters for category 2 (and so forth):
echo "insert into archsites_t values (2, 2000)" | db.execute
# perform z transformation:
v.transform -t input=archsites output=myarchsites3d column="zshift:zs" table="archsites_t"
# drop table containing transformation parameters:
echo "drop table archsites_t" | db.execute
The resulting map is a 3D vector map.
Extrude 2D vector points to 3D based on attribute column values
Spearfish example with automated elevation extraction for vertical shift:
# work on own map copy:
g.copy vect=archsites@PERMANENT,myarchsites
# add new 'zs' column to later store height of each site:
v.db.addcol myarchsites col="zs double precision"
# set region to elevation map and fetch individual heights:
g.region rast=elevation.10m -p
v.what.rast myarchsites rast=elevation.10m col=zs
# verify:
v.db.select myarchsites
# perform transformation to 3D
v.transform -t myarchsites output=myarchsites3d column="zshift:zs" table=myarchsites
# drop table containing transformation parameters
v.db.dropcol myarchsites3d col=zs
The resulting map is a 3D vector map.
SEE ALSO
v.in.ogr
AUTHOR
Radim Blazek, ITC-irst, Trento, Italy,
Column support added by Martin Landa, FBK-irst (formerly ITC-irst), Trento, Italy (2007/09)
Last changed: $Date: 2007-10-15 02:56:34 -0700 (Mon, 15 Oct 2007) $
Main index - vector index - Full index
© 2003-2010 GRASS Development Team