[GRASS-SVN] r46741 - grass/trunk/vector/v.to.rast3

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jun 18 17:58:06 EDT 2011


Author: huhabla
Date: 2011-06-18 14:58:06 -0700 (Sat, 18 Jun 2011)
New Revision: 46741

Added:
   grass/trunk/vector/v.to.rast3/random_points.txt
   grass/trunk/vector/v.to.rast3/test.v.to.rast3.sh
   grass/trunk/vector/v.to.rast3/v.to.rast3.test.png
   grass/trunk/vector/v.to.rast3/vector_to_volume.ref
Modified:
   grass/trunk/vector/v.to.rast3/main.c
   grass/trunk/vector/v.to.rast3/v.to.rast3.html
Log:
Added a test case, reference data and a screenshot.


Modified: grass/trunk/vector/v.to.rast3/main.c
===================================================================
--- grass/trunk/vector/v.to.rast3/main.c	2011-06-18 19:52:04 UTC (rev 46740)
+++ grass/trunk/vector/v.to.rast3/main.c	2011-06-18 21:58:06 UTC (rev 46741)
@@ -121,12 +121,12 @@
 	if (cat < 0) {
 	    continue;
 	}
-    /* Check if the coordinates are located in the cube */
+        /* Check if the coordinates are located in the cube */
 	if (!G3d_isValidLocation(&(map->region), Points->y[0], Points->x[0], Points->z[0])) {
 	    continue;
 	}
-    /* Convert the north, east and top coorindate into row, col and depth*/
-    G3d_location2coord2(&(map->region), Points->y[0], Points->x[0], Points->z[0], &col, &row, &depth);
+        /* Convert the north, east and top coorindate into row, col and depth*/
+        G3d_location2coord2(&(map->region), Points->y[0], Points->x[0], Points->z[0], &col, &row, &depth);
 
 	if (ctype == DB_C_TYPE_INT) {
 	    int ivalue;

Added: grass/trunk/vector/v.to.rast3/random_points.txt
===================================================================
--- grass/trunk/vector/v.to.rast3/random_points.txt	                        (rev 0)
+++ grass/trunk/vector/v.to.rast3/random_points.txt	2011-06-18 21:58:06 UTC (rev 46741)
@@ -0,0 +1,10 @@
+19.17747394|31.55063415|39.15496119|1|39
+24.18719598|72.93178863|9.87756846|2|10
+79.77326931|61.45836758|13.88873554|3|14
+53.5236053|38.19176415|31.44354624|4|31
+76.22586326|41.07207282|47.61148626|5|48
+10.05659184|50.85693824|35.86484647|6|36
+103.00769336|48.5575101|0.81502858|7|1
+90.85358752|10.97852614|40.20883771|8|40
+101.19850929|32.07555154|6.48952234|9|6
+106.94294376|79.91396144|10.91284527|10|11

Added: grass/trunk/vector/v.to.rast3/test.v.to.rast3.sh
===================================================================
--- grass/trunk/vector/v.to.rast3/test.v.to.rast3.sh	                        (rev 0)
+++ grass/trunk/vector/v.to.rast3/test.v.to.rast3.sh	2011-06-18 21:58:06 UTC (rev 46741)
@@ -0,0 +1,23 @@
+# Test the conversion of vector points into cell values
+# of raster3d maps.
+
+# We set up a specific region in the
+# @preprocess step of this test. The region setting 
+# should work for UTM and LL test locations
+g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3
+# We import vector data located in the source directory
+# The data was created using v.random with seed option:
+# v.random --o -z seed=1 n=10 output=random_points column=value zmin=0 zmax=50 column_type=integer
+# v.out.ascii input=random_points output=random_points.txt columns=value
+# I don't know if the random generator always creates the same pseudo random number with seed 1
+# on any supported operation system with a C standard library
+v.in.ascii input=random_points.txt columns='x double precision, y double precision, z double precision, key int, value int' x=1 y=2 z=3 output=random_points --o
+
+# After data creation we @test the vector to @raster3d map conversion
+# As @prescision=0 is used for data export.
+v.to.rast3 --o input=random_points column=value output=vector_to_volume
+
+# Some data export commands for reference data creation and visual validation
+# r3.out.ascii --o input=vector_to_volume output=vector_to_volume.ref dp=0 null=*
+# r3.out.vtk input=vector_to_volume output=vector_to_volume.vtk null=0
+# v.out.vtk input=random_points output=random_points.vtk

Modified: grass/trunk/vector/v.to.rast3/v.to.rast3.html
===================================================================
--- grass/trunk/vector/v.to.rast3/v.to.rast3.html	2011-06-18 19:52:04 UTC (rev 46740)
+++ grass/trunk/vector/v.to.rast3/v.to.rast3.html	2011-06-18 21:58:06 UTC (rev 46741)
@@ -1,7 +1,6 @@
 <H2>DESCRIPTION</H2>
 
-<EM>v.to.rast3</EM> converts a GRASS 3D vector point map to a GRASS 3dgrid raster3d
- (voxel) map.
+<EM>v.to.rast3</EM> converts a GRASS 3D vector point map to a GRASS raster3d map.
 
 <H2>NOTES</H2>
 
@@ -10,11 +9,22 @@
 representing the location of the vector point. As 3d cell value the database 
 attribute of the vector point is stored as float.
 
+
+<center>
+<img src=v.to.rast3.test.png border=0><BR>
+<table border=0 width=600>
+<tr><td><center>
+<i>This screenshot shows the result of the v.to.rast3 test. Visualized are the cube of the
+grass region, the vector points as black dots and the voxel cells as wireframe model. Only cells with
+non-null values are shown.</i>
+</center></td></tr>
+</table>
+</center>
+
 <H2>SEE ALSO</H2>
 
 <EM><A HREF="g.region.html">g.region</A></EM>
 
-
 <H2>AUTHOR</H2>
 
 Original s.to.rast3: Jaro Hofierka, Geomodel s.r.o.<br>

Added: grass/trunk/vector/v.to.rast3/v.to.rast3.test.png
===================================================================
(Binary files differ)


Property changes on: grass/trunk/vector/v.to.rast3/v.to.rast3.test.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: grass/trunk/vector/v.to.rast3/vector_to_volume.ref
===================================================================
--- grass/trunk/vector/v.to.rast3/vector_to_volume.ref	                        (rev 0)
+++ grass/trunk/vector/v.to.rast3/vector_to_volume.ref	2011-06-18 21:58:06 UTC (rev 46741)
@@ -0,0 +1,51 @@
+version: grass7
+order: nsbt
+north: 80.000000
+south: 0.000000
+east: 120.000000
+west: 0.000000
+top: 50.000000
+bottom: 0.000000
+rows: 8
+cols: 12
+levels: 5
+* * 10 * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * 1 * 
+* * * * * * * * * * 6 * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * 11 * 
+* * * * * * * 14 * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* 36 * * * * * * * * * * 
+* * * * * * * * * * * * 
+* 39 * * * 31 * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * 48 * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * 40 * * 
+* * * * * * * * * * * * 



More information about the grass-commit mailing list