[GRASSweb-list]markus: web/grass51/tutorial examples.html,1.12,1.13

grass at intevation.de grass at intevation.de
Sat Feb 8 16:32:40 EST 2003


Author: markus

Update of /grassrepository/web/grass51/tutorial
In directory doto:/tmp/cvs-serv10221

Modified Files:
	examples.html 
Log Message:
DXF/DWG, v.transform 3D example added

Index: examples.html
===================================================================
RCS file: /grassrepository/web/grass51/tutorial/examples.html,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- examples.html	8 Feb 2003 21:31:06 -0000	1.12
+++ examples.html	8 Feb 2003 21:32:38 -0000	1.13
@@ -45,6 +45,8 @@
 <li><a href="#convert">Convert from/to GRASS 5.0 vector maps</a>
 <li><a href="#geometry">Geometry storage in various formats</a>
 <li><a href="#attributes">Attribute storage in (external) databases</a>
+<li><a href="#3DDWG">Example: Import 3D DXF/DWG vector data and NVIZ
+    3D vector visualization</a>
 <li><a href="#v.extract">Example: Extract vector data from map to new map
    with SQL statements (PostGRASS)</a>
 <li><a href="#ogr_export">Example: Vector map export data using OGR</a>
@@ -168,6 +170,90 @@
 Read on here about <a href=attrib_storage.html>storing attributes in
 GRASS 5.1</a>.
 
+<p><table width="100%" cellpadding="3" border="0">
+<tr><td align="left" bgcolor="#B0F0B0"><font color="#00000"><big><b>
+<a name="3DDWG"></a>
+Example: Import 3D DXF/DWG vector data and NVIZ 3D vector visualization
+<DIV ALIGN=right><a href="#toc">[UP]</a></DIV>
+</b></big></font></td></tr></table>
+
+[for this exercise we use the Spearfish data set from the GRASS web site]
+<P>
+Since GRASS 5.1 supports 3D vector data, we can easily import DXF and DWG
+files and display them with NVIZ:
+
+<div class="code"><pre>
+v.in.dwg in=WATERTOWER.DXF out=watertowerXY
+</div></pre>
+
+The topology should be build for 'faces' which are (filled) 3D vector
+polygons. The individual vector colors and DXF/DWG types are imported
+and stored in the related database table (DBF file per default).
+
+To know a bit more about the map, we run:
+<div class="code"><pre>
+v.info watertowerXY
+</div></pre>
+
+To look at the imported XY vector map (the DXF/DWG file is usually
+unprojected) with NVIZ, we have to generate a raster DEM for this XY region.
+Later we will transform the vector object to UTM coordinates in the
+Spearfish region.<br>
+
+As a values for the elevation it is a good idea to select the minimum
+(bottom) height of the imported 3D vector object(s). This value can be
+reported with 'v.info' (see above, B: bottom value = zmin):
+
+<div class="code"><pre>
+g.region vect=watertowerXY -p
+r.mapcalc "dem_flat=-1874"
+nviz el=dem_flat vect=watertowerXY
+</div></pre>
+
+<b>Transformation to UTM coordinates:</b>
+<P>
+Most DXF/DWG drawings are done within XY coordinates. To transform them to
+a national grid, we can use 'v.transform' with a 4 point transformation.
+We select UTM coordinates where to place the water tower and query the
+elevation (d.what.rast elevation.dem). We decide that the xy-extension of
+the watertower be 20m and it's height 100m (defined later).<br>
+The required transformation points file for 'v.transform' may look like this
+(L: left, R: right, U: upper, L: lower, N, S, W, E):
+
+<div class="code"><pre>
+# XY UTM
+#-------
+# UL NW
+# UR NE
+# LR SW
+# LL SE
+-584 585  598000 4920770
+580  585  598020 4920770
+580  -600 598020 4920750
+-584 -600 598000 4920750
+</div></pre>
+
+These values are stored in the ASCII file 'wt.points'. Then the
+transformation can be performed directly within the Spearfish location. The
+'zcale' parameter is useful to rescale the vector object height to map units
+(e.g. 100m tower height) from XY to real-world length. You can use the
+output of 'v.info' to calculate a value for 'zcale':<br>
+zcale=target_height/(T-B)<br>
+
+The 'zshift' parameter is used to shift the object vertically on top of the
+elevation model (use the bottom 'B' value shown by 'v.info' and add the
+local elevation). The '-t' flag automatically shifts the DXF/DWG object(s)
+to sea level which is useful if the vector objects were drawn with negative
+z values:
+
+<div class="code"><pre>
+v.transform -t in=watertowerXY out=watertowerUTM points=wt.points zscale=0.04 zshift=1320
+g.region rast=elevation.dem
+nviz el=elevation.dem vect=watertowerUTM
+</div></pre>
+
+You will have to zoom heavily to find the watertower as it appears to
+be very small compared to the surrounding mountains.
 
 <p><table width="100%" cellpadding="3" border="0">
 <tr><td align="left" bgcolor="#B0F0B0"><font color="#00000"><big><b>





More information about the grass-web mailing list