v.transform.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <h2>DESCRIPTION</h2>
  2. <em>v.transform</em> performs an affine transformation (translate and rotate) of a
  3. vector map. An affine transform includes one or several linear transformations
  4. (scaling, rotation) and translation (shifting). Several linear transformations
  5. can be combined in a single operation. The command can be used to georeference
  6. unreferenced vector maps or to modify existing geocoded maps.
  7. <h2>NOTES</h2>
  8. When using an ASCII table containing source and target coordinate pairs,
  9. in each row four coordinate values separated by white space have to be specified.
  10. Comments are permitted and have to be indicated by a '#' character.
  11. <p>
  12. Example for a points file of a linear transformation from XY to UTM coordinates
  13. (L: left, R: right, U: upper, L: lower, N, S, W, E):
  14. <div class="code"><pre>
  15. # Linear transformation from XY to UTM coordinates:
  16. # 4 maps corners defined
  17. # UL NW
  18. # UR NE
  19. # LR SW
  20. # LL SE
  21. -584 585 598000 4920770
  22. 580 585 598020 4920770
  23. 580 -600 598020 4920750
  24. -584 -600 598000 4920750
  25. </pre></div>
  26. <p>The ground control points may be also (ir)regularly distributed
  27. and can be more than four points.</p>
  28. <p>Transformation parameters (i.e. <em>xshift</em>, <em>yshift</em>,
  29. etc.) can be fetched from attribute table connected to the vector
  30. map. In this case vector objects can be transformed with different
  31. parameters based on their category number. If the parameter cannot be
  32. fetched from the table, default value is used instead.<p>
  33. <h3>Affine Transformation Matrix</h3>
  34. The affine transfomation matrix can optionally be printed with the '-m'
  35. flag. The format of the matrix is:
  36. <div class="code" style="width:30%;"><pre>
  37. | x_offset a b |
  38. | y_offset d e |
  39. </pre></div>
  40. This format can be used in the <a href="http://postgis.refractions.net/docs/ch06.html#id2904406">Affine() function of PostGIS</a>
  41. [Affine(geom, a, b, d, e, xoff, yoff)], or directly compared to the
  42. output of a similar operation performed in R.
  43. <h2>EXAMPLE</h2>
  44. <h3>DXF/DWG drawings</h3>
  45. <p>Most DXF/DWG drawings are done within XY coordinate space. To transform
  46. them to a national grid, we can use 'v.transform' with a 4 point
  47. transformation.</p>
  48. <div class="code"><pre>
  49. v.transform -t in=watertowerXY out=watertowerUTM points=wt.points zscale=0.04 zshift=1320
  50. </pre></div>
  51. <h3>Extrude 2D vector points to 3D based on attribute column values</h3>
  52. Spearfish example with manual table editing for vertical shift:
  53. <div class="code"><pre>
  54. # create table containing transformation parameters:
  55. echo "create table archsites_t (cat int, zs double)" | db.execute
  56. # insert transformation parameters for category 1:
  57. echo "insert into archsites_t values (1, 1000)" | db.execute
  58. # insert transformation parameters for category 2 (and so forth):
  59. echo "insert into archsites_t values (2, 2000)" | db.execute
  60. # perform z transformation:
  61. v.transform -t input=archsites output=myarchsites3d column="zshift:zs" table="archsites_t"
  62. # drop table containing transformation parameters:
  63. echo "drop table archsites_t" | db.execute
  64. </pre></div>
  65. The resulting map is a 3D vector map.
  66. <h3>Extrude 2D vector points to 3D based on attribute column values</h3>
  67. Spearfish example with automated elevation extraction for vertical shift:
  68. <div class="code"><pre>
  69. # work on own map copy:
  70. g.copy vect=archsites@PERMANENT,myarchsites
  71. # add new 'zs' column to later store height of each site:
  72. v.db.addcolumn myarchsites col="zs double precision"
  73. # set region to elevation map and fetch individual heights:
  74. g.region rast=elevation.10m -p
  75. v.what.rast myarchsites rast=elevation.10m col=zs
  76. # verify:
  77. v.db.select myarchsites
  78. # perform transformation to 3D
  79. v.transform -t myarchsites output=myarchsites3d column="zshift:zs" table=myarchsites
  80. # drop table containing transformation parameters
  81. v.db.dropcolumn myarchsites3d col=zs
  82. </pre></div>
  83. The resulting map is a 3D vector map.
  84. <h2>SEE ALSO</h2>
  85. <em><a HREF="v.in.ogr.html">v.in.ogr</a></em>
  86. <h2>AUTHOR</h2>
  87. Radim Blazek, ITC-irst, Trento, Italy,<br>
  88. Column support added by Martin Landa, FBK-irst (formerly ITC-irst), Trento, Italy (2007/09)
  89. <p><i>Last changed: $Date$</i>