Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > 413e0bdb3c48563b2d8d9038d07d5533 > files > 2272

grass-6.3.0-15.fc13.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>GRASS GIS: v.transform</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="grassdocs.css" type="text/css">
</head>
<body bgcolor="white">

<img src="grass_logo.png" alt="GRASS logo"><hr align=center size=6 noshade>

<h2>NAME</h2>
<em><b>v.transform</b></em>  - Performs an affine transformation (shift, scale and rotate, or GPCs) on vector map.
<h2>KEYWORDS</h2>
vector, transformation
<h2>SYNOPSIS</h2>
<b>v.transform</b><br>
<b>v.transform help</b><br>
<b>v.transform</b> [-<b>qtms</b>] <b>input</b>=<em>name</em> <b>output</b>=<em>name</em>  [<b>pointsfile</b>=<em>name</em>]   [<b>xshift</b>=<em>float</em>]   [<b>yshift</b>=<em>float</em>]   [<b>zshift</b>=<em>float</em>]   [<b>xscale</b>=<em>float</em>]   [<b>yscale</b>=<em>float</em>]   [<b>zscale</b>=<em>float</em>]   [<b>zrot</b>=<em>float</em>]   [<b>table</b>=<em>name</em>]   [<b>columns</b>=<em>name</em>[,<i>name</i>,...]]   [<b>layer</b>=<em>integer</em>]   [--<b>overwrite</b>]  [--<b>verbose</b>]  [--<b>quiet</b>] 

<h3>Flags:</h3>
<DL>
<DT><b>-q</b></DT>
<DD>Suppress display of residuals or other information</DD>

<DT><b>-t</b></DT>
<DD>Shift all z values to bottom=0</DD>

<DT><b>-m</b></DT>
<DD>Print the transformation matrix to stdout</DD>

<DT><b>-s</b></DT>
<DD>Instead of points use transformation parameters (xshift, yshift, zshift, xscale, yscale, zscale, zrot)</DD>

<DT><b>--overwrite</b></DT>
<DD>Allow output files to overwrite existing files</DD>
<DT><b>--verbose</b></DT>
<DD>Verbose module output</DD>
<DT><b>--quiet</b></DT>
<DD>Quiet module output</DD>
</DL>

<h3>Parameters:</h3>
<DL>
<DT><b>input</b>=<em>name</em></DT>
<DD>Name of input vector map</DD>

<DT><b>output</b>=<em>name</em></DT>
<DD>Name for output vector map</DD>

<DT><b>pointsfile</b>=<em>name</em></DT>
<DD>ASCII file holding transform coordinates</DD>
<DD>If not given, transformation parameters (xshift, yshift, zshift, xscale, yscale, zscale, zrot) are used instead</DD>

<DT><b>xshift</b>=<em>float</em></DT>
<DD>Shifting value for x coordinates</DD>
<DD>Default: <em>0.0</em></DD>

<DT><b>yshift</b>=<em>float</em></DT>
<DD>Shifting value for y coordinates</DD>
<DD>Default: <em>0.0</em></DD>

<DT><b>zshift</b>=<em>float</em></DT>
<DD>Shifting value for z coordinates</DD>
<DD>Default: <em>0.0</em></DD>

<DT><b>xscale</b>=<em>float</em></DT>
<DD>Scaling factor for x coordinates</DD>
<DD>Default: <em>1.0</em></DD>

<DT><b>yscale</b>=<em>float</em></DT>
<DD>Scaling factor for y coordinates</DD>
<DD>Default: <em>1.0</em></DD>

<DT><b>zscale</b>=<em>float</em></DT>
<DD>Scaling factor for z coordinates</DD>
<DD>Default: <em>1.0</em></DD>

<DT><b>zrot</b>=<em>float</em></DT>
<DD>Rotation around z axis in degrees counterclockwise</DD>
<DD>Default: <em>0.0</em></DD>

<DT><b>table</b>=<em>name</em></DT>
<DD>Name of table containing transformation parameters</DD>

<DT><b>columns</b>=<em>name[,<i>name</i>,...]</em></DT>
<DD>Name of attribute column(s) used as transformation parameters</DD>
<DD>Format: parameter:column, e.g. xshift:xs,yshift:ys,zrot:zr</DD>

<DT><b>layer</b>=<em>integer</em></DT>
<DD>Layer number</DD>
<DD>A single vector map can be connected to multiple database tables. This number determines which table to use.</DD>
<DD>Default: <em>1</em></DD>

</DL>
<h2>DESCRIPTION</h2>

<em>v.transform</em> 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.

<h2>NOTES</h2>

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.
<p>
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):

<div class="code"><pre>
# 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
</pre></div>

<p>The ground control points may be also (ir)regularly distributed
and can be more than four points.</p>

<p>Transformation parameters (i.e. <em>xshift</em>, <em>yshift</em>,
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.<p>

<h3>Affine Transformation Matrix</h3>
The affine transfomation matrix can optionally be printed with the '-m'
flag. The format of the matrix is:
<div class="code" style="width:30%;"><pre>
| x_offset a b |
| y_offset d e |
</pre></div>

This format can be used in the <a href="http://postgis.refractions.net/docs/ch06.html#id2904406">Affine() function of PostGIS</a>
[Affine(geom, a, b, d, e, xoff, yoff)], or directly compared to the
output of a similar operation performed in R.

<h2>EXAMPLE</h2>

<h3>DXF/DWG drawings</h3>

<p>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.</p>

<div class="code"><pre>
v.transform -t in=watertowerXY out=watertowerUTM points=wt.points zscale=0.04 zshift=1320
</pre></div>

<h3>Extrude 2D vector points to 3D based on attribute column values</h3>

Spearfish example with manual table editing for vertical shift:

<div class="code"><pre>
# 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
</pre></div>
The resulting map is a 3D vector map.

<h3>Extrude 2D vector points to 3D based on attribute column values</h3>

Spearfish example with automated elevation extraction for vertical shift:

<div class="code"><pre>
# 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
</pre></div>
The resulting map is a 3D vector map.

<h2>SEE ALSO</h2>

<em><a HREF="v.in.ogr.html">v.in.ogr</a></em>

<h2>AUTHOR</h2>

Radim Blazek, ITC-irst, Trento, Italy,<br>
Column support added by Martin Landa, FBK-irst (formerly ITC-irst), Trento, Italy (2007/09)

<p><i>Last changed: $Date: 2007-10-15 11:56:34 +0200 (Mon, 15 Oct 2007) $</i>
<HR>
<P><a href="index.html">Main index</a> - <a href="vector.html">vector index</a> - <a href="full_index.html">Full index</a></P>
<P>&copy; 2003-2008 <a href="http://grass.osgeo.org">GRASS Development Team</a></p>
</body>
</html>